Files
token_thief/compose.yml
T

70 lines
2.5 KiB
YAML

services:
tokenthief:
build:
context: .
dockerfile: Dockerfile
image: tokenthief:0.1.0
container_name: tokenthief
restart: unless-stopped
depends_on:
thief_clickhouse:
condition: service_healthy
ports:
- "${TOKENTHIEF_LISTEN_IP:-0.0.0.0}:${LISTEN_PORT:-8080}:8080"
environment:
LISTEN_ADDR: ":8080"
UPSTREAM_URL: "${UPSTREAM_URL:?set UPSTREAM_URL}"
UPSTREAM_TLS_INSECURE_SKIP_VERIFY: "${UPSTREAM_TLS_INSECURE_SKIP_VERIFY:-false}"
CLICKHOUSE_URL: "${CLICKHOUSE_URL:?set CLICKHOUSE_URL with URL-encoded credentials}"
MAX_BODY_BYTES: "${MAX_BODY_BYTES:-1048576}"
MAX_REQUEST_BYTES: "${MAX_REQUEST_BYTES:-16777216}"
LOG_QUEUE_SIZE: "${LOG_QUEUE_SIZE:-256}"
LOG_QUEUE_BYTES: "${LOG_QUEUE_BYTES:-67108864}"
LOG_BATCH_SIZE: "${LOG_BATCH_SIZE:-50}"
LOG_BATCH_INTERVAL: "${LOG_BATCH_INTERVAL:-2s}"
LOG_WORKERS: "${LOG_WORKERS:-2}"
FILTER_FILE: "/etc/tokenthief/filter.yaml"
DB_RECONNECT_INTERVAL: "${DB_RECONNECT_INTERVAL:-10s}"
READ_TIMEOUT: "${READ_TIMEOUT:-30s}"
WRITE_TIMEOUT: "${WRITE_TIMEOUT:-10m}"
IDLE_TIMEOUT: "${IDLE_TIMEOUT:-5m}"
UPSTREAM_TIMEOUT: "${UPSTREAM_TIMEOUT:-30s}"
UPSTREAM_RESPONSE_TIMEOUT: "${UPSTREAM_RESPONSE_TIMEOUT:-30s}"
UPSTREAM_STREAM_IDLE_TIMEOUT: "${UPSTREAM_STREAM_IDLE_TIMEOUT:-2m}"
TRUSTED_PROXIES: "${TRUSTED_PROXIES:-}"
TZ: "${TZ:-Asia/Shanghai}"
volumes:
- ./filter.yaml:/etc/tokenthief/filter.yaml:ro
networks:
- tokenthief
thief_clickhouse:
image: clickhouse/clickhouse-server:26.3
container_name: tokenthief-clickhouse
restart: unless-stopped
ports:
- "${CLICKHOUSE_LISTEN_IP:-127.0.0.1}:${CLICKHOUSE_HTTP_PORT:-8123}:8123"
- "${CLICKHOUSE_LISTEN_IP:-127.0.0.1}:${CLICKHOUSE_NATIVE_PORT:-9000}:9000"
environment:
CLICKHOUSE_USER: "${CLICKHOUSE_USER:-tokenthief}"
CLICKHOUSE_PASSWORD: "${CLICKHOUSE_PASSWORD:?set a strong CLICKHOUSE_PASSWORD}"
CLICKHOUSE_DB: "${CLICKHOUSE_DB:-tokenthief}"
TZ: "${TZ:-Asia/Shanghai}"
volumes:
- clickhouse_data:/var/lib/clickhouse
healthcheck:
test: ["CMD-SHELL", "clickhouse-client --user \"$${CLICKHOUSE_USER}\" --password \"$${CLICKHOUSE_PASSWORD}\" --database \"$${CLICKHOUSE_DB}\" --query 'SELECT 1'"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- tokenthief
volumes:
clickhouse_data:
networks:
tokenthief:
driver: bridge