Migrating to NodeBB - good stuff


  • @bentael quick update: first draft of the vbexporter has been submitted for open-sourcing approval.

    It needs a bit more cleanup for general consumption ( it's my first node_module "release" ) but it's a decent starting point.

    Also I'm going to go ahead and fork your importer. Once I've got anything worth contributing back I'll figure out how to issue a pull request ( first time for that, too ).

    Thanks for all your work (and the node team too)! I'm excited to be able to contribute something back.

  • Plugin & Theme Dev

    @medwards sweet! once it's opened, I will fork it and give you a hand polishing it up.


  • @bentael @psychobunny @julian

    So I have approval to open source the vb exporter. It's rough at the moment and I won't have time to improve it a for a few weeks, but at least it'll be out there. I'll post a link later today.

    Quick question, also. After the most recent run of the importer my "admin" user (uid:1) does not appear to be an admin user. He's in the gid:2:members set which is the administrators group. I found an old post that said to add the id to the "administrators" global key in redis, but that doesn't appear to exist anymore.

    Any pointers?

  • Plugin & Theme Dev

    @medwards i may have an idea why, investigating..

  • Plugin & Theme Dev

    /facepalm
    https://github.com/akhoury/nodebb-plugin-import/blob/master/lib/import.js#L522 that's a left over from my early nib code.

    but that may require a little more work to fix that i thought. If you already migrated, try to make the use an Admin manually.
    go to the /admin/users/search route, find that user, click on Make Admin.

  • Plugin & Theme Dev

    oh wait, im dumb, if do not have any admin users, you can't go the to /admin page.

    @medwards it's 'group:gid' global object,

    redis-cli hgetall group:gid
    # you should get an 'adminisitrator' field with value, most likely 2
    
    # then, assuming gid is 2, and the user.id that you want to make admin is also 2 (just a coincidence), so really the command is sadd gid:{gid}:members {uid}
    sadd gid:2:members 2
    

  • @bentael I think the database is already in the state you are trying to get me to put it in:

    redis> hgetall group:gid

    1. "registered-users"
    2. "1"
    3. "administrators"
    4. "2"

    redis> smembers gid:2:members

    1. "1"

    redis> hget user:1 username
    "admin"

    redis>

    The user "admin" (uid:1) is already in the gid:2:members set (which is the "administrators" group).

    Are we sure the latest version didn't change the way privileges are allocated?
    @psychobunny

  • Plugin & Theme Dev

    @medwards your data looks correct, so you have 1 admin only, If you use the --flush flag with import, it WILL create the first admin user as admin:password because it is required by the NodeBB setup, basically just calling

    node app --setup="{ escaped JSON goes here}"
    

    to make sure you have the right DB schema, here are the default values. https://github.com/akhoury/nodebb-plugin-import/blob/master/lib/import.js#L79

    ###tl;dr
    no matter if you have admins or in the imported DATA, the import WILL create the first admin for you, and tries to make YOUR imported-admins admins,

  • Plugin & Theme Dev

    that's why your first user with id 1 has id 2, so .. all ids are incremented by one.
    One way to avoid this is to set your main admin as the default Admin in the config.setupVal values, and delete its _uid.1 file. this way, it will be the one to be imported as the main admin, and all of its posts will be owned by that same one.


  • @bentael Sorry for the delayed reply.

    I understand everything you said, but I don't think that is my problem. I am using the "admin" user that is uid:1.

    After digging into the code I was able to figure this out. It looks like the group that grants admin access has changed from "administrators" to "Administrators" which is case sensitive. I was able to solve my problem with

    hset group:gid Administrators 2
    

    I based this on line 752 in user.js

    groups.getGidFromName('Administrators', function(err, gid) {
    

    which sort of just creates another name for the same group... I think. Not sure if this would work throughout the codebase or not.

  • GNU/Linux Admin

    Whoa, actually it's the reverse. "Administrators" changed to "administrators", so if your build is expecting admins to be in group "Administrators", you should probably grab the latest codebase and try his importer again šŸ™‚


  • I see what you mean in the commit log. Based on this:

    @julian said:

    @bentael @medwards For the most part, we're limiting refactors to minor version bumps, and as the next version is 0.3.1, you should be fine if @bentael fixes up the importer for edge, even if 0.3.1 isn't released by then.

    I was running the data import using the version he specified, but then launching the web app with v0.3.0 expecting them to be data compatible. I'll have to upgrade the code I'm using to launch the web server - my mistake.

  • Plugin & Theme Dev

    @medwards yea, you will need to use the version I specified for both import and run, but then after you can just ./nodebb upgrade to be on the latest.
    as soon as 0.3.1 is out, I will stablize the importer again, and with every minor release for here on (0.4.0, 0.5.0 etc..)


  • @bentael Just a few (business) days late:

    https://github.com/MakerStudios/nodebb-plugin-vbexporter

    I'll ask about renaming it now that I've looked a little closer and understand your naming convention.

  • Plugin & Theme Dev

    sweet .


  • @medwards said:

    @bentael Just a few (business) days late:

    https://github.com/MakerStudios/nodebb-plugin-vbexporter

    I'll ask about renaming it now that I've looked a little closer and understand your naming convention.

    sweet - how exactly does one use the vbexporter ?

  • Plugin & Theme Dev

    @eva2000 this exporter hits the VB databases, gets all the relevant data, then writes them all on the file system in some storage directory in a structure that this nodebb-plugin-import can understand then import to the NodeBB database. .. basically a two step import technique.


Suggested Topics

| | |

Ā© 2014 ā€“ 2022 NodeBB, Inc. ā€” Made in Canada.