AI-Generated Content Warning: This documentation contains AI-generated content. Verify information before depending on it for decision making.
This guide covers various deployment options for GraphDone, from local development to production environments.
./tools/run.sh./tools/run.sh --docker-dev./tools/run.sh --docker# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/graphdone
REDIS_URL=redis://localhost:6379
# Server
NODE_ENV=production
PORT=4000
CORS_ORIGIN=https://yourdomain.com
# Authentication (when implemented)
JWT_SECRET=your-secure-secret
AUTH0_DOMAIN=your-domain.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret# API endpoints
VITE_GRAPHQL_URL=https://api.yourdomain.com/graphql
VITE_GRAPHQL_WS_URL=wss://api.yourdomain.com/graphql
# App configuration
VITE_APP_NAME=GraphDone
VITE_APP_VERSION=1.0.0
# Feature flags
VITE_ENABLE_SUBSCRIPTIONS=true
VITE_ENABLE_3D_VIEW=true-
Build and start services:
docker-compose up -d
-
Scale services:
docker-compose up -d --scale server=3
-
View logs:
docker-compose logs -f server
Create docker-compose.override.yml:
version: '3.8'
services:
server:
environment:
- DATABASE_URL=postgresql://user:pass@your-db:5432/graphdone
deploy:
replicas: 3
resources:
limits:
memory: 512M
reservations:
memory: 256M
web:
environment:
- VITE_GRAPHQL_URL=https://your-api.com/graphql- Kubernetes cluster (1.20+)
- kubectl configured
- Ingress controller
- Cert-manager (for TLS)
# Apply manifests
kubectl apply -f k8s/
# Check status
kubectl get pods -l app=graphdone
# Get external IP
kubectl get ingress graphdone-ingress-
Create secrets:
kubectl create secret generic graphdone-secrets \ --from-literal=database-url="postgresql://..." \ --from-literal=jwt-secret="your-secret"
-
Configure ingress:
# k8s/ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: graphdone-ingress annotations: cert-manager.io/cluster-issuer: letsencrypt-prod spec: tls: - hosts: - graphdone.yourdomain.com secretName: graphdone-tls rules: - host: graphdone.yourdomain.com http: paths: - path: / pathType: Prefix backend: service: name: graphdone-web port: number: 80 - path: /graphql pathType: Prefix backend: service: name: graphdone-server port: number: 4000
-
Create task definition:
{ "family": "graphdone", "networkMode": "awsvpc", "cpu": "512", "memory": "1024", "containerDefinitions": [ { "name": "graphdone-server", "image": "your-registry/graphdone-server:latest", "portMappings": [ { "containerPort": 4000, "protocol": "tcp" } ], "environment": [ { "name": "NODE_ENV", "value": "production" } ], "secrets": [ { "name": "DATABASE_URL", "valueFrom": "arn:aws:secretsmanager:region:account:secret:graphdone/database" } ] } ] } -
Create service:
aws ecs create-service \ --cluster graphdone-cluster \ --service-name graphdone-service \ --task-definition graphdone \ --desired-count 2
-
Deploy server:
gcloud run deploy graphdone-server \ --image gcr.io/your-project/graphdone-server \ --platform managed \ --region us-central1 \ --allow-unauthenticated \ --set-env-vars NODE_ENV=production
-
Deploy web app:
gcloud run deploy graphdone-web \ --image gcr.io/your-project/graphdone-web \ --platform managed \ --region us-central1 \ --allow-unauthenticated
# Create resource group
az group create --name graphdone-rg --location eastus
# Deploy container group
az container create \
--resource-group graphdone-rg \
--file azure-container-group.yaml- AWS RDS: Recommended for production
- Google Cloud SQL: Good performance and reliability
- Azure Database: Integrated with Azure services
- DigitalOcean Managed Database: Cost-effective option
# Using Docker
docker run -d \
--name graphdone-postgres \
-e POSTGRES_DB=graphdone \
-e POSTGRES_USER=graphdone \
-e POSTGRES_PASSWORD=secure_password \
-v postgres_data:/var/lib/postgresql/data \
-p 5432:5432 \
postgres:15-alpineFor caching and session management:
# Using Docker
docker run -d \
--name graphdone-redis \
-v redis_data:/data \
-p 6379:6379 \
redis:7-alpine# Install certbot
sudo apt install certbot python3-certbot-nginx
# Get certificate
sudo certbot --nginx -d yourdomain.com
# Auto-renewal
sudo systemctl enable certbot.timerAdd to nginx configuration:
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/private.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512;
}The server provides health check endpoints:
GET /health- Basic health statusGET /health/ready- Readiness probeGET /health/live- Liveness probe
Configure Prometheus metrics:
# prometheus.yml
scrape_configs:
- job_name: 'graphdone'
static_configs:
- targets: ['graphdone-server:4000']
metrics_path: /metricsConfigure structured logging:
{
"level": "info",
"timestamp": "2024-01-01T00:00:00.000Z",
"service": "graphdone-server",
"message": "Server started",
"port": 4000
}- Enable Redis for session and query caching
- Configure CDN for static assets
- Implement GraphQL query caching
- Create appropriate indexes
- Configure connection pooling
- Enable query optimization
- Horizontal scaling with load balancer
- Database read replicas
- CDN for global distribution
- Enable HTTPS everywhere
- Configure CORS properly
- Set up authentication
- Enable rate limiting
- Configure firewall rules
- Regular security updates
- Monitor for vulnerabilities
- Backup strategy implemented
# Disable unnecessary services
sudo systemctl disable apache2
sudo systemctl disable nginx-default
# Configure firewall
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable# Daily backup script
#!/bin/bash
pg_dump $DATABASE_URL | gzip > backup-$(date +%Y%m%d).sql.gz
# Upload to cloud storage
aws s3 cp backup-$(date +%Y%m%d).sql.gz s3://your-backup-bucket/- Maintain database backups (point-in-time recovery)
- Store application artifacts in registry
- Document recovery procedures
- Test recovery process regularly
# Find process using port
sudo lsof -i :4000
sudo kill -9 <PID># Test connection
psql $DATABASE_URL
\l # List databases
\q # Quit# View logs
docker-compose logs server
# Restart service
docker-compose restart server
# Rebuild images
docker-compose build --no-cacheFor deployment support: