Files
ecs-relay-service/deployable/compose.yaml
T

295 lines
7.2 KiB
YAML

name: ${COMPOSE_PROJECT_NAME:-hainuo-relay}
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: hainuo
POSTGRES_USER: hainuo
POSTGRES_PASSWORD: ${HN_POSTGRES_PASSWORD:?Initialize first}
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: ${HN_IMAGE:-hainuo-relay:deploy-20261027}
build:
context: .
dockerfile: Dockerfile
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: /data
HN_DATABASE_URL: ${HN_DATABASE_URL}
HN_CA_CERT: /trust/ca.pem
HN_CONNECTOR_KEY: /data/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}
HN_CONNECTOR_PUBLIC_KEY: /trust/connector.pub
HN_FEISHU_EVENT_SOURCE: longconn
HN_OAUTH_ENABLED: ${HN_OAUTH_ENABLED:-true}
HN_FEISHU_OAUTH_SCOPES: ${HN_FEISHU_OAUTH_SCOPES:-}
HN_ENROLLMENT_SIGNER_URL: http://enrollment-signer:8000
HN_REQUEST_TIMEOUT: ${HN_REQUEST_TIMEOUT:-180}
HTTP_PROXY: ''
HTTPS_PROXY: ''
ALL_PROXY: ''
http_proxy: ''
https_proxy: ''
all_proxy: ''
NO_PROXY: '*'
no_proxy: '*'
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
enrollment-signer:
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: ${HN_IMAGE:-hainuo-relay:deploy-20261027}
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: /trust/ca.pem
HN_PUBLIC_URL: ${HN_PUBLIC_URL}
HN_ROUTER_URL: ${HN_ROUTER_URL}
HN_CONNECTOR_PUBLIC_KEY: /trust/connector.pub
HTTP_PROXY: ''
HTTPS_PROXY: ''
ALL_PROXY: ''
http_proxy: ''
https_proxy: ''
all_proxy: ''
NO_PROXY: '*'
no_proxy: '*'
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:
- ${HN_LISTEN_ADDRESS:-0.0.0.0}:${HN_HTTPS_PORT:-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
cap_add:
- NET_BIND_SERVICE
longconn:
image: ${HN_IMAGE:-hainuo-relay:deploy-20261027}
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: http://connector:8000
HN_CA_CERT: /trust/ca.pem
HN_CONNECTOR_PUBLIC_KEY: /trust/connector.pub
HN_FEISHU_EVENT_SOURCE: longconn
HTTP_PROXY: ''
HTTPS_PROXY: ''
ALL_PROXY: ''
http_proxy: ''
https_proxy: ''
all_proxy: ''
NO_PROXY: '*'
no_proxy: '*'
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
enrollment-signer:
image: ${HN_IMAGE:-hainuo-relay:deploy-20261027}
entrypoint:
- python
- -m
- relay.enrollment_signer
restart: unless-stopped
environment:
HN_INTERNAL_SECRET: ${HN_INTERNAL_SECRET}
HTTP_PROXY: ''
HTTPS_PROXY: ''
ALL_PROXY: ''
http_proxy: ''
https_proxy: ''
all_proxy: ''
NO_PROXY: '*'
no_proxy: '*'
volumes:
- ./runtime/issuer:/issuer:ro
- ./runtime/trust:/trust:ro
networks:
- backend
read_only: true
tmpfs:
- /tmp:size=16m,noexec,nosuid
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
mem_limit: 128m
healthcheck:
test:
- CMD
- python
- -c
- import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/ready',
timeout=3)
interval: 10s
timeout: 5s
retries: 5
networks:
backend:
internal: true
edge: {}
volumes:
metadata: {}