Skip to main content

Dockerized Deployment Architecture with Traefik Proxy

The deployment architecture for this template is centered around a containerized setup managed by Docker Compose, with Traefik serving as the primary entry point and reverse proxy.

Key Components:

  • Traefik Proxy: Acts as the gateway for all incoming traffic. It handles SSL termination via Let's Encrypt and routes requests to the appropriate services based on subdomains (e.g., api., dashboard., adminer.).
  • Frontend: A React application built with Vite and served by an Nginx container. It communicates with the backend via the public API URL.
  • Backend: A FastAPI application running with multiple workers. It handles the core business logic, authentication, and database interactions.
  • PostgreSQL: The primary relational database for the system, persisted via a Docker volume.
  • Adminer: A lightweight database management tool providing a web interface for the PostgreSQL database.
  • Prestart: A one-off container that runs database migrations (using app.alembic.env) and initialization scripts before the backend service starts.

Infrastructure & Connectivity:

  • Docker Networks: Services are connected via a traefik-public network for external access and a default network for internal communication.
  • External Services: The backend is configured to integrate with Sentry for error tracking and an SMTP server for sending emails (e.g., password resets).
  • CI/CD: Deployment is automated via GitHub Actions using self-hosted runners on the target server, supporting both staging and production environments.

Key Architectural Findings:

  • Traefik is used as the reverse proxy and SSL terminator, routing traffic to subdomains.
  • The frontend is a static React app served by Nginx.
  • The backend is a FastAPI service running with 4 workers.
  • A 'prestart' service handles database migrations before the backend starts.
  • PostgreSQL is the primary database, with Adminer provided for management.
  • The setup supports multi-environment deployments (staging/production) on a single server.
Loading diagram...