Files
hamkadr/docker-compose.yml
soroush.asadi cea27c8684
CI/CD / CI · dotnet build (push) Successful in 53s
CI/CD / Deploy · hamkadr (push) Successful in 1m12s
[Ingest] Route scraping through an optional V2Ray/Xray proxy (Telegram in Iran)
Telegram and some sources are filtered in Iran. .NET cannot speak vmess/vless/trojan, so add an Xray sidecar (compose service 'xray', behind the 'proxy' profile) that converts the admin's config into a local SOCKS5 proxy (xray:10808). New ScrapeHttpClients provider builds a proxied or direct HttpClient (WebProxy supports socks5/socks4/http) cached per proxy URL; all five ingestion sources (Telegram/Bale/Divar/Medjobs/Websites) now use it. Admin settings gain IngestProxyEnabled + IngestProxyUrl (migration; UI under sources). Added deploy/xray/config.json template + README with vmess/vless/trojan examples.

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

65 lines
2.9 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.
# ── Xray/V2Ray client — converts a vmess/vless/trojan config into a local SOCKS proxy ──
# so ingestion can reach Telegram etc. from inside Iran. Behind the "proxy" profile, so it
# only runs when you opt in: `docker compose --profile proxy up -d xray`. Put YOUR config at
# deploy/xray/config.json (see deploy/xray/README.md), then in /Admin/Settings set the
# ingestion proxy to socks5://xray:10808. Not published — only the app reaches it.
xray:
image: mirror.soroushasadi.com/teddysun/xray:latest
container_name: hamkadr_xray
restart: unless-stopped
profiles: ["proxy"]
volumes:
- ./deploy/xray/config.json:/etc/xray/config.json:ro
# ── 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