DevOps
Infrastructure and deployment resources
@traversymedia4 itemsUpdated September 29, 2026
Docker Compose - Node.js + PostgreSQL
YAMLProduction-ready Docker Compose setup for Node.js applications with PostgreSQL.
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/myapp
- NODE_ENV=development
volumes:
- .:/app
- /app/node_modules
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=myapp
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres_data:Deploy to Production
TerminalQuick deployment script: pull latest changes, install deps, build, and restart PM2 processes.
git pull origin main && npm ci && npm run build && pm2 restart allDocker Documentation
Official Docker documentation - containers, images, compose, and more.
Docker Documentationhttps://docs.docker.com/
GitHub Actions Documentation
CI/CD workflows with GitHub Actions - automate builds, tests, and deployments
GitHub Actions Documentationhttps://docs.github.com/en/actions