Storing plugin versions in the database



  • Would it make sense to store the plugin versions in the database? Currently, only the plugin name is saved:

    > db.objects.find({ _key: 'plugins:active' })
    { "_id" : ObjectId("5c01945f24783cf614b4d40b"), "_key" : "plugins:active", "value" : "nodebb-widget-essentials", "score" : 3 }
    { "_id" : ObjectId("5c01945d24783cf614b4d095"), "_key" : "plugins:active", "value" : "nodebb-theme-persona", "score" : 0 }
    

    For context, the Cloudron NodeBB package does not save the node_modules as part of the backups (as plugin code is source code after all which is immutable). What we do is to install the required npm modules using the output of "nodebb plugins". This has worked well since a long time but recently we hit a issue where restoring an old nodebb installation resulted in the installation of a new plugin version and thus breaking the installation.

    Problem can be fixed if plugin version was stashed in the database. This way, we can then do npm install <plugin@version>.

    Thanks! (wasn't sure if this belonged to github or here, so trying this first).


  • Global Moderator

    Versions are not stored in the database, but should be stored in package.json as of a few versions ago.



  • @PitaJ Do you mean package.json of the plugins?


  • Global Moderator

    No I mean the package.json in the main nodebb directory.



  • Sorry for resurrecting an old thread.

    @PitaJ If package.json stores the version information, then does it not get overwritten when i update the nodebb repo? Or do I have manually merge package.json every time I update nodebb?


  • Global Moderator

    @girish in the NodeBB repository there is a package.json, but it is located in the install directory:

    https://github.com/NodeBB/NodeBB/blob/master/install/package.json

    npm / yarn commands do not use install/package.json when managing modules. Instead, on install we copy it into the main directory and use it to install default plugins and modules NodeBB uses. And when upgrading with ./nodebb upgrade, we merge the latest install/package.json into the main package.json, updating the dependencies of NodeBB while leaving existing installed plugins.

    Versions of default plugins will be overwritten, but versions of all other plugins will not be.



  • @PitaJ Thanks! upgrade --package is exactly what I was looking for.


Log in to reply
 

Suggested Topics

| |