Collector daemon, FastAPI server (addresses, diff, collect, sources), SQLite storage with change journal, Docker Compose deployment, tests, documentation and project rules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
# API и сборщик - два независимых сервиса одного образа; общаются только файлами в томе /data
|
|
x-common: &common
|
|
build: .
|
|
image: ripe-cidr-collector
|
|
restart: unless-stopped
|
|
environment:
|
|
TZ: ${TZ:-UTC} # часовой пояс, в котором считаются cron-расписания
|
|
volumes:
|
|
- ripe_data:/data
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
services:
|
|
api:
|
|
<<: *common
|
|
ports:
|
|
- "${API_PORT:-8000}:8000"
|
|
env_file: .env # RIPE_API_TOKEN; без него изменяющие запросы отключены (503)
|
|
healthcheck:
|
|
test: ["CMD", "python", "healthcheck.py", "api"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
collector:
|
|
<<: *common
|
|
command: ["python", "collector_daemon.py"]
|
|
stop_grace_period: 60s # идущий сбор успевает завершиться по SIGTERM
|
|
healthcheck:
|
|
test: ["CMD", "python", "healthcheck.py", "collector"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
volumes:
|
|
ripe_data:
|