Files
hamkadr/docker-compose.yml
T
soroush.asadi d05b329c7a
CI/CD / CI · dotnet build (push) Successful in 1m22s
CI/CD / Deploy · hamkadr (push) Successful in 8s
Align deploy with central nginx: host-published 2569 + paste-in vhost (manual certs)
- Central nginx is containerized and proxies via host IP (171.22.25.73:port), not localhost → publish app on host :2569 (was 127.0.0.1)
- nginx vhost rewritten to match the monolithic config style (server blocks to paste into http{}, manual /etc/ssl/hamkadr certs, proxy_pass 171.22.25.73:2569, $connection_upgrade)
- DEPLOY.md: corrected architecture/ports, removed certbot+sites-available (use manual certs + single nginx.conf)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 05:09:39 +03:30

52 lines
2.2 KiB
YAML

# Production compose for hamkadr.ir — the Gitea deploy job uses THIS file directly
# (docker compose build api / up -d --no-deps api). Local dev DB → docker-compose.dev.yml.
# nginx (host) terminates TLS for hamkadr.ir and reverse-proxies to 127.0.0.1:${HOST_PORT}.
name: hamkadr # locked so redeploys reuse the same named volume (no orphaned data)
services:
# ── .NET 10 Razor Pages app ──────────────────────────────────────────────────
api:
image: mirror.soroushasadi.com/hamkadr/api:${API_TAG:-latest}
build:
context: .
dockerfile: Dockerfile
container_name: hamkadr_api
restart: unless-stopped
depends_on:
db:
condition: service_healthy
ports:
# Published on the host so the (containerized) central nginx can reach it at
# http://171.22.25.73:${HOST_PORT} — same pattern as the other soroush apps.
- "${HOST_PORT:-2569}:8080"
environment:
ASPNETCORE_ENVIRONMENT: "Production"
ASPNETCORE_URLS: "http://+:8080"
ConnectionStrings__Default: "Host=db;Port=5432;Database=${POSTGRES_DB:-hamkadr};Username=${POSTGRES_USER:-hamkadr};Password=${POSTGRES_PASSWORD}"
Auth__AdminPhone: "${ADMIN_PHONE:-}"
# Ingestion + AI + channel sources are configured at runtime in /Admin/Settings (DB), not here.
# healthcheck is defined in the Dockerfile (bash /dev/tcp probe) so the deploy
# job's `docker inspect Health.Status` wait works.
# ── PostgreSQL (internal only — never published) ─────────────────────────────
db:
image: mirror.soroushasadi.com/postgres:16-alpine
container_name: hamkadr_db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-hamkadr}
POSTGRES_USER: ${POSTGRES_USER:-hamkadr}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- hamkadr_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-hamkadr} -d ${POSTGRES_DB:-hamkadr}"]
interval: 5s
timeout: 5s
retries: 20
volumes:
hamkadr_db_data:
name: hamkadr_db_data