sol-cloud/docker/infra.docker-compose.yml

161 lines
4 KiB
YAML
Raw Normal View History

2025-02-12 09:22:25 +00:00
networks:
cloud-app:
external: true
volumes:
pg-data:
external: true
redis-data:
external: true
2025-02-12 09:22:25 +00:00
services:
# Nacos
cloud-app-nacos:
image: nacos/nacos-server:v2.5.1
2025-02-12 09:22:25 +00:00
container_name: cloud-app-nacos
restart: unless-stopped
mem_limit: 512m
cpus: 1
2025-02-12 09:22:25 +00:00
ports:
- "8848:8848"
- "9848:9848"
- "9849:9849"
environment:
TZ: ${TZ}
2025-02-12 09:22:25 +00:00
MODE: standalone
NACOS_APPLICATION_PORT: 8848
DB_SERVICE_NAME: postgresql
DB_SERVICE_HOST: cloud-app-postgres
DB_SERVICE_PORT: 5432
DB_SERVICE_DB_NAME: nacos
DB_SERVICE_USER: ${POSTGRES_USER}
DB_SERVICE_PASSWORD: ${POSTGRES_PASSWORD}
2025-02-12 09:22:25 +00:00
NACOS_AUTH_ENABLE: true
NACOS_AUTH_TOKEN: ${NACOS_AUTH_TOKEN}
NACOS_AUTH_IDENTITY_KEY: ${NACOS_AUTH_IDENTITY_KEY}
NACOS_AUTH_IDENTITY_VALUE: ${NACOS_AUTH_IDENTITY_SECRET}
JVM_XMS: 128m
JVM_XMX: 256m
JVM_XMN: 64m
JVM_MS: 64m
JVM_MMS: 128m
2025-02-12 09:22:25 +00:00
networks:
- cloud-app
volumes:
- ./data/nacos/logs:/home/nacos/logs
- ./config/nacos/conf/application.properties:/home/nacos/conf/application.properties
- ./config/nacos/plugins/:/home/nacos/plugins/
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8848/nacos/v1/console/namespaces?&namespaceId=" ]
interval: 10s
timeout: 5s
retries: 3
2025-02-12 09:22:25 +00:00
# Minio 服务
cloud-app-minio:
image: minio/minio:RELEASE.2024-11-07T00-52-20Z
container_name: cloud-app-minio
restart: unless-stopped
mem_limit: 256m
cpus: 1
2025-02-12 09:22:25 +00:00
command:
- server
- /data
- --console-address
- :9001
ports:
- "9000:9000"
- "9001:9001"
environment:
TZ: ${TZ}
2025-02-12 09:22:25 +00:00
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
volumes:
- ./data/minio/data:/data
- ./data/minio/root/.minio:/root/.minio
networks:
- cloud-app
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 10s
timeout: 5s
retries: 3
2025-02-12 09:22:25 +00:00
# PostgreSQL 数据库服务
cloud-app-postgres:
image: postgres:17.2
container_name: cloud-app-postgres
restart: unless-stopped
mem_limit: 1g
cpus: 1
command: postgres -c config_file=/etc/postgresql/postgresql.conf
2025-02-12 09:22:25 +00:00
environment:
TZ: ${TZ}
2025-02-12 09:22:25 +00:00
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- pg-data:/var/lib/postgresql/data
2025-02-12 09:22:25 +00:00
- ./data/postgres/log:/var/log/postgresql
- ./config/postgres/initdb:/docker-entrypoint-initdb.d:ro
- ./config/postgres/conf/postgresql.conf:/etc/postgresql/postgresql.conf:ro
2025-02-12 09:22:25 +00:00
ports:
- "5432:5432"
networks:
- cloud-app
healthcheck:
test: [ "CMD", "pg_isready", "-U", "postgres" ]
interval: 10s
timeout: 5s
retries: 3
2025-02-12 09:22:25 +00:00
# Redis 服务
cloud-app-redis:
image: redis:7.4.2
2025-02-12 09:22:25 +00:00
container_name: cloud-app-redis
restart: unless-stopped
mem_limit: 256m
cpus: 1
2025-02-12 09:22:25 +00:00
environment:
TZ: ${TZ}
2025-02-12 09:22:25 +00:00
REDIS_PASSWORD: ${REDIS_PASSWORD}
command:
- /bin/sh
- -c
- >
redis-server
--maxmemory 128mb
--maxmemory-policy allkeys-lru
--appendonly no
--save ""
--requirepass $$REDIS_PASSWORD
2025-02-12 09:22:25 +00:00
ports:
- "6379:6379"
networks:
- cloud-app
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 3
cloud-app-consul:
image: hashicorp/consul:1.22
container_name: cloud-app-consul
restart: unless-stopped
ports:
- "8500:8500"
- "8600:8600/udp"
command: >
consul agent
-server
-ui
-node=local
-bootstrap-expect=1
-client=0.0.0.0
-data-dir=/consul/data
environment:
TZ: ${TZ}
mem_limit: 256m
cpus: 1
networks:
- cloud-app
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8500/v1/status/leader" ]
interval: 10s
timeout: 5s
retries: 3