Skip to main content

CODITECT Cloud Backend - Staging Quick Reference

Last Updated: December 1, 2025, 3:30 AM EST Status: โœ… 100% Functional


๐Ÿš€ Access Informationโ€‹

External IP: 136.114.0.156

API Endpoints:


๐Ÿ“Š Infrastructure Statusโ€‹

ComponentStatusDetails
GKE Podsโœ… 2/2 READYRunning v1.0.3-staging
Cloud SQLโœ… RUNNABLEPostgreSQL 16, 10.28.0.3
Redisโœ… READYMemorystore, 10.164.210.91
LoadBalancerโœ… ActiveExternal IP assigned
Health Probesโœ… PassingHTTP 200 responses
Databaseโœ… Connected25/25 migrations applied

๐Ÿ”‘ Key Configurationโ€‹

Docker Image:

us-central1-docker.pkg.dev/coditect-cloud-infra/coditect-backend/coditect-cloud-backend:v1.0.3-staging

Settings Module:

DJANGO_SETTINGS_MODULE=license_platform.settings.staging

Staging Settings File: license_platform/settings/staging.py

  • Disables SSL redirect (HTTP only)
  • Allows all hosts (wildcard ALLOWED_HOSTS)
  • No database SSL requirement
  • Debug logging enabled

๐Ÿงช Quick Smoke Testsโ€‹

# Health check (should return 200)
curl http://136.114.0.156/api/v1/health/

# Readiness check (should return 200 with database status)
curl http://136.114.0.156/api/v1/health/ready/

# Protected endpoint (should return 401)
curl http://136.114.0.156/api/v1/licenses/acquire/

Expected Results: All returning correct HTTP status codes โœ…


๐Ÿ“ฆ Kubernetes Resourcesโ€‹

Namespace: coditect-staging

Quick Commands:

# Check pod status
kubectl get pods -n coditect-staging -l app=coditect-backend

# View deployment
kubectl get deployment coditect-backend -n coditect-staging

# Check services
kubectl get svc -n coditect-staging

# View logs
kubectl logs -n coditect-staging -l app=coditect-backend --tail=50

# Describe pod for debugging
kubectl describe pod -n coditect-staging <pod-name>

๐Ÿ”„ Common Operationsโ€‹

Deploy New Versionโ€‹

# Build new image
docker buildx build --platform linux/amd64 \
-t us-central1-docker.pkg.dev/coditect-cloud-infra/coditect-backend/coditect-cloud-backend:v1.0.X-staging \
--push .

# Update deployment
kubectl set image deployment/coditect-backend \
backend=us-central1-docker.pkg.dev/coditect-cloud-infra/coditect-backend/coditect-cloud-backend:v1.0.X-staging \
-n coditect-staging

# Wait for rollout
kubectl rollout status deployment/coditect-backend -n coditect-staging

Run Database Migrationsโ€‹

# Apply pending migrations
kubectl apply -f deployment/kubernetes/staging/migrate-job.yaml

# Check migration job status
kubectl get jobs -n coditect-staging

# View migration logs
kubectl logs -n coditect-staging job/django-migrate

Restart Podsโ€‹

# Restart all pods (rolling restart)
kubectl rollout restart deployment/coditect-backend -n coditect-staging

๐Ÿ› Troubleshootingโ€‹

Pods Not Readyโ€‹

# Check pod events
kubectl describe pod -n coditect-staging <pod-name>

# View recent logs
kubectl logs -n coditect-staging <pod-name> --tail=100

# Check health probe failures
kubectl logs -n coditect-staging <pod-name> | grep health

Database Connection Issuesโ€‹

# Verify Cloud SQL instance
gcloud sql instances describe coditect-db

# Check secret exists
kubectl get secret backend-secrets -n coditect-staging

# Test database connection from pod
kubectl exec -n coditect-staging <pod-name> -- \
psql -h 10.28.0.3 -U coditect_app -d coditect -c "SELECT 1"

LoadBalancer Issuesโ€‹

# Check service status
kubectl get svc coditect-backend -n coditect-staging

# View service events
kubectl describe svc coditect-backend -n coditect-staging

# Test internal connectivity
kubectl run -n coditect-staging test-pod --rm -it --image=curlimages/curl -- \
curl http://coditect-backend-internal:8000/api/v1/health/

๐Ÿ” Secrets Managementโ€‹

Kubernetes Secrets: backend-secrets

Contains:

  • django-secret-key
  • db-name
  • db-user
  • db-password
  • db-host
  • redis-host

View secret (base64 encoded):

kubectl get secret backend-secrets -n coditect-staging -o yaml

๐Ÿ“ˆ Production Readiness Checklistโ€‹

Staging Complete: โœ…

Before Production:

  • Enable SSL on Cloud SQL
  • Enable Redis AUTH
  • Configure specific ALLOWED_HOSTS (no wildcards)
  • Setup GCP Secret Manager
  • Configure Cloud KMS for license signing
  • Enable HTTPS with valid certificates
  • Setup monitoring and alerting
  • Configure automated backups
  • Implement disaster recovery plan
  • Migrate to OpenTofu for IaC

  • deployment-night-summary.md - Complete deployment session log
  • staging-troubleshooting-guide.md - All 9 issues and solutions (33KB)
  • staging-deployment-guide.md - Step-by-step deployment (40KB)
  • infrastructure-pivot-summary.md - OpenTofu migration plan (12KB)
  • ADR-001 - Architecture decisions and production readiness gaps

๐ŸŽฏ Next Stepsโ€‹

  1. OpenTofu Migration (1-2 hours)

    • Import existing Cloud SQL and Redis instances
    • Create staging environment configuration
    • Validate infrastructure as code
  2. Production Planning (This week)

    • Design production architecture
    • Plan security hardening
    • Setup monitoring and alerting
  3. Production Deployment (Next week)

    • Deploy production environment
    • Configure HTTPS and SSL
    • Enable all production features

For Questions: See related documentation or CLAUDE.md for AI agent context