Deployment Guide
Overview
This section covers everything you need to know about deploying applications to the DineTogether infrastructure.
Deployment Basics
Every deployment follows these principles:
- Docker Compose First: Define your application in
docker-compose.yml - Git-Driven: Push to GitHub triggers deployment
- Automatic Conversion: Docker Compose converts to Kubernetes
- Zero Downtime: Rolling updates keep apps available
Deployment Topics
📝 Docker Compose Configuration
Learn how to structure your docker-compose.yml for optimal deployment:
- Service configuration
- Network setup
- Volume management
- Environment variables
🔐 Secrets Management
Handle sensitive data securely: - GitHub Secrets setup - Kubernetes secrets - Best practices
🌍 Environment Management
Deploy to different environments: - Staging vs Production - Environment-specific config - Domain management
Quick Start Example
1. Create docker-compose.yml
services:
web:
build: .
image: ghcr.io/dine-together/myapp:latest
ports:
- "3000:3000"
environment:
- NODE_ENV=production
networks:
- default
- ingress
networks:
default:
ingress:
external: true
name: infrastructure-ingress
2. Add GitHub Workflow
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
uses: dine-together/k8s-infrastructure/.github/workflows/deploy.yml@main
with:
repository: ${{ github.repository }}
environment: staging
secrets:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
3. Push and Deploy
Deployment Checklist
- [ ] Docker Compose file created
- [ ] Image uses GHCR registry
- [ ] Correct port mapping
- [ ] Ingress network included
- [ ] GitHub workflow added
- [ ] DEPLOY_TOKEN secret set
- [ ] Environment variables configured
Common Patterns
Static Frontend
services:
frontend:
image: ghcr.io/dine-together/frontend:latest
ports: ["3000:3000"]
networks: [default, ingress]
API with Database
services:
api:
image: ghcr.io/dine-together/api:latest
ports: ["8000:8000"]
environment:
- DATABASE_URL=postgresql://postgres@db/myapp
depends_on: [db]
networks: [default, ingress]
db:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/data
networks: [default]
volumes:
postgres_data:
Background Workers
services:
worker:
image: ghcr.io/dine-together/worker:latest
command: celery worker
networks: [default]
# No ingress - internal only
Documentation Site
services:
docs:
image: ghcr.io/dine-together/infrastructure-docs:latest
ports: ["8000:8000"]
networks: [default, ingress]
labels:
# Password protection
- "traefik.http.middlewares.docs-auth.basicauth.users=${DOCS_AUTH_USERS}"
Troubleshooting Deployments
Build Failures
- Check Dockerfile syntax
- Verify base image exists
- Review build logs in GitHub Actions
Deploy Failures
- Verify DEPLOY_TOKEN permissions
- Check docker-compose.yml syntax
- Ensure image was built successfully
Runtime Failures
- Use
kubectl logsto check errors - Verify environment variables
- Check service connectivity
Advanced Topics
Next Steps
- Start with Docker Compose Configuration
- Set up Secrets for your app
- Configure Multiple Environments