n8n Workflow Setup
The n8n workflow automation instance runs at workflow.pgas.ph and is served via Caddy as a reverse proxy.
Directory Structure
Section titled “Directory Structure”n8n/├── docker-compose.yml├── Caddyfile├── .env└── n8n_data/ # persisted n8n data volume (gitignored)docker-compose.yml
Section titled “docker-compose.yml”services: n8n: image: n8nio/n8n:latest container_name: pgas-n8n restart: unless-stopped env_file: - .env environment: N8N_HOST: workflow.pgas.ph N8N_PORT: 5678 N8N_PROTOCOL: https WEBHOOK_URL: https://workflow.pgas.ph/ expose: - "5678" volumes: - n8n_data:/home/node/.n8n
caddy: image: caddy:2-alpine container_name: pgas-n8n-caddy restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config
volumes: n8n_data: caddy_data: caddy_config:Caddyfile
Section titled “Caddyfile”workflow.pgas.ph { reverse_proxy n8n:5678}Caddy handles TLS automatically via Let’s Encrypt.
Environment Variables
Section titled “Environment Variables”Create a .env file:
# Basic auth for the n8n UI (optional but recommended)N8N_BASIC_AUTH_ACTIVE=trueN8N_BASIC_AUTH_USER=adminN8N_BASIC_AUTH_PASSWORD=changeme
# TimezoneGENERIC_TIMEZONE=Asia/ManilaTZ=Asia/Manila
# Encryption key for stored credentials — generate once and keep secretN8N_ENCRYPTION_KEY=changemeDeployment
Section titled “Deployment”docker compose pulldocker compose up -dUpgrading n8n
Section titled “Upgrading n8n”docker compose pull n8ndocker compose up -d n8nn8n data is persisted in the n8n_data named volume, so upgrades do not lose workflows or credentials.
- TODO: document backup procedure for the
n8n_datavolume - TODO: document any external credential integrations (e.g. SMTP, Slack, Google)
- The webhook base URL must match
WEBHOOK_URLfor external triggers to work correctly