Skip to main content
NodeForgeCMS ships with a production-ready Dockerfile and docker-compose.yml that orchestrate the CMS server, MySQL 8, and Redis 7 as a single multi-container application. This is the fastest path to a reproducible, isolated deployment — all service dependencies are declared in one file, and a single command brings the entire stack online. If you’re running on a container-friendly host or already use Docker in your workflow, this is the recommended deployment path.
1
Install Docker and Docker Compose
2
Make sure Docker Engine and the Docker Compose plugin are installed on your server before proceeding.
3
On Ubuntu/Debian:
4
# Install Docker Engine
curl -fsSL https://get.docker.com | sh

# Verify installation
docker --version
docker compose version
5
You’ll need Docker Engine 20.10+ and Docker Compose v2.0+. Refer to the official Docker installation docs for other operating systems.
6
Configure Environment Variables
7
Copy the example environment file and fill in your production values:
8
cp server/.env.example server/.env
9
Open server/.env and set your database credentials, JWT secret, Redis connection, and server host. Pay particular attention to:
10
  • DATABASE_PASSWORD — set a strong password; this value must match what MySQL initializes with
  • JWT_SECRET — generate a random 32+ character string (see the Environment guide)
  • SERVER_HOST and IMG_HOST — set to your public domain
  • 11
    See the full Environment Variables guide for a description of every variable.
    12
    Start All Services
    13
    With your .env file configured, bring up the full stack:
    14
    docker compose up -d
    
    15
    This command:
    16
  • Builds the NodeForgeCMS image from the included Dockerfile
  • Pulls the official MySQL 8 and Redis 7 images
  • Starts all three containers in the background (-d = detached mode)
  • Creates a dedicated Docker network so the services can communicate
  • 17
    Verify that all containers are running:
    18
    docker compose ps
    
    19
    You should see node-forge-cms, node-forge-mysql, and node-forge-redis with a status of Up.
    20
    Import the Database
    21
    On first run, you need to import the initial database schema and seed data into the MySQL container. The project includes a SQL file for this purpose.
    22
    Find the MySQL container name, then run the import:
    23
    # Import the initial SQL dump
    docker compose exec mysql mysql \
      -u root \
      -p"${DATABASE_PASSWORD}" \
      node_forge_cms < server/sql/init.sql
    
    24
    Replace server/sql/init.sql with the actual path to your SQL file if it differs. You only need to run this once — on subsequent restarts, MySQL will read from its persisted volume.
    25
    MySQL data is persisted using a named Docker volume, so your database survives container restarts and image updates. To inspect or back up the volume:
    # List volumes
    docker volume ls
    
    # Create a database backup
    docker compose exec mysql mysqldump \
      -u root -p"${DATABASE_PASSWORD}" \
      node_forge_cms > backup.sql
    
    Do not use docker compose down -v in production — the -v flag removes volumes and will permanently delete your database.
    26
    Build the Admin Panel
    27
    The admin panel is a static Vue application that must be compiled and placed where Nginx (or your reverse proxy) can serve it. The build command depends on your domain topology:
    28
    Separate Domains
    cd admin
    pnpm build:prod
    
    Output is written to admin/dist/. Point your reverse proxy for admin.yourdomain.com at this directory.
    Shared Domain
    cd admin
    pnpm build:sigle
    
    This variant sets the correct base path so the admin panel is served from /admin. Output is written to admin/dist/.
    29
    Access the Application
    30
    Once all services are running, the database is imported, and the admin panel is built, your NodeForgeCMS instance is live. Open your configured SERVER_HOST in a browser to see the public site, and navigate to /admin (or admin.yourdomain.com for separate-domain deployments) to access the admin panel.
    31
    If you haven’t yet pointed a domain at the server, you can test locally by visiting http://localhost:3000.

    Automated Deployment with deploy.sh

    The project includes a deploy.sh script that automates the full build-and-restart cycle — useful for deploying updates without manual steps:
    # Make the script executable (first time only)
    chmod +x deploy.sh
    
    # Run a deployment
    ./deploy.sh
    
    The script typically handles pulling the latest code, rebuilding the Docker image, and restarting the affected containers. Review the script contents before running it on a new server to understand exactly what it does in your specific project version.

    Useful Docker Compose Commands

    TaskCommand
    Start all servicesdocker compose up -d
    Stop all servicesdocker compose down
    Restart all servicesdocker compose restart
    Restart a single servicedocker compose restart app
    Stream live logs (all services)docker compose logs -f
    Stream logs for one servicedocker compose logs -f app
    Rebuild and restartdocker compose up -d --build
    Open a shell in the app containerdocker compose exec app sh
    Run docker compose logs -f immediately after docker compose up -d to watch the startup sequence in real time. If the app container exits unexpectedly, the logs will show the exact error — most commonly a misconfigured .env value or a database connection failure.