This guide walks you through the initial setup of Auto Code's cloud-hosted infrastructure. Follow these steps to deploy your first cloud instance.
Auto Code's cloud infrastructure consists of:
┌─────────────────────────────────────────────────────────────┐
│ Cloud Infrastructure │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ │ │ │ │ │ │
│ │ Web Backend │◄─┤ PostgreSQL │ │ Redis │ │
│ │ (FastAPI) │ │ Database │ │ (Cache) │ │
│ │ │ │ │ │ │ │
│ └──────┬───────┘ └──────────────┘ └──────────────┘ │
│ │ │
│ ├─────► GitHub OAuth │
│ ├─────► GitLab OAuth │
│ └─────► User Git Repositories │
│ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌──────────────┐
│ Web Frontend │
│ (React SPA) │
└──────────────┘
Key Components:
- Web Backend: FastAPI server handling API requests, authentication, and agent orchestration
- PostgreSQL: User accounts, repository links, and metadata storage
- Redis: Usage tracking, rate limiting, and session caching
- Web Frontend: React-based UI for cloud users
-
Cloud Platform Account (choose one):
- AWS (recommended for production)
- Google Cloud Platform
- Azure
- DigitalOcean (easiest for getting started)
-
Git Provider Accounts:
- GitHub account (for OAuth integration)
- GitLab account (optional, for GitLab OAuth)
-
Domain Name (optional but recommended):
- For production deployments with SSL/TLS
- Required for OAuth callback URLs
Install the following CLI tools:
# Docker and Docker Compose
docker --version # Should be 20.10+
docker-compose --version # Should be 1.29+
# kubectl (for Kubernetes deployments)
kubectl version --client # Should be 1.27+
# Cloud provider CLI (choose one)
aws --version # AWS CLI
gcloud --version # Google Cloud CLI
az --version # Azure CLI
doctl version # DigitalOcean CLI
# Git
git --version
# OpenSSL (for generating secrets)
openssl versionMinimum (Development/Testing):
- 2 vCPUs
- 4GB RAM
- 20GB storage
Recommended (Production):
- 4+ vCPUs
- 8GB+ RAM
- 50GB+ storage
- Load balancer
- Managed database service
For testing or development, use Docker Compose for a local cloud stack:
# 1. Clone repository
git clone https://github.com/OBenner/Auto-Coding.git
cd Auto-Claude
# 2. Navigate to web backend
cd apps/web-backend
# 3. Copy and configure environment
cp .env.example .env
# Edit .env with your settings (see below)
# 4. Generate secure secret key
export SECRET_KEY=$(openssl rand -hex 32)
echo "SECRET_KEY=$SECRET_KEY" >> .env
# 5. Start the cloud stack
docker-compose -f docker-compose.cloud.yml up -d
# 6. Run database migrations
docker-compose -f docker-compose.cloud.yml exec web-backend alembic upgrade head
# 7. Verify services are running
docker-compose -f docker-compose.cloud.yml psAccess the API at http://localhost:8000 and check health at http://localhost:8000/health.
Advantages: Easiest to set up, runs on any machine with Docker
# Ensure Docker is running
docker info
# Clone and navigate to project
git clone https://github.com/OBenner/Auto-Coding.git
cd Auto-Claude/apps/web-backendAdvantages: Scalable, highly available, production-ready
Choose a managed Kubernetes service:
AWS EKS:
# Create EKS cluster
eksctl create cluster \
--name autoclaude-cluster \
--region us-east-1 \
--nodegroup-name standard-workers \
--node-type t3.medium \
--nodes 3 \
--nodes-min 2 \
--nodes-max 5
# Configure kubectl
aws eks update-kubeconfig --region us-east-1 --name autoclaude-clusterGoogle GKE:
# Create GKE cluster
gcloud container clusters create autoclaude-cluster \
--zone us-central1-a \
--machine-type n1-standard-2 \
--num-nodes 3 \
--enable-autoscaling \
--min-nodes 2 \
--max-nodes 5
# Get credentials
gcloud container clusters get-credentials autoclaude-cluster --zone us-central1-aDigitalOcean Kubernetes:
# Create DOKS cluster via CLI
doctl kubernetes cluster create autoclaude-cluster \
--region nyc1 \
--version latest \
--size s-2vcpu-4gb \
--count 3
# Get kubeconfig
doctl kubernetes cluster kubeconfig save autoclaude-clusterVerify cluster access:
kubectl cluster-info
kubectl get nodesYou need to register OAuth applications with your Git providers to enable repository access.
-
Navigate to GitHub Developer Settings:
- Go to https://github.com/settings/developers
- Click "OAuth Apps" → "New OAuth App"
-
Fill in application details:
- Application name:
Auto Code Cloud - Homepage URL:
https://your-domain.com(orhttp://localhost:8000for testing) - Authorization callback URL:
https://your-domain.com/api/git/github/callback - Click "Register application"
- Application name:
-
Save credentials:
- Copy the Client ID
- Generate a new Client Secret and copy it
- Keep these secure - you'll need them for environment configuration
-
Navigate to GitLab Applications:
- Go to https://gitlab.com/-/profile/applications
- Click "Add new application"
-
Fill in application details:
- Name:
Auto Code Cloud - Redirect URI:
https://your-domain.com/api/git/gitlab/callback - Scopes: Select
api,read_user,read_repository,write_repository - Click "Save application"
- Name:
-
Save credentials:
- Copy the Application ID
- Copy the Secret
# Generate SECRET_KEY for JWT signing
openssl rand -hex 32
# Generate PostgreSQL password
openssl rand -base64 32
# Generate Redis password (optional but recommended)
openssl rand -base64 24Create apps/web-backend/.env from template:
cp apps/web-backend/.env.example apps/web-backend/.envEdit .env with your configuration:
# =============================================================================
# SERVER CONFIGURATION
# =============================================================================
HOST=0.0.0.0
PORT=8000
DEBUG=false # CRITICAL: Set to false in production
LOG_LEVEL=INFO
# =============================================================================
# CORS CONFIGURATION
# =============================================================================
# Replace with your frontend domain
CORS_ORIGINS=https://your-frontend-domain.com
# =============================================================================
# AUTHENTICATION & SECURITY
# =============================================================================
# CRITICAL: Replace with generated secret key
SECRET_KEY=<paste-generated-secret-key-here>
# JWT token expiration (in minutes)
ACCESS_TOKEN_EXPIRE_MINUTES=60
# =============================================================================
# DATABASE CONFIGURATION
# =============================================================================
# For Docker Compose deployment
DATABASE_URL=postgresql://postgres:<your-postgres-password>@postgres:5432/autoclaude
# For Kubernetes/managed database
# DATABASE_URL=postgresql://user:password@db-host:5432/autoclaude
# =============================================================================
# REDIS CONFIGURATION
# =============================================================================
# For Docker Compose deployment
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
# For Kubernetes/managed Redis
# REDIS_HOST=your-redis-host
# REDIS_PASSWORD=<your-redis-password>
# =============================================================================
# OAUTH CONFIGURATION
# =============================================================================
# GitHub OAuth (from Step 2)
GITHUB_CLIENT_ID=<your-github-client-id>
GITHUB_CLIENT_SECRET=<your-github-client-secret>
# GitLab OAuth (from Step 2, optional)
GITLAB_CLIENT_ID=<your-gitlab-client-id>
GITLAB_CLIENT_SECRET=<your-gitlab-client-secret>
# OAuth redirect URI (must match provider configuration)
OAUTH_REDIRECT_URI=https://your-domain.com/api/git/callback
# =============================================================================
# WEBSOCKET CONFIGURATION
# =============================================================================
WS_HEARTBEAT_INTERVAL=30Create infrastructure/k8s/secrets.yaml from template:
cp infrastructure/k8s/secrets.example.yaml infrastructure/k8s/secrets.yamlIMPORTANT: Never commit secrets.yaml to version control!
Edit secrets.yaml and base64-encode your secrets:
# Encode secrets to base64
echo -n 'your-secret-key' | base64
echo -n 'your-postgres-password' | base64
echo -n 'your-github-client-secret' | base64Paste the encoded values into secrets.yaml:
apiVersion: v1
kind: Secret
metadata:
name: autoclaude-secrets
type: Opaque
data:
SECRET_KEY: <base64-encoded-secret-key>
POSTGRES_PASSWORD: <base64-encoded-postgres-password>
GITHUB_CLIENT_SECRET: <base64-encoded-github-secret>
GITLAB_CLIENT_SECRET: <base64-encoded-gitlab-secret>cd apps/web-backend
# Start all services
docker-compose -f docker-compose.cloud.yml up -d
# Check service status
docker-compose -f docker-compose.cloud.yml ps
# View logs
docker-compose -f docker-compose.cloud.yml logs -f web-backend
# Expected output:
# autoclaude-postgres running 5432/tcp
# autoclaude-redis running 6379/tcp
# autoclaude-backend running 8000/tcp# Navigate to Kubernetes manifests
cd infrastructure/k8s
# Create namespace (optional)
kubectl create namespace autoclaude
kubectl config set-context --current --namespace=autoclaude
# Apply all manifests
kubectl apply -f secrets.yaml
kubectl apply -f configmap.yaml
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml
# Check deployment status
kubectl get pods
kubectl get services
kubectl get ingress
# Wait for pods to be ready
kubectl wait --for=condition=ready pod -l app=autoclaude --timeout=300s
# View logs
kubectl logs -l app=autoclaude,component=backend --followInitialize the PostgreSQL database with required tables and schema.
# Run migrations
docker-compose -f docker-compose.cloud.yml exec web-backend alembic upgrade head
# Verify migrations
docker-compose -f docker-compose.cloud.yml exec web-backend alembic current
# Expected output:
# INFO [alembic.runtime.migration] Running upgrade -> 001_create_users
# INFO [alembic.runtime.migration] Running upgrade 001 -> 002_create_repositories# Get the backend pod name
BACKEND_POD=$(kubectl get pods -l app=autoclaude,component=backend -o jsonpath='{.items[0].metadata.name}')
# Run migrations
kubectl exec -it $BACKEND_POD -- alembic upgrade head
# Verify migrations
kubectl exec -it $BACKEND_POD -- alembic currentConnect to PostgreSQL to verify tables:
# Docker Compose
docker-compose -f docker-compose.cloud.yml exec postgres psql -U postgres -d autoclaude
# Kubernetes
kubectl exec -it $(kubectl get pods -l component=database -o jsonpath='{.items[0].metadata.name}') -- psql -U postgres -d autoclaudeRun verification queries:
-- List all tables
\dt
-- Expected tables:
-- users
-- repositories
-- alembic_version
-- Verify users table structure
\d users
-- Exit
\qTest the API health endpoint:
# Docker Compose
curl http://localhost:8000/health
# Kubernetes (port-forward first)
kubectl port-forward svc/web-backend 8000:8000
curl http://localhost:8000/health
# Expected response:
# {"status": "healthy", "database": "connected", "redis": "connected"}Verify OAuth providers are configured:
curl http://localhost:8000/api/git/status
# Expected response:
# {
# "github": {"configured": true},
# "gitlab": {"configured": true}
# }Create a test user:
curl -X POST http://localhost:8000/api/users/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "TestPassword123!"
}'
# Expected response (201 Created):
# {
# "id": 1,
# "email": "test@example.com",
# "is_active": true,
# "created_at": "2024-02-04T12:00:00Z"
# }Authenticate the test user:
curl -X POST http://localhost:8000/api/users/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "TestPassword123!"
}'
# Expected response (200 OK):
# {
# "access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
# "token_type": "bearer",
# "user": {...}
# }Verify usage tracking is working:
# Make a few API calls, then check usage
curl http://localhost:8000/api/usage/stats
# Expected response:
# {
# "user_id": 1,
# "period": "hourly",
# "stats": [...],
# "redis_healthy": true
# }✅ Your cloud infrastructure is now set up!
-
Review Security Settings: See CLOUD_DEPLOYMENT.md for production security best practices
-
Set Up SSL/TLS: Configure HTTPS for production deployments
- Let's Encrypt with cert-manager (Kubernetes)
- CloudFlare or AWS Certificate Manager
-
Configure Monitoring: Set up logging and metrics
- Prometheus + Grafana (Kubernetes)
- CloudWatch (AWS)
- Cloud Logging (GCP)
-
Enable Backups: Configure automated database backups
-
Scale Your Deployment: Increase replicas and resources as needed
-
Test OAuth Flow: Connect a GitHub/GitLab account through the frontend
- Navigate to
/settings/gitin the web UI - Click "Connect GitHub" and authorize
- Navigate to
If you encounter issues, see:
- CLOUD_DEPLOYMENT.md - Troubleshooting
- Check logs:
docker-compose logs -forkubectl logs -f - Verify environment variables are set correctly
- Ensure OAuth callback URLs match your configuration
- Documentation: guides/README.md
- GitHub Issues: https://github.com/OBenner/Auto-Coding/issues
- Community Support: https://github.com/OBenner/Auto-Coding/discussions
Next: Read CLOUD_DEPLOYMENT.md for production deployment, scaling, and operations guidance.