What to backup? Just config and uploads?

Technical Support
  • Hello, I am quite a newbie, playing with nodebb.

    I don't understand how to run node.js standalone in a way that can be considered stable, so I run the docker image. Now, because of my inexperience I don't trust docker volumes at all, so I redirect directories. What I do in case of updates is: I delete everything, pull new image, replace files. What I am doing:

    1. backup the mongo database
    2. backup /usr/src/app/config.json
    3. backup /usr/src/app/public/uploads

    then after pulling fresh image, replace them.

    Because if I replace /usr/src/app or /usr/src/app/public I would have outdated program files, right?

    What do you think?

  • G Gliding9426 marked this topic as a regular topic on
  • G Gliding9426 marked this topic as a question on
  • G Gliding9426 marked this topic as a regular topic on
  • @Gliding9426 said in What to backup? Just config and uploads?:

    I don't understand how to run node.js standalone in a way that can be considered stable, so I run the docker image

    Welcome to the NodeBB community! In fact, running "standalone" is much better supported (and easier) than the docker image you currently have. All that is required is the following (from a basic perspective)

    • Ubuntu operating system
    • MongoDB
    • NodeJS
    • NGINX or Apache (NGINX preferred, but there's also support for Caddy I think)

    The guide here will provide you with step by step instructions
    https://docs.nodebb.org/installing/os/ubuntu/

    You can always ask here too if you need some assistance.

  • I echo @phenomlab's sentiment, what exactly is giving you pause about a standalone installation? If it's the fact that you run the node app with node app.js, you should consider using something like systemd to take care of the running and restarting of your app... or if not, just use the built in NodeBB loader ./nodebb start 😄

    As for the main question; just two things:

    1. The database
    2. public/uploads

    Everything else you can blow away. It does not hurt to preserve config.json too, but it can be easily reconstructed with ./nodebb setup.

  • it's just, in general, i can move docker containers with ease on a new server, that's the biggest advantage for me, especially when things start to go outside the project directory (systemd conf files, the nginx conf files, and so on)

    wait, if i type ./nodebb start it takes care by itself to stay in memory and i don't need to rely on ugly hacks like screen?

  • @Gliding9426 Yeah, NodeBB can fork itself and maintain its own state if you prefer not to use separate tooling. 👍


Suggested Topics


  • 1 Votes
    2 Posts
    275 Views

    @julian said in Now publishing images to GitHub Container Registry + Registry migration FAQ:

    ghcr.io/NodeBB/NodeBB (case insensitive)

    thanks, just changed the repository, but i got error from docker compose, it told me it must be all lowercase 🤠 (not case insensitive)

  • 0 Votes
    7 Posts
    456 Views

    Okay so just to confirm this is caused by an error in sharp, try creating a file called test-sharp.js in your nodebb directory with the following contents:

    'use strict'; const fs = require('fs/promises'); const sharp = require('sharp'); async function run() { const input = await fs.readFile('public/logo.png'); await sharp(input) .resize({ width: 100 }) .toFile('build/public/logo.png'); } run().then(() => {}, err => setTimeout(() => { throw err; }, 0));

    Then run it like node test-sharp.js. It should create the file build/public/logo.png. Check the exit code with echo $?.

  • 0 Votes
    6 Posts
    2k Views

    Solved!

    Soo, there appeared to be two errors. One with the nginx config which I solved in the past ( a / typo behind the proxy_pass ) for anyone having this same issue make sure you double check the nginx rules for a typo.

    Secondly a npm rebuild fixed all the issues.

    Thanks for the help guys!

  • 0 Votes
    6 Posts
    1k Views

    That is correct. The port if not defined at all is assumed to be 4567, and should only be in the url if the port is required to access the site.

  • 0 Votes
    3 Posts
    5k Views

    @a_5mith

    Yes I have already checked it. I have found a docker image created by @nopz, this one is up-to-date. But the official docker image in not! Maybe you (nodebb) should give access to a dockerfile to allow anyone to build a nodebb docker image. EDIT I found the dockerfile, and the problem about this outdated version here. It's outdated because the dockerfile build the image with the v0.5.x version :

    FROM centos:centos7 MAINTAINER NodeBB Docker Team <[email protected]> # install main packages: RUN yum -y update ; yum clean all RUN yum -y install epel-release tar ; yum clean all RUN yum -y install wget ; yum clean all RUN yum -y groupinstall "Development Tools" RUN yum -y install nodejs git ImageMagick npm RUN yum -y install openssl openssl-devel # clone nodebb and install it RUN cd /opt ; git clone -b v0.5.x https://github.com/NodeBB/NodeBB nodebb RUN cd /opt/nodebb ; npm install # Create a nodebb volume VOLUME /opt/nodebb # Define a working directory WORKDIR /opt/nodebb # Expose ports EXPOSE 80 EXPOSE 443 EXPOSE 4567 CMD [ "node", "app.js" ]

    You should (NodeBB) update this dockerfile !

    End of the EDIT

    Now, with the nopz/nodebb image I just had a problem about plugin persistence. But the first installation is so much easier and automatic with just one docker.

    Thanks for your answer by the way 🙂