This directory contains the configuration for deploying n8n with PostgreSQL using Docker Compose.
- Docker or Podman with docker-compose
- Nginx configured as reverse proxy (see nginx-n8n.conf)
- SSL certificates for n8n.sashi.online
.
├── docker-compose.yml # Main deployment configuration
├── .env.example # Environment variables template
├── nginx-n8n.conf # Nginx reverse proxy configuration
├── volumes/
│ ├── data/ # n8n data (workflows, credentials, etc.)
│ └── database/ # PostgreSQL data
├── ssl-certs/ # SSL certificates
└── backups/ # Database backups
-
Deploy n8n with PostgreSQL:
./deploy-podman.sh
-
Check the logs:
podman logs -f n8n podman logs -f n8n-postgres
-
Check status:
podman pod ps podman ps --filter pod=n8n-pod
-
Stop the deployment:
./stop-podman.sh
-
Stop any existing n8n containers:
docker-compose down
-
Start the services:
docker compose up -d
-
Check the logs:
docker compose logs -f
-
Check service health:
docker compose ps
Copy .env.example to .env and modify as needed:
cp .env.example .env- Change the encryption key in production!
- Change the admin password before exposing to the internet
- Update PostgreSQL password for production use
- URL: https://n8n.sashi.online
- Username: admin
- Password: (see N8N_BASIC_AUTH_PASSWORD in docker-compose.yml)
docker-compose exec postgres pg_dump -U n8n n8n > backups/n8n-backup-$(date +%Y%m%d-%H%M%S).sqldocker-compose exec -T postgres psql -U n8n n8n < backups/your-backup-file.sqldocker-compose ps# All services
docker-compose logs -f
# Just n8n
docker-compose logs -f n8n
# Just postgres
docker-compose logs -f postgresdocker-compose exec postgres psql -U n8n -d n8n -c "SELECT version();"curl http://localhost:5678/healthz-
Database not ready error
- Ensure PostgreSQL container is healthy
- Check if database was properly initialized
- Verify database credentials match
-
Port already in use
- Stop other services using port 5678
- Check with:
netstat -tlnp | grep 5678
-
Permission issues with volumes
- Ensure proper ownership:
chown -R 100999:100999 volumes/
- Ensure proper ownership:
docker-compose pull
docker-compose up -ddocker image prune -a- n8n health: http://localhost:5678/healthz
- PostgreSQL: Port 5432 (internal only)
The nginx reverse proxy configuration is in nginx-n8n.conf. Ensure:
- SSL certificates are valid
- Proxy passes to http://127.0.0.1:5678
- WebSocket support is enabled
To reload nginx:
sudo nginx -t
sudo systemctl reload nginx