Files
deploy/docker-compose-infra-main.yml
T
2026-06-26 09:07:47 +08:00

161 lines
4.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# 红动未来 - 第三方中间件
# ============================================================
# 启动:docker compose -f deploy/docker-compose-infra-main.yml up -d
# 停止:docker compose -f deploy/docker-compose-infra-main.yml down
# ============================================================
name: redfuture
networks:
redfuture-net:
driver: bridge
services:
# ---- PostgreSQL (pgvector) ----
postgres:
image: docker.m.daocloud.io/pgvector/pgvector:pg16
container_name: postgres
restart: unless-stopped
ports:
- "15432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Bjang09@686^*^
POSTGRES_DB: postgres
volumes:
- ../data/postgres:/var/lib/postgresql/data
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./sql/init-replication.sql:/docker-entrypoint-initdb.d/init-replication.sql
command: ["postgres", "-c", "wal_level=replica", "-c", "max_wal_senders=10", "-c", "max_replication_slots=10", "-c", "hot_standby=on"]
networks:
- redfuture-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# ---- PostgreSQL 自动备份 (每日凌晨 2:00) ----
postgres-backup:
image: docker.m.daocloud.io/pgvector/pgvector:pg16
container_name: postgres-backup
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
volumes:
- /data/pgsql/backup:/backup
environment:
PGUSER: postgres
PGPASSWORD: Bjang09@686^*^
PGHOST: postgres
PGPORT: 5432
BACKUP_DIR: /backup
RETENTION_DAYS: 7
entrypoint: ["/bin/sh", "-c"]
command:
- |
set -e
mkdir -p "/backup"
while true; do
f="backup_$(date +%Y%m%d_%H%M%S).sql.gz"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting backup: $${f}"
pg_dumpall -h postgres -U postgres | gzip > "/backup/$${f}"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Backup complete"
find /backup -name "backup_*.sql.gz" -mtime +7 -delete 2>/dev/null || true
sleep 86400
done
# ---- Redis ----
redis:
image: docker.m.daocloud.io/redis:7.4.8
container_name: redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --requirepass Bjang09@686^*^
volumes:
- ../data/redis:/data
networks:
- redfuture-net
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ---- Consul ----
consul:
image: docker.m.daocloud.io/consul:1.15.4
container_name: consul
restart: unless-stopped
ports:
- "8500:8500"
init: true
command: agent -server -bootstrap -ui -data-dir=/consul/data -bind=0.0.0.0 -client=0.0.0.0
volumes:
- ../data/consul:/consul/data
networks:
- redfuture-net
# ---- MinIO ----
minio:
image: docker.m.daocloud.io/minio/minio
container_name: minio
restart: unless-stopped
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: Bjang09@686^*^
command: server /data --console-address ":9001"
volumes:
- ../data/minio:/data
networks:
- redfuture-net
# ---- MeiliSearch ----
meilisearch:
image: docker.m.daocloud.io/getmeili/meilisearch:v1.3
container_name: meilisearch
restart: unless-stopped
ports:
- "7700:7700"
environment:
MEILI_MASTER_KEY: wMW7BPM3CLwnEGpPbaoci-HvB8R37wV-5tGIizsDQSQ
volumes:
- ../data/meilisearch:/meili_data
networks:
- redfuture-net
# ---- NATS (with JetStream) ----
nats:
image: docker.m.daocloud.io/nats:latest
container_name: nats
restart: unless-stopped
ports:
- "4222:4222"
- "8222:8222"
command: -js -sd /data -m 8222
volumes:
- ../data/nats:/data
depends_on:
redis:
condition: service_healthy
networks:
- redfuture-net
# ---- media 运行时基础镜像(ffmpeg/python/node/chromium/hyperframes ----
media-deps:
build:
context: ../
dockerfile: deploy/media-deps/Dockerfile
image: redfuture-media-deps:latest
container_name: media-deps
restart: "no"
networks:
- redfuture-net