lily_website

🐳 Docker Architecture

docs/en_EN/infrastructure/devops/ Β· README β†’ Docker


Containers

The project uses modular Docker containers generated by the installer based on your module selection.

Possible Services

Service Image Port Condition
backend Custom (FastAPI) 8000 If FastAPI selected
bot Custom (aiogram) β€” If Bot selected
worker Custom (ARQ) β€” If Bot selected
redis redis:7-alpine 6379 If Bot selected
postgres postgres:16-alpine 5432 If FastAPI selected
nginx nginx:alpine / Custom 80, 443 If any backend

Example: FastAPI + Bot (full stack)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    nginx                     β”‚
β”‚              :80 / :443 (SSL)                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚ proxy_pass
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      backend (FastAPI)    β”‚  β”‚  bot (aiogramβ”‚
β”‚          :8000            β”‚  β”‚    polling)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
            β”‚                          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚   postgres    β”‚              β”‚    redis    β”‚
β”‚    :5432      β”‚              β”‚   :6379     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                               β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                               β”‚   worker    β”‚
                               β”‚   (ARQ)     β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Files

deploy/
β”œβ”€β”€ fastapi/
β”‚   └── Dockerfile         # Multi-stage: builder β†’ runtime
β”œβ”€β”€ bot/
β”‚   └── Dockerfile         # Multi-stage: builder β†’ runtime
β”œβ”€β”€ worker/
β”‚   └── Dockerfile         # Same as bot, different CMD
β”œβ”€β”€ nginx/
β”‚   β”œβ”€β”€ Dockerfile         # Production nginx with configs
β”‚   β”œβ”€β”€ nginx-main.conf    # Main config (upstream, gzip, rate limiting)
β”‚   β”œβ”€β”€ site.conf          # Production (SSL, certbot, security headers)
β”‚   └── site-local.conf    # Development (port 80, no SSL)
β”œβ”€β”€ docker-compose.yml     # Development
└── docker-compose.prod.yml # Production (images from GHCR)

Usage

Development

cd deploy
docker compose up -d
docker compose logs -f

Production

Production deployment is automated via CD Release workflow. Images are built and pushed to GitHub Container Registry (GHCR).

Environment Variables

All services read from .env file. See github-secrets.md for variable reference.