Add Go rewrite with Postgres 17 and Dokploy Docker Compose
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
# Amnezia VPN Share Panel (Go) — Dokploy / Docker Compose
|
||||
# App listens on host port 30000. Postgres 17 is internal-only.
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: amnezia-share-go:latest
|
||||
container_name: amnezia-share-app
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "30000:30000"
|
||||
environment:
|
||||
APP_PORT: "30000"
|
||||
APP_BASE_URL: ${APP_BASE_URL:-}
|
||||
APP_HTTP_BUDGET_SEC: ${APP_HTTP_BUDGET_SEC:-52}
|
||||
APP_SESSION_SECRET: ${APP_SESSION_SECRET:?set APP_SESSION_SECRET}
|
||||
DATABASE_URL: postgres://${POSTGRES_USER:-vpn_admin}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-vpn_admin}?sslmode=disable
|
||||
TZ: ${TZ:-UTC}
|
||||
AMNEZIA_PANEL_URL: ${AMNEZIA_PANEL_URL:-}
|
||||
AMNEZIA_API_TOKEN: ${AMNEZIA_API_TOKEN:-}
|
||||
AMNEZIA_SERVER_LABELS_JSON: ${AMNEZIA_SERVER_LABELS_JSON:-}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:30000/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 25s
|
||||
networks:
|
||||
- amnezia
|
||||
# Dokploy: keep logs bounded
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
cleanup:
|
||||
image: amnezia-share-go:latest
|
||||
container_name: amnezia-share-cleanup
|
||||
restart: unless-stopped
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
while true; do
|
||||
/app/cleanup || true
|
||||
sleep 300
|
||||
done
|
||||
environment:
|
||||
DATABASE_URL: postgres://${POSTGRES_USER:-vpn_admin}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-vpn_admin}?sslmode=disable
|
||||
APP_HTTP_BUDGET_SEC: ${APP_HTTP_BUDGET_SEC:-52}
|
||||
AMNEZIA_PANEL_URL: ${AMNEZIA_PANEL_URL:-}
|
||||
AMNEZIA_API_TOKEN: ${AMNEZIA_API_TOKEN:-}
|
||||
TZ: ${TZ:-UTC}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
app:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
disable: true
|
||||
networks:
|
||||
- amnezia
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "5m"
|
||||
max-file: "2"
|
||||
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
container_name: amnezia-share-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-vpn_admin}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-vpn_admin}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
|
||||
TZ: ${TZ:-UTC}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
# Do NOT publish 5432 publicly in Dokploy — app reaches db via internal network.
|
||||
# Uncomment only for local debugging:
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 15s
|
||||
networks:
|
||||
- amnezia
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
name: amnezia-share-pg17
|
||||
|
||||
networks:
|
||||
amnezia:
|
||||
name: amnezia-share-net
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user