This practical guide shows business owners how to deploy n8n with Docker on Ubuntu Server 24.04. It covers prerequisites, a production-friendly Docker Compose setup, secure networking, and maintenance tips — so you can automate tasks reliably whether your team is in Toronto, Vancouver, Montreal, Calgary, Ottawa or Halifax.
Why run n8n on Ubuntu 24.04 with Docker
n8n is a lightweight but powerful open-source workflow automation tool. Running it in Docker on a stable OS like Ubuntu Server 24.04 gives you:
- Environment isolation and easy upgrades
- Predictable dependency management across dev/test/prod
- Simple backups via volumes and consistent restoration
For small businesses in Winnipeg, Edmonton, or Halifax, this stack reduces time-to-value while keeping hosting costs predictable. If you prefer expert setup, our Automation Solutions team can deploy and manage it for you.
What you’ll need before starting
Basic requirements and recommended choices
- An Ubuntu Server 24.04 instance (cloud or on-prem) with sudo access
- At least 2 CPU cores and 4GB RAM for small teams; scale up for higher load
- A domain name and DNS pointing to your server for production webhook reliability
- Docker and Docker Compose (we'll install these)
- Optionally: a managed Postgres instance or a local Postgres container for production data
Checklist: quick pre-flight
- Update system packages: apt update && apt upgrade
- Create a dedicated linux user (e.g., "n8nadmin") for deployments
- Open ports 80 (HTTP) and 443 (HTTPS) on your firewall for public webhooks
- Decide on authentication: Basic Auth, OAuth for apps, or reverse-proxy with TLS
- Plan backups for PostgreSQL and n8n data volumes
Step-by-step: Install Docker and Docker Compose on Ubuntu 24.04
1. Install required packages and Docker
sudo apt update && sudo apt upgrade -y
sudo apt install -y ca-certificates curl gnupg lsb-release
# Add Docker's official GPG key and repository
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Test Docker
sudo docker version
2. Create a system user and directories
sudo useradd -m -s /bin/bash n8nadmin
sudo mkdir -p /srv/n8n/data /srv/n8n/postgres
sudo chown -R n8nadmin:n8nadmin /srv/n8n
Working as that user helps contain deployment files. Switch with: sudo -i -u n8nadmin
Deploy n8n with Docker Compose (production recommended)
Below is a practical Docker Compose configuration that runs Postgres and n8n with persistent volumes and basic auth. Adjust passwords and domain settings for your environment, and consider a managed DB for high availability.
cat > /srv/n8n/docker-compose.yml <<'YAML'
version: "3.8"
services:
postgres:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_USER: n8n
POSTGRES_PASSWORD: strong_password_here
POSTGRES_DB: n8n
volumes:
- ./postgres:/var/lib/postgresql/data
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "5678:5678"
environment:
# Database
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: strong_password_here
# Basic auth for simple protection (for small teams)
N8N_BASIC_AUTH_ACTIVE: "true"
N8N_BASIC_AUTH_USER: admin
N8N_BASIC_AUTH_PASSWORD: change_this_password
# Host and webhook configuration
N8N_HOST: your-n8n.example.com
NODE_ENV: production
TZ: America/Toronto
volumes:
- ./data:/home/node/.n8n
depends_on:
- postgres
YAML
Start the stack:
cd /srv/n8n
sudo docker compose up -d
Follow logs to ensure services start correctly:
sudo docker compose logs -f n8n
Secure your deployment: reverse proxy and TLS
For production use, front n8n with an nginx or Traefik reverse proxy that terminates TLS using Let's Encrypt. This gives you reliable webhooks and eases configuration for multiple services (useful if you're also running API Development microservices or web apps).
Backups and maintenance
Automated Postgres backups
Schedule regular dumps of your Postgres DB to a safe storage location (S3 or offsite). Example cron job (as root or using a backup container):
# Example: daily dump to /srv/n8n/backups
0 2 * * * pg_dump -U n8n -h /run/postgresql -F c n8n \
-f /srv/n8n/backups/n8n_$(date +\%F).dump
For teams in Calgary or Ottawa, storing backups in a separate cloud region reduces recovery risk.
Scaling n8n for growing teams
If your business in Montreal or Vancouver scales to many concurrent workflows, consider:
- Using a managed Postgres cluster for HA and backups
- Running multiple n8n instances behind a load balancer
- Offloading long-running jobs to worker containers (n8n supports worker mode)
Our Automation Solutions and IT Services teams can design the right scale plan for your needs.
Common Mistakes when deploying n8n with Docker
- Not setting up a proper DB: Relying on default SQLite for production will break at scale and makes backups harder.
- Exposing n8n without authentication: Webhooks can be abused if you leave ports open without TLS and auth.
- Using weak passwords in environment variables: Use secrets management or Docker secrets for sensitive values.
- Ignoring webhook host configuration: If N8N_HOST is incorrect, external services will fail to reach your workflows.
- Skipping monitoring: No logs/metrics = slow incident response. Integrate with your logging/alerting stack early.
Troubleshooting tips
n8n returns 502 or Webhooks fail
Check your reverse proxy config and ensure webhooks reach port 5678 or the proxied socket. Confirm N8N_HOST matches your public domain and that TLS termination forwards the correct headers.
Workflows are slow or failing under load
Look at Postgres performance (indexes, connection counts), increase n8n worker count, and split long tasks into smaller steps. Consider managed DB or add a Redis-backed queue for heavy workloads.
FAQ
Can I run n8n on a single small VPS for my small business?
Yes. For many small teams in cities like Halifax or Winnipeg, a single VPS with 2–4GB RAM and Postgres in a container is sufficient. Use basic auth and TLS to secure it. As usage grows, plan for a managed DB and replicated n8n workers.
Is Docker safe for production use with n8n?
Docker is widely used in production. For safety, keep Docker and images up to date, run containers as non-root where possible, and use a reverse proxy with TLS. If you need compliance-level controls, our IT Services team can help harden your environment.
How do I back up my n8n workflows and credentials?
Workflows and credentials are stored in the database and the n8n data volume. Back up Postgres dumps and snapshot the data volume. For businesses in Toronto or Calgary, automate backups to cloud storage and test restores regularly.
Can SFWeb set this up and maintain it for us?
Absolutely. We help companies across Canada—from Vancouver startups to Ottawa nonprofits—with deployment, scaling, and integrations. For hands-off setup, request our managed deployment via Contact or explore our Automation Solutions.
Checklist before going live
- Confirm DNS and TLS are configured for your N8N_HOST domain.
- Enable authentication (Basic or OAuth) and replace default passwords.
- Configure backups for Postgres and data volumes.
- Set up monitoring and log retention for incident response.
- Validate webhooks with a staging environment before production rollout.
Conclusion and next steps
Deploying n8n with Docker on Ubuntu Server 24.04 gives your business a repeatable, maintainable automation platform. Follow the steps above to install Docker, deploy a production-ready Docker Compose stack, secure it with TLS and auth, and schedule backups. If you want a turnkey rollout, our Automation Solutions and Small Business Solutions teams can deploy, secure, and monitor n8n for your organisation—whether you're in Toronto, Montreal, or Edmonton.
Ready to automate workflows without the setup headache? Reach out to our experts to design and manage an n8n deployment tailored to your business: Contact us today.