185 lines
4.3 KiB
YAML
185 lines
4.3 KiB
YAML
services:
|
|
nginx:
|
|
image: nginx:1.24-alpine
|
|
container_name: nginx_proxy
|
|
ports:
|
|
- "80:80"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./logs/nginx:/var/log/nginx
|
|
depends_on:
|
|
- php-fpm-v1
|
|
- php-fpm-v2
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost/"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
php-fpm-v1:
|
|
build:
|
|
context: ./api-v1
|
|
dockerfile: Dockerfile
|
|
container_name: php_fpm_v1
|
|
volumes:
|
|
- ./api-v1:/var/www/html
|
|
- ./logs/php-v1:/var/log/php-fpm
|
|
env_file:
|
|
- .env.v1
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -fsS http://nginx/api/v1/ > /dev/null"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
php-fpm-v2:
|
|
build:
|
|
context: ./api-v2
|
|
dockerfile: Dockerfile
|
|
container_name: php_fpm_v2
|
|
volumes:
|
|
- ./api-v2:/var/www/html
|
|
- ./logs/php-v2:/var/log/php-fpm
|
|
env_file:
|
|
- .env.v2
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -fsS http://nginx/api/v2/ > /dev/null"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: postgres_db
|
|
env_file:
|
|
- .env.db
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./database/init:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
memcached:
|
|
image: memcached:1.6-alpine
|
|
container_name: memcached_server
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pidof memcached"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
ports:
|
|
- "11211:11211"
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
nginx_exporter:
|
|
image: nginx/nginx-prometheus-exporter:0.11.0
|
|
container_name: nginx_exporter
|
|
command: ["-nginx.scrape-uri", "http://nginx/status"]
|
|
ports:
|
|
- "9113:9113"
|
|
depends_on:
|
|
- nginx
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
php_fpm_exporter:
|
|
image: hipages/php-fpm_exporter:latest
|
|
container_name: php_fpm_exporter
|
|
command:
|
|
- "server"
|
|
- "--phpfpm.scrape-uri=tcp://php-fpm-v1:9000/status"
|
|
- "--phpfpm.scrape-uri=tcp://php-fpm-v2:9000/status"
|
|
- "--web.listen-address=0.0.0.0:9253"
|
|
ports:
|
|
- "9253:9253"
|
|
depends_on:
|
|
- php-fpm-v1
|
|
- php-fpm-v2
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
postgres_exporter:
|
|
image: prometheuscommunity/postgres-exporter:latest
|
|
container_name: postgres_exporter
|
|
env_file:
|
|
- .env.db
|
|
environment:
|
|
DATA_SOURCE_NAME: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable"
|
|
ports:
|
|
- "9187:9187"
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
memcached_exporter:
|
|
image: prom/memcached-exporter:latest
|
|
container_name: memcached_exporter
|
|
command: ["--memcached.address=memcached:11211"]
|
|
ports:
|
|
- "9150:9150"
|
|
depends_on:
|
|
- memcached
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: prometheus
|
|
command: ["--config.file=/etc/prometheus/prometheus.yml","--storage.tsdb.path=/prometheus","--web.enable-lifecycle"]
|
|
volumes:
|
|
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./monitoring/alert.rules.yml:/etc/prometheus/alert.rules.yml:ro
|
|
- prometheus_data:/prometheus
|
|
ports:
|
|
- "9090:9090"
|
|
depends_on:
|
|
- nginx_exporter
|
|
- php_fpm_exporter
|
|
- postgres_exporter
|
|
- memcached_exporter
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
alertmanager:
|
|
image: prom/alertmanager:latest
|
|
container_name: alertmanager
|
|
volumes:
|
|
- ./monitoring/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
|
|
ports:
|
|
- "9093:9093"
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
prometheus_data:
|
|
|
|
networks:
|
|
app_network:
|
|
driver: bridge |