Skip to content
  • 1 Votes
    2 Posts
    106 Views
    ernstkiE

    @nhl-pl Good resource, thanks for sharing!

  • 3 Votes
    1 Posts
    151 Views
    oplik0O

    (a development post by a contributor, not a team member 🙂 )

    NodeBB currently works with docker... technically.
    I mean, the default image is fine if you set it up correctly - but that's a pretty big if and there wasn't any good documentation. The existing docker-compose file had some tiny pain points like:

    not exposing any ports by default it recommends setting up a reverse proxy like traefik, which can be a good idea and avoids a small docker security footgun (ports exposed by containers can bypass some firewall configurations, e.g. ufw) but also means that running docker compose up just starts up a container you can't connect to by default! You'll need to modify the config, whether you want to expose a port or set up Traefik... not setting up volumes I hope you like redoing all your configuration when updating the image! also, hope you installed some plugin for storing uploads remotely, since even they'll be gone when you delete and recreate the container you can also, again, edit it to resolve that issue not creating any database in the mongodb container using admin works, but is really not intuitive!

    And when I said the image was fine, I mean that it's acceptable, not that it's great. It always builds NodeBB before startup, installing and activating plugins in a way that will persist properly requires using arcane configuration options that are not mentioned in the docs (and it results in not being able to install or remove any plugins at runtime), and - again - setting up volumes is entirely up to the user.

    However, quite some time ago, @stevefan1999-personal made a pull request that addressed many of these issues, and over time came to address almost everything I mentioned here. And finally we're getting close to landing these changes, and some other small improvements, in NodeBB/NodeBB#12031

    So what will change?

    Running docker compose --profile mongo up is now all you need to start a working instance of NodeBB in a container. Initially it'll launch the web installer, with already populated database configuration, leaving you just to set up the NodeBB URL and admin account. Then just waiting a bit for setup to finish and you're done - NodeBB is running under port 4567. You can now use some reverse proxy on host, modify the compose file to expose it under port 80 or add a containerized reverse proxy and remove the default port binding. If you use the default compose file you'll notice that configuration and - more importantly - uploads are now mounted in .docker directory, so they'll persist when recreating the container There are some additional env variables that can affect the image startup behavior - e.g. you can now choose if NodeBB will run a build before starting.

    There's another nice change that you might've thought of if you saw the initial PR title - docker image size. And it's a fairly large difference. Some numbers:

    current image: 601MiB compressed/1.62GiB uncompressed original alpine PR: 315MiB compressed/986MiB uncompressed new PR (slim debian build): 211MiB compressed/674MiB uncompressed

    For reference, now the official MongoDB image is actually larger than NodeBB, and combined (even with redis added to the mix) they're still e.g. almost 2x smaller than Discourse slim image (747MiB compressed/2.02GiB uncompressed).
    And MongoDB is the largest of the supported databases - Postgres clocks at only 150MiB compressed and offers a 94MiB compressed alpine version, and Redis clocks in at 49MiB compressed for a debian image and just 15MiB for alpine.

    The result is that when running NodeBB with postgres the images will end up taking less than 1GB of disk space, basically half of what they do currently. All while offering much better user experience and configurability.

    And finally, Docker is graduating to being mentioned in official docs with NodeBB/docs#78 🙂

  • 0 Votes
    1 Posts
    118 Views
    pedrogaudencioP

    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 🙏

  • 1 Votes
    2 Posts
    436 Views
    Gliding9426G

    @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
    5 Posts
    259 Views
    julianJ

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

  • 6 Votes
    1 Posts
    270 Views
    julianJ

    I wanted to provide an update to my robot-written post from the other day regarding NodeBB and the Docker Hub.

    On the 14th of March, we received an email from Docker which laid out in plain terms that we were on a plan that was to-be-sunset, and that all of our data was to be deleted.

    If you don’t upgrade to a paid subscription, Docker will retain your organization data for 30 days, after which it will be subject to deletion. During that time, you will maintain access to any images in your public repositories, though rate limitations will apply. At any point during the 30-day period, you can restore access to your organization account if you upgrade to a paid subscription. Visit our FAQ for more information.

    Looking into this, it does appear that the NodeBB organization is on the "Docker Free Team" plan. We've been using the Docker Hub as a means to distribute our images as it seems to be the de facto gathering point for people using Docker. There's an implicitly guarantee of quality since the NodeBB image is published by NodeBB, the organization.

    So, it seems like all of our historical images are getting deleted. Bummer!

    N.B. A developer relations representative from Docker posted later on Hacker News that this didn't mean the "images" would be deleted — but only "organization data" — since that wasn't explicitly specified in the blurb above. Did you catch that in the italicized blurb above? I sure didn't. Do you believe it? I sure don't.

    Is this fair?

    That's a rather nuanced question with many facets. I will simply point out that the Docker organization has provided their registry for free for anyone who wanted, and it was (and still is) their perogative to do so. It also means that should they withdraw that generosity, that's also within their perogative, despite how it affects the open-source community at-large.

    There's no onus on Docker to provide their services for free, and it is difficult for companies to find a pathway toward profitability, especially when costs escalate without a corresponding match in revenue.

    Isn't Docker supported by NodeBB?

    Not officially, no. NodeBB's stance on Docker has been passive. I like to maintain that support for the Docker image (and the Dockerfile found in our repo) is on a community-supported basis only.

    The reason this is is because the main developers of NodeBB (@baris and myself) don't use Docker. It would be unfair to you, the end user, to have us try to support Docker, because we would be pretty abysmal at it. We've chosen to dedicate our time and resources elsewhere, and it does mean that our Docker implementation is minimal, perhaps lackluster.

    The second part of this is that I personally (and I very specifically do not use the "company we" here, as this is my personal opinion) am not sold on containerization. I certainly understand the convenience benefits, and the security benefits, but I consider this an abstraction that actively harms low-level understanding of how software interacts with an operating system. For the same reason I eschew front-end frameworks from a career perspective, I am hesitant on going all-in on Docker or other related technologies for similar reasons. I will not go in-depth about this for now, but reserve the right to blather on about it at a later date 😄

    I also realize that Docker is a very popular tool. The fact that it has become a household term for so many developers is a rather strong signal that containerization is The Real Deal. It is very possible that there may be a fundamental shift in the operations space away from pure ops and towards DevOps in the future that will necessitate action on our part. However, I don't think we are there right now, and I feel that this move from Docker may have set this line of thinking back for some time to come.

    Isn't NodeBB open-source? Can't you apply for an open-source account?

    Yes, and no.

    NodeBB is an open-source product. Our code is hosted on GitHub (thanks Microsoft!), and licensed under the GPL v3 license.

    At the same time, we have chosen to make this our livelihood. @baris and I have managed (with @psychobunny, for many years) to build a forum platform that can sustain our families, and allow us to spend at least part of our time on the open-source aspect of NodeBB. We offer professional consultation, theme design, custom plugins (both private and public), and a SaaS platform where you can have us host and maintain your own NodeBB, for a fee.

    Docker considers this a violation of their open-source qualification criteria:

    Not have a pathway to commercialization. Your organization must not seek to make a profit through services or by charging for higher tiers. Accepting donations to sustain your efforts is permissible.

    They have chosen to support the most vulnerable open-source developers, the ones who contribute and maintain open-source projects just for the benefit to the world, and that's commendable. We do not fit that narrow scope, and that's fine too.

    What happens now?

    Docker wants us to pay to use the Docker Hub, and we have decided not to for the aforementioned reasons above.

    Community members have already shared their thoughts with us, and are even helping us transition away from Docker Hub. We really appreciate them! We have no vested interest in Docker, and with regards to containerization of NodeBB, we will go where the prevailing winds of public opinion take us. Whether that be the GitHub Container Registry, or somewhere else.

    There are users whose NodeBB installs are maintained via the images on Docker Hub. We currently don't have guidance for those users, but we will in the coming days/weeks. If you are one of those users, what's important to note now is that you can no longer rely on those images being around in perpetuity.

    This is an issue that — as of writing — is currently still in flux. Public opinion is heated and so are the responses from Docker.

    References https://blog.alexellis.io/docker-is-deleting-open-source-images/ (Hacker News Discussion) https://www.docker.com/blog/we-apologize-we-did-a-terrible-job-announcing-the-end-of-docker-free-teams/ (Hacker News Discussion)
  • 1 Votes
    2 Posts
    309 Views
    N

    ./public/uploads/ should be persist, it's used for the uploaded files.

    By the way, how do you handle the persist problem in docker?

  • 4 Votes
    9 Posts
    3k Views
    Per0xP

    @ᴅᴀʀᴛʜ-ᴠᴀᴅᴇʀ It probably crashes because of the plugins you installed and nodebb can't find them (nodebb-theme-oxide in particular)

    I suggest you backup the redis database by copying the /data folder somewhere, then delete the contents of the original folder and also remove the config.json volume.

    Erase and restart redis and nodebb container (It should be like a fresh install) then installs the plugins and themes listed in the log file (nodebb-plugin-teamspeak-verify, nodebb-widget-search-bar, nodebb-theme-oxide, etc)

    When all plugins are installed and enabled, stop the nodebb container and restore the /data redis database with your backup, and remap config.json volume and I think it should be up.

    Next time you want to upgrade, disable all plugins before restarting the container with the new image.

  • 0 Votes
    5 Posts
    2k Views
    F

    Problem solved, for the record I have added all file on my GitHub: https://github.com/LM1LC3N7/Dockerfiles/blob/master/nodebb/README.md

  • 0 Votes
    5 Posts
    3k Views
    TelokisT

    @Doppy Forgot to mention you !

  • Cannot restore database

    Unsolved Technical Support
    6
    0 Votes
    6 Posts
    3k Views
    julianJ

    Unfortunately we cannot debug docker installs as that is a community contributed installation guide. Perhaps someone else here can help you out (e.g. @Ben-Lubar ?)

  • 0 Votes
    8 Posts
    5k Views
    Q

    @flex said:

    Do you think that it's possible to don't use yours and replace it by my reverse proxy ?

    HI, If you meant that one use a niginx which is installed on a host instead of a dockerized nginx which is dedicated for NodeBB, then it's totally possible, yes 🙂

    I just put some ideas and matters

    One can remove a dockerized nginx easily by just a modifying(removing) of nginx part from docker-compose.yml. Really, that's just it. ( This is a full chain, but if one doesn't need/want a full chain then.. 🙂 ) One can use a dockerized nginx as a prime web server instead a host installed web server and can serve subomains or what ever with other docker or directory Actually this doesn't happen yet, but nginx can serve static files for NodeBB efficiently and you know, nginx is extremely small. So I'd rather proxy from a host installed nginx to the nodebb dedicated nginx docker ( In this case one needs to change a line 80:80 with 8080:80 or <any port>:80 in docker-compose.yml )

    But, if anybody wants to get an easier way and less steps, then your idea will be also a good option.

  • 7 Votes
    12 Posts
    11k Views
    PitaJP

    @alphagao link me whatever guide you're using. If you don't know what to do, use this guide:

    Link Preview Image Ubuntu (Recommended) - NodeBB Documentation

    favicon

    (docs.nodebb.org)

  • 0 Votes
    3 Posts
    5k Views
    F

    @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 🙂

  • 1 Votes
    8 Posts
    17k Views
    BzllB

    @Absam-Sibsam you saved me bro, worked perfectly!

  • 0 Votes
    6 Posts
    3k Views
    M

    @Xiph Thank you so much for the reply!

    We're not actually pulling images from Docker Hub, as the default image out there seems to just pull an 0.5 branch. We're actually building the image from source using the Dockerfile that is included.

    The info you included will be super helpful in getting this going the way we want. We will not be posting these images publicly, for the exact reasons you mentioned above (i.e. secret).

    I'll probably be back with more questions though. 😃

  • 0 Votes
    4 Posts
    2k Views
    leemyL

    Thanks a lot! It works 😄