networks: cloud-app: external: true volumes: pg-data: external: true redis-data: external: true services: # Nacos cloud-app-nacos: image: nacos/nacos-server:v2.5.1 container_name: cloud-app-nacos restart: unless-stopped mem_limit: 512m cpus: 1 ports: - "8848:8848" - "9848:9848" - "9849:9849" environment: TZ: ${TZ} 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} 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 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 # 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 command: - server - /data - --console-address - :9001 ports: - "9000:9000" - "9001:9001" environment: TZ: ${TZ} 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 # 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 environment: TZ: ${TZ} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} volumes: - pg-data:/var/lib/postgresql/data - ./data/postgres/log:/var/log/postgresql - ./config/postgres/initdb:/docker-entrypoint-initdb.d:ro - ./config/postgres/conf/postgresql.conf:/etc/postgresql/postgresql.conf:ro ports: - "5432:5432" networks: - cloud-app healthcheck: test: [ "CMD", "pg_isready", "-U", "postgres" ] interval: 10s timeout: 5s retries: 3 # Redis 服务 cloud-app-redis: image: redis:7.4.2 container_name: cloud-app-redis restart: unless-stopped mem_limit: 256m cpus: 1 environment: TZ: ${TZ} REDIS_PASSWORD: ${REDIS_PASSWORD} command: - /bin/sh - -c - > redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru --appendonly no --save "" --requirepass $$REDIS_PASSWORD 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