Fix
This commit is contained in:
8
deploy/portainer/Caddyfile.example
Normal file
8
deploy/portainer/Caddyfile.example
Normal file
@@ -0,0 +1,8 @@
|
||||
comunidadhll.devzamode.es {
|
||||
encode zstd gzip
|
||||
|
||||
reverse_proxy /health hll-vietnam-backend-1:8000
|
||||
reverse_proxy /api/* hll-vietnam-backend-1:8000
|
||||
|
||||
reverse_proxy hll-vietnam-frontend-1:8080
|
||||
}
|
||||
128
deploy/portainer/docker-compose.nas.yml
Normal file
128
deploy/portainer/docker-compose.nas.yml
Normal file
@@ -0,0 +1,128 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-hll_vietnam}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-hll_vietnam}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
networks:
|
||||
- hll-internal
|
||||
restart: unless-stopped
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ../../backend
|
||||
environment:
|
||||
HLL_BACKEND_DATABASE_URL: ${HLL_BACKEND_DATABASE_URL:?HLL_BACKEND_DATABASE_URL is required}
|
||||
HLL_BACKEND_HOST: ${HLL_BACKEND_HOST:-0.0.0.0}
|
||||
HLL_BACKEND_PORT: ${HLL_BACKEND_PORT:-8000}
|
||||
HLL_BACKEND_ALLOWED_ORIGINS: ${HLL_BACKEND_ALLOWED_ORIGINS:-https://comunidadhll.devzamode.es}
|
||||
HLL_BACKEND_LIVE_DATA_SOURCE: ${HLL_BACKEND_LIVE_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_HISTORICAL_DATA_SOURCE: ${HLL_BACKEND_HISTORICAL_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_RCON_TIMEOUT_SECONDS: ${HLL_BACKEND_RCON_TIMEOUT_SECONDS:-20}
|
||||
HLL_BACKEND_RCON_TARGETS: ${HLL_BACKEND_RCON_TARGETS:?HLL_BACKEND_RCON_TARGETS is required}
|
||||
expose:
|
||||
- "8000"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- backend-data:/app/data
|
||||
networks:
|
||||
- hll-internal
|
||||
- caddy
|
||||
restart: unless-stopped
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../../frontend
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
python - <<'PY'
|
||||
from pathlib import Path
|
||||
for path in Path('/srv/frontend').glob('*.html'):
|
||||
text = path.read_text(encoding='utf-8')
|
||||
text = text.replace('data-backend-base-url="http://127.0.0.1:8000"', 'data-backend-base-url=""')
|
||||
path.write_text(text, encoding='utf-8')
|
||||
PY
|
||||
python -m http.server 8080 --bind 0.0.0.0 --directory /srv/frontend
|
||||
expose:
|
||||
- "8080"
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- caddy
|
||||
restart: unless-stopped
|
||||
|
||||
historical-runner:
|
||||
profiles:
|
||||
- advanced
|
||||
build:
|
||||
context: ../../backend
|
||||
command: ["python", "-m", "app.historical_runner", "--hourly"]
|
||||
environment:
|
||||
HLL_BACKEND_DATABASE_URL: ${HLL_BACKEND_DATABASE_URL:?HLL_BACKEND_DATABASE_URL is required}
|
||||
HLL_BACKEND_LIVE_DATA_SOURCE: ${HLL_BACKEND_LIVE_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_HISTORICAL_DATA_SOURCE: ${HLL_BACKEND_HISTORICAL_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_RCON_TIMEOUT_SECONDS: ${HLL_BACKEND_RCON_TIMEOUT_SECONDS:-20}
|
||||
HLL_BACKEND_RCON_TARGETS: ${HLL_BACKEND_RCON_TARGETS:?HLL_BACKEND_RCON_TARGETS is required}
|
||||
HLL_HISTORICAL_REFRESH_INTERVAL_SECONDS: ${HLL_HISTORICAL_REFRESH_INTERVAL_SECONDS:-3600}
|
||||
HLL_HISTORICAL_REFRESH_MAX_RETRIES: ${HLL_HISTORICAL_REFRESH_MAX_RETRIES:-2}
|
||||
HLL_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS: ${HLL_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS:-15}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
backend:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- backend-data:/app/data
|
||||
networks:
|
||||
- hll-internal
|
||||
restart: unless-stopped
|
||||
|
||||
rcon-historical-worker:
|
||||
profiles:
|
||||
- advanced
|
||||
build:
|
||||
context: ../../backend
|
||||
command: ["python", "-m", "app.rcon_historical_worker", "loop"]
|
||||
environment:
|
||||
HLL_BACKEND_DATABASE_URL: ${HLL_BACKEND_DATABASE_URL:?HLL_BACKEND_DATABASE_URL is required}
|
||||
HLL_BACKEND_LIVE_DATA_SOURCE: ${HLL_BACKEND_LIVE_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_HISTORICAL_DATA_SOURCE: ${HLL_BACKEND_HISTORICAL_DATA_SOURCE:-rcon}
|
||||
HLL_BACKEND_RCON_TIMEOUT_SECONDS: ${HLL_BACKEND_RCON_TIMEOUT_SECONDS:-20}
|
||||
HLL_BACKEND_RCON_TARGETS: ${HLL_BACKEND_RCON_TARGETS:?HLL_BACKEND_RCON_TARGETS is required}
|
||||
HLL_RCON_HISTORICAL_CAPTURE_INTERVAL_SECONDS: ${HLL_RCON_HISTORICAL_CAPTURE_INTERVAL_SECONDS:-600}
|
||||
HLL_RCON_HISTORICAL_CAPTURE_MAX_RETRIES: ${HLL_RCON_HISTORICAL_CAPTURE_MAX_RETRIES:-2}
|
||||
HLL_RCON_HISTORICAL_CAPTURE_RETRY_DELAY_SECONDS: ${HLL_RCON_HISTORICAL_CAPTURE_RETRY_DELAY_SECONDS:-15}
|
||||
HLL_BACKEND_RCON_ADMIN_LOG_LOOKBACK_MINUTES: ${HLL_BACKEND_RCON_ADMIN_LOG_LOOKBACK_MINUTES:-10}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
backend:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- backend-data:/app/data
|
||||
networks:
|
||||
- hll-internal
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
backend-data:
|
||||
|
||||
networks:
|
||||
hll-internal:
|
||||
driver: bridge
|
||||
caddy:
|
||||
external: true
|
||||
name: ${CADDY_NETWORK:-stack-caddy}
|
||||
29
deploy/portainer/stack.env.example
Normal file
29
deploy/portainer/stack.env.example
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copy these values into Portainer Stack environment variables.
|
||||
# Do not commit real production secrets.
|
||||
|
||||
POSTGRES_DB=hll_vietnam
|
||||
POSTGRES_USER=hll_vietnam
|
||||
POSTGRES_PASSWORD=replace-with-strong-postgres-password
|
||||
|
||||
HLL_BACKEND_DATABASE_URL=postgresql://hll_vietnam:replace-with-strong-postgres-password@postgres:5432/hll_vietnam
|
||||
HLL_BACKEND_HOST=0.0.0.0
|
||||
HLL_BACKEND_PORT=8000
|
||||
HLL_BACKEND_ALLOWED_ORIGINS=https://comunidadhll.devzamode.es
|
||||
HLL_BACKEND_LIVE_DATA_SOURCE=rcon
|
||||
HLL_BACKEND_HISTORICAL_DATA_SOURCE=rcon
|
||||
HLL_BACKEND_RCON_TIMEOUT_SECONDS=20
|
||||
HLL_BACKEND_RCON_TARGETS=[{"name":"Comunidad Hispana #01","slug":"comunidad-hispana-01","external_server_id":"comunidad-hispana-01","host":"replace-me-01.example","port":7779,"password":"replace-me-01","source_name":"community-hispana-rcon","region":"ES","game_port":null,"query_port":null},{"name":"Comunidad Hispana #02","slug":"comunidad-hispana-02","external_server_id":"comunidad-hispana-02","host":"replace-me-02.example","port":7879,"password":"replace-me-02","source_name":"community-hispana-rcon","region":"ES","game_port":null,"query_port":null}]
|
||||
|
||||
CADDY_NETWORK=stack-caddy
|
||||
|
||||
# Advanced profile only. Leave disabled unless you intentionally start the profile.
|
||||
HLL_HISTORICAL_REFRESH_INTERVAL_SECONDS=3600
|
||||
HLL_HISTORICAL_REFRESH_MAX_RETRIES=2
|
||||
HLL_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS=15
|
||||
HLL_RCON_HISTORICAL_CAPTURE_INTERVAL_SECONDS=600
|
||||
HLL_RCON_HISTORICAL_CAPTURE_MAX_RETRIES=2
|
||||
HLL_RCON_HISTORICAL_CAPTURE_RETRY_DELAY_SECONDS=15
|
||||
HLL_BACKEND_RCON_ADMIN_LOG_LOOKBACK_MINUTES=10
|
||||
HLL_RCON_BACKFILL_CHUNK_HOURS=6
|
||||
HLL_RCON_BACKFILL_SLEEP_SECONDS=1
|
||||
HLL_RCON_BACKFILL_MAX_DAYS_BACK=45
|
||||
Reference in New Issue
Block a user