| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- version: '3.9'
- x-common-environment:
- &common-environment
- TZ: Asia/Shanghai
- x-common-config:
- &common-config
- restart: unless-stopped
- networks:
- - app-tier
- environment:
- <<: *common-environment
- deploy:
- resources:
- limits:
- cpus: '2'
- memory: '1G'
- services:
- postgres:
- image: postgres:${POSTGRES_VERSION}
- container_name: postgres
- <<: *common-config
- environment:
- <<: *common-environment
- POSTGRES_USER: ${POSTGRES_USER}
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
- PGDATA: /var/lib/postgresql/data/pgdata
- POSTGRES_INITDB_ARGS: "--data-checksums"
- POSTGRES_POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
- command: >
- postgres
- -c shared_buffers=1GB
- -c work_mem=16MB
- -c maintenance_work_mem=128MB
- -c effective_cache_size=768MB
- -c random_page_cost=1.1
- -c synchronous_commit=off
- -c wal_buffers=16MB
- -c max_connections=200
- -c checkpoint_completion_target=0.9
- -c min_wal_size=80MB
- -c max_wal_size=1GB
- volumes:
- - ./postgresql/data:/var/lib/postgresql/data
- ports:
- - "5432:5432"
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
- interval: 30s
- timeout: 10s
- retries: 5
- redis:
- image: redis:${REDIS_VERSION}
- container_name: redis
- <<: *common-config
- environment:
- <<: *common-environment
- REDIS_PASSWORD: ${REDIS_PASSWORD}
- command: >
- redis-server
- --requirepass ${REDIS_PASSWORD}
- --appendonly yes
- --appendfsync everysec
- --save 900 1
- --save 300 10
- --save 60 10000
- --maxmemory 512mb
- --maxmemory-policy allkeys-lru
- --tcp-keepalive 300
- --timeout 0
- --loglevel notice
- volumes:
- - ./redis/data:/data
- ports:
- - "6379:6379"
- healthcheck:
- test: ["CMD", "redis-cli", "ping"]
- interval: 30s
- timeout: 10s
- retries: 5
- # pgadmin:
- # image: dpage/pgadmin4:${PGADMIN_VERSION}
- # container_name: pgadmin
- # <<: *common-config
- # environment:
- # <<: *common-environment
- # PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
- # PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
- # volumes:
- # - ./pgadmin/data:/var/lib/pgadmin
- # ports:
- # - "8080:80"
- # depends_on:
- # - postgres
- # healthcheck:
- # test: ["CMD", "wget", "--spider", "http://localhost:80/login"]
- # interval: 30s
- # timeout: 10s
- # retries: 5
- # nginx:
- # image: nginx:${NGINX_VERSION}
- # container_name: nginx
- # <<: *common-config
- # environment:
- # <<: *common-environment
- # volumes:
- # - ./nginx/conf.d:/etc/nginx/conf.d
- # - ./nginx/html:/usr/share/nginx/html
- # ports:
- # - "80:80"
- # - "443:443"
- # healthcheck:
- # test: ["CMD", "wget", "--spider", "http://localhost:80"]
- # interval: 30s
- # timeout: 10s
- # retries: 5
- nginx-proxy-manager:
- image: jc21/nginx-proxy-manager:${NGINX_PROXY_MANAGER_VERSION}
- container_name: nginx-proxy-manager
- <<: *common-config
- environment:
- <<: *common-environment
- volumes:
- - ./nginx-proxy-manager/data:/data
- - ./nginx-proxy-manager/letsencrypt:/etc/letsencrypt
- ports:
- - "80:80"
- - "81:81"
- - "443:443"
- healthcheck:
- test: ["CMD", "wget", "--spider", "http://localhost:81"]
- interval: 30s
- timeout: 10s
- retries: 5
- gogs:
- image: gogs/gogs:${GOGS_VERSION}
- container_name: gogs
- <<: *common-config
- environment:
- <<: *common-environment
- volumes:
- - ./gogs/data:/data
- ports:
- - "3000:3000"
- - "2222:22"
- depends_on:
- - postgres
- healthcheck:
- test: ["CMD", "wget", "--spider", "http://localhost:3000"]
- interval: 30s
- timeout: 10s
- retries: 5
- networks:
- app-tier:
- driver: bridge
|