English
Get started
← All templates

Deploy NodeBB on Pethost in one click

A forum for your community

What happens

  1. You sign in to Pethost or make an account, with a passkey, GitHub or Google.
  2. No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
  3. New project opens at the app. You fill in what it asks for and click Create project: Admin password.
  4. In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
  5. It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.

First steps

Sign in as admin with the password you gave; the first start builds the forum and takes a few minutes. Anyone may register: who can join is set under Admin > Settings > Users. Email, password resets included, works once an SMTP server is set under Admin > Settings > Email.

What it runs

The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.

services:
  nodebb:
    image: ghcr.io/nodebb/nodebb:4.x
    restart: unless-stopped
    # The first start installs the forum with this admin, so the web installer the image would
    # open to whoever comes first never runs: without config.json the container exits instead.
    # NodeBB asks a terminal again for a password it refuses, so the setup has a time limit.
    entrypoint:
      - tini
      - --
      - sh
      - -ec
      - |
        if [ ! -f /opt/config/installed ]; then
          setup='{"trust_proxy": 1}' timeout 300 /usr/src/app/nodebb setup --config=/opt/config/config.json --skip-build
          test -f /opt/config/config.json
          touch /opt/config/installed
        fi
        test -f /opt/config/config.json
        exec entrypoint.sh
    environment:
      NODEBB_URL: ${URL}
      NODEBB_DB: redis
      NODEBB_DB_HOST: redis
      NODEBB_ADMIN_USERNAME: admin
      NODEBB_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      # Setup needs an address; it is stored as confirmed, and no mail is sent to it.
      NODEBB_ADMIN_EMAIL: [email protected]
    depends_on:
      redis:
        condition: service_healthy
    # Every folder the image declares as a volume; node_modules keeps the plugins installed later.
    volumes:
      - config:/opt/config
      - uploads:/usr/src/app/public/uploads
      - build:/usr/src/app/build
      - node_modules:/usr/src/app/node_modules

  # The forum's only database: every write goes to the append-only file.
  redis:
    image: redis:8-alpine
    restart: unless-stopped
    command: [redis-server, --appendonly, "yes", --loglevel, warning]
    volumes:
      - redis:/data
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"]
      interval: 5s
      timeout: 3s
      retries: 12

volumes:
  config:
  uploads:
  build:
  node_modules:
  redis: