name: hainuo-relay services: postgres: image: postgres:17-alpine restart: unless-stopped environment: POSTGRES_DB: POSTGRES_USER: POSTGRES_PASSWORD: ${HN_POSTGRES_PASSWORD} volumes: - metadata:/var/lib/postgresql/data networks: - backend healthcheck: test: - CMD-SHELL - pg_isready -U hainuo -d hainuo interval: 10s timeout: 3s retries: 5 mem_limit: 512m security_opt: - no-new-privileges:true redis: image: redis:8.2-alpine restart: unless-stopped environment: REDIS_PASSWORD: ${HN_REDIS_PASSWORD} command: - sh - -c - exec redis-server --save '' --appendonly no --requirepass "$$REDIS_PASSWORD" --maxmemory 256mb --maxmemory-policy noeviction networks: - backend healthcheck: test: - CMD-SHELL - REDISCLI_AUTH="$$REDIS_PASSWORD" redis-cli ping | grep -q PONG interval: 10s timeout: 3s retries: 5 mem_limit: 384m security_opt: - no-new-privileges:true connector: image: hainuo-relay:0.1.0 build: . restart: unless-stopped command: - serve - connector - --host - 0.0.0.0 - --port - '8000' environment: HN_ENVIRONMENT: ${HN_ENVIRONMENT} HN_REDIS_URL: ${HN_REDIS_URL} HN_ADMIN_SECRET: ${HN_ADMIN_SECRET} HN_INTERNAL_SECRET: ${HN_INTERNAL_SECRET} HN_DATA_DIR: HN_DATABASE_URL: ${HN_DATABASE_URL} HN_CA_CERT: HN_CONNECTOR_KEY: HN_PUBLIC_URL: ${HN_PUBLIC_URL} HN_ROUTER_URL: ${HN_ROUTER_URL} HN_DEVICE_DOMAIN: ${HN_DEVICE_DOMAIN} HN_FEISHU_ENABLED: ${HN_FEISHU_ENABLED} HN_FEISHU_API_BASE: ${HN_FEISHU_API_BASE} HN_FEISHU_AUTHORIZE_URL: ${HN_FEISHU_AUTHORIZE_URL} HN_FEISHU_APP_ID: ${HN_FEISHU_APP_ID} HN_FEISHU_APP_SECRET: ${HN_FEISHU_APP_SECRET} HN_FEISHU_ENCRYPT_KEY: ${HN_FEISHU_ENCRYPT_KEY} HN_FEISHU_VERIFICATION_TOKEN: ${HN_FEISHU_VERIFICATION_TOKEN} HN_PROXY_ENABLED: ${HN_PROXY_ENABLED} volumes: - ./runtime/connector:/data - ./runtime/trust:/trust:ro ports: - 127.0.0.1:18081:8000 networks: - backend - edge depends_on: redis: condition: service_healthy postgres: condition: service_healthy healthcheck: test: - CMD - python - -c - import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/ready', timeout=3) interval: 15s timeout: 5s retries: 3 read_only: true tmpfs: - /tmp:size=16m,noexec,nosuid cap_drop: - ALL security_opt: - no-new-privileges:true mem_limit: 768m router: image: hainuo-relay:0.1.0 restart: unless-stopped command: - serve - router - --host - 0.0.0.0 - --port - '8000' environment: HN_ENVIRONMENT: ${HN_ENVIRONMENT} HN_REDIS_URL: ${HN_REDIS_URL} HN_CA_CERT: HN_PUBLIC_URL: ${HN_PUBLIC_URL} HN_ROUTER_URL: ${HN_ROUTER_URL} volumes: - ./runtime/trust:/trust:ro networks: - backend - edge depends_on: connector: condition: service_healthy healthcheck: test: - CMD - python - -c - import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/ready', timeout=3) interval: 15s timeout: 5s retries: 3 read_only: true tmpfs: - /tmp:size=16m,noexec,nosuid cap_drop: - ALL security_opt: - no-new-privileges:true mem_limit: 512m edge: image: caddy:2-alpine restart: unless-stopped ports: - 443:8443 volumes: - ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro - ./runtime/tls:/tls:ro networks: - edge depends_on: connector: condition: service_healthy router: condition: service_healthy read_only: true tmpfs: - /data:size=16m - /config:size=16m - /tmp:size=16m cap_drop: - ALL security_opt: - no-new-privileges:true mem_limit: 128m longconn: image: hainuo-relay:0.1.0 profiles: - longconn restart: unless-stopped entrypoint: - python - -m - relay.longconn environment: HN_ENVIRONMENT: ${HN_ENVIRONMENT} HN_REDIS_URL: ${HN_REDIS_URL} HN_INTERNAL_SECRET: ${HN_INTERNAL_SECRET} HN_PUBLIC_URL: ${HN_PUBLIC_URL} HN_ROUTER_URL: ${HN_ROUTER_URL} HN_FEISHU_ENABLED: ${HN_FEISHU_ENABLED} HN_FEISHU_API_BASE: ${HN_FEISHU_API_BASE} HN_FEISHU_APP_ID: ${HN_FEISHU_APP_ID} HN_FEISHU_APP_SECRET: ${HN_FEISHU_APP_SECRET} HN_FEISHU_ENCRYPT_KEY: ${HN_FEISHU_ENCRYPT_KEY} HN_FEISHU_VERIFICATION_TOKEN: ${HN_FEISHU_VERIFICATION_TOKEN} HN_CONNECTOR_INTERNAL_URL: networks: - backend - edge depends_on: connector: condition: service_healthy read_only: true tmpfs: - /tmp:size=16m,noexec,nosuid cap_drop: - ALL security_opt: - no-new-privileges:true mem_limit: 512m networks: backend: internal: true edge: {} volumes: metadata: {}