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


  • 0 Votes
    1 Posts
    48 Views

    I'm trying to setup a Digital Ocean app using the Dockerfile below - this is based on the original Dockerfile from the Docker container packages. I managed to get this working locally having little changes made to the original Dockerfile, since I'm using a custom template and this is pulled from a public git repo on the NodeBB package.json file, so no major changes from the normal setup.

    Here's the Dockerfile I'm using:

    FROM --platform=linux/amd64 node:lts as npm RUN mkdir -p /usr/src/build && \ chown -R node:node /usr/src/build WORKDIR /usr/src/build ARG NODE_ENV=production ENV NODE_ENV $NODE_ENV # nodebb-docker/ folder contains the repo https://github.com/NodeBB/NodeBB COPY --chown=node:node nodebb-docker/install/package.json /usr/src/build/package.json USER node RUN npm install --omit=dev FROM --platform=linux/amd64 node:lts RUN mkdir -p /usr/src/app && \ chown -R node:node /usr/src/app WORKDIR /usr/src/app ARG NODE_ENV ENV NODE_ENV $NODE_ENV COPY --chown=node:node --from=npm /usr/src/build /usr/src/app USER node RUN npm rebuild && \ npm cache clean --force COPY --chown=node:node nodebb-docker /usr/src/app ENV NODE_ENV=production \ daemon=false \ silent=false EXPOSE 4567 CMD test -n "${SETUP}" && ./nodebb setup || node ./nodebb build; node ./nodebb start

    Even though the build is running successfully (locally and in production) and I can run the container locally, I get this message on failed deployment:

    [2023-07-27 13:56:26] 2023-07-27T13:56:26.239Z [3] - info: Launching web installer on port 4567 []

    Anyone has had this before? Thank you 🙏

  • 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
    5 Posts
    3k Views

    @Doppy Forgot to mention you !

  • 0 Votes
    6 Posts
    2k Views

    Yes replacing is an option, but did you know that when you replace it the avatar the actual file it self doesn't, the previous image stays in the image folder. 😟

    Thanks @julianlam

  • 0 Votes
    3 Posts
    1k Views

    @baris thank you! I will give this a try.