add timed
This commit is contained in:
@@ -112,6 +112,78 @@ services:
|
||||
memory: 256M
|
||||
cpus: "0.3"
|
||||
|
||||
# TYAPI Worker 服务
|
||||
tyapi-worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.worker
|
||||
args:
|
||||
VERSION: 1.0.0
|
||||
COMMIT: dev
|
||||
BUILD_TIME: ""
|
||||
container_name: tyapi-worker-prod
|
||||
environment:
|
||||
# 时区配置
|
||||
TZ: Asia/Shanghai
|
||||
|
||||
# 环境设置
|
||||
ENV: production
|
||||
volumes:
|
||||
- ./logs:/root/logs
|
||||
# user: "1001:1001" # 注释掉,使用root权限运行
|
||||
networks:
|
||||
- tyapi-network
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "ps", "aux", "|", "grep", "worker"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
cpus: "0.5"
|
||||
reservations:
|
||||
memory: 128M
|
||||
cpus: "0.1"
|
||||
|
||||
# Asynq 任务监控 (生产环境)
|
||||
asynq-monitor:
|
||||
image: hibiken/asynqmon:latest
|
||||
container_name: tyapi-asynq-monitor-prod
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "25080:8080"
|
||||
command: --redis-addr=tyapi-redis-prod:6379
|
||||
networks:
|
||||
- tyapi-network
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 256M
|
||||
cpus: "0.3"
|
||||
reservations:
|
||||
memory: 64M
|
||||
cpus: "0.1"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user