142 lines
3.8 KiB
YAML
142 lines
3.8 KiB
YAML
# ============================================================
|
|
# 红动未来 - 第三方中间件
|
|
# ============================================================
|
|
# 启动: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
|
|
- ./sql/init-pg-hba.sh:/docker-entrypoint-initdb.d/init-pg-hba.sh
|
|
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/postgres-backup:/backup
|
|
- ./scripts/postgres-backup.sh:/usr/local/bin/backup.sh
|
|
environment:
|
|
PGUSER: postgres
|
|
PGPASSWORD: Bjang09@686^*^
|
|
PGHOST: postgres
|
|
PGPORT: 5432
|
|
BACKUP_DIR: /backup
|
|
RETENTION_DAYS: 7
|
|
command: sh /usr/local/bin/backup.sh
|
|
networks:
|
|
- redfuture-net
|
|
|
|
# ---- 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
|