Skip to content

Docker Compose Profiles

This document describes the Docker Compose profiles available for the DSTA project. Profiles allow you to selectively start services based on your needs.

Available Profiles

1. Minimal Profile

Purpose: Bare minimum services for API-only development.

Services Included: - postgres - PostgreSQL database - redis - Redis cache - api-server - Django API server

Usage:

docker-compose --profile minimal up

Use Cases: - Quick API testing - Database migrations - Minimal resource usage - CI/CD pipelines

2. Development Profile (dev)

Purpose: Full development environment with debugging tools.

Services Included: - All services from minimal profile - bot-listener - Telegram bot listener - bot-notifier - Telegram bot notifier - dsta-sync-login-debug - Login refresher with debugging support

Usage:

docker-compose --profile dev up
# or (dev is the default)
PROFILE=dev docker-compose up

Use Cases: - Active development - Bot testing - Debugging with IDE integration - Local testing of full system

3. Full Profile

Purpose: Complete production-like environment with all services.

Services Included: - All services from minimal profile - bot-listener - Telegram bot listener - bot-notifier - Telegram bot notifier - dsta-sync-login - Login refresher (production mode) - dsta-sync-schedule - Snapshot worker - dsta-manage-acc - Account management (one-time) - dsta-manage-url - URL management (one-time)

Usage:

docker-compose --profile full up
# or
PROFILE=full docker-compose up

Use Cases: - Production deployment - Staging environment - Full system testing - Performance testing

4. Testing Profile

Purpose: Minimal services for running automated tests.

Services Included: - postgres - PostgreSQL database (test database) - redis - Redis cache - api-server - Django API server

Usage:

docker-compose --profile testing up -d
docker-compose exec api-server pytest

Use Cases: - Automated testing - CI/CD test execution - Integration testing - Quick test runs

Profile Comparison

Service Minimal Dev Full Testing
postgres
redis
api-server
bot-listener
bot-notifier
dsta-sync-login
dsta-sync-login-debug
dsta-sync-schedule
dsta-manage-acc
dsta-manage-url

Common Commands

Start a specific profile:

docker-compose --profile minimal up
docker-compose --profile dev up
docker-compose --profile full up
docker-compose --profile testing up

Start with detached mode:

docker-compose --profile dev up -d

Stop all services:

docker-compose down

View logs for a specific service:

docker-compose logs -f api-server

Rebuild images:

docker-compose --profile dev build

Start specific services only:

docker-compose up postgres redis  # No profile needed for core services

Environment Variables

Profiles can be combined with environment variables:

# Use development profile with custom API port
API_SERVER_PORT=8080 docker-compose --profile dev up

# Use full profile with production environment
PROFILE=prod docker-compose --profile full up

Best Practices

  1. Development: Use dev profile for daily development work
  2. Quick Tests: Use minimal profile for quick API tests
  3. CI/CD: Use testing profile in automated pipelines
  4. Staging/Production: Use full profile for deployment
  5. Resource Management: Use minimal profiles when running on constrained systems

Troubleshooting

Services not starting?

Check that you're using the correct profile:

docker-compose --profile dev ps

Need multiple profiles?

Docker Compose supports multiple profiles:

docker-compose --profile dev --profile testing up

Reset everything:

docker-compose down -v  # Removes volumes too
docker-compose --profile full up --build

Custom Profiles

You can create custom profiles by modifying docker-compose.yaml:

services:
  my-custom-service:
    profiles: ["custom"]
    # ... service configuration

Then use:

docker-compose --profile custom up


Last Updated: 2025-11-24