Syncing a productive and a testing instance of nodeBB



  • Hey folks,
    I am running a small instance of nodeBB (about 30 users). When testing changes to the site I don't want this instance of nodeBB to be affected directly. Instead, I'd like to create a testing copy.
    I already set up nodeBB in a separate folder listening on a different port, made accessible under another subdomain. However, now that it gets to data syncing I am uncertain how to achieve my goal.

    I would like to have a recent copy of the productive page, including all user accounts, posts and plugins. When changes are made to the testing environment, these should persist when a new sync is performed (ideally, I would like to copy everything from productive to testing automatically every few minutes or so).

    I figured that (since my instance runs on mongoDB) db.copyDatabase() should be the way to go for the user related stuff. As this answer on Stackoverflow states, it should merge the two databases without deleting stuff from testing.

    For the nodeBB instance itself, including all plugins I thought that I could probably go with rsync. However, some files must not be synced. This holds at least for config.json and I am not sure whether or not I have to keep in mind other files that should be unique between two instances.

    My question basically is if I my approach would work or if I am missing some important points.
    Any help in realising my project is much appreciated :).


  • Admin

    If you use rsync, just rsync node_modules/ and public/uploads. Everything else stays the same.

    Sometimes copyDatabase duplicates categories... who knows what else, but let us know if it works well :smile:



  • @julian have you ever used copyDatabase with an already existing destination? For me it just fails with

    "errmsg": "failed to create collection "nodebb_testing.sessions": collection already exists"

    which sounds as if it would expect an empty database or at least one without duplicate collections.
    If this won't work I doubt that there is a readymade command to help me achieve my goal.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.