Skip to content

Staging Environment Guide

Overview

The staging environment is a production-like environment for testing changes before deploying to production.

Configuration

Located in: deploy/docker-compose.staging.yml

Services

  • PostgreSQL: Port 5433
  • Redis: Port 6380
  • API Server: Port 8001
  • Celery Worker: Background tasks

Setup

  1. Create environment file:

    cp .env_files/staging.env.template .env_files/staging.env
    vim .env_files/staging.env  # Edit values
    

  2. Start staging environment:

    cd deploy
    docker-compose -f docker-compose.staging.yml up -d
    

  3. Run migrations:

    docker-compose -f docker-compose.staging.yml exec api-server python manage.py migrate
    

Deployment

Use the automated deployment script:

./scripts/deploy-staging.sh

This script will: - Pull latest code - Build new images - Run migrations - Restart services - Perform health checks

Testing

  • API: http://localhost:8001
  • Health: http://localhost:8001/health/
  • Metrics: http://localhost:8001/metrics

Differences from Production

  • Debug mode enabled
  • Relaxed security settings
  • Separate database and ports
  • No SSL/TLS required

Troubleshooting

Check logs:

docker-compose -f docker-compose.staging.yml logs -f api-server

Restart services:

docker-compose -f docker-compose.staging.yml restart

Version History

  • 1.0.0 (2025-01-27): Initial staging environment setup