init
This commit is contained in:
@@ -1,113 +1,112 @@
|
||||
services:
|
||||
# Application principale
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: src/app/Dockerfile
|
||||
container_name: devops-app
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- ENV=development
|
||||
- HOSTNAME=devops-local
|
||||
volumes:
|
||||
- ../src/app:/app
|
||||
- app-logs:/app/logs
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
- "com.devops.description=Application FastAPI"
|
||||
- "prometheus.scrape=true"
|
||||
- "prometheus.port=8000"
|
||||
- "prometheus.path=/metrics"
|
||||
|
||||
# Prometheus pour le monitoring
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.47.2
|
||||
container_name: devops-prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus-data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||||
- '--web.console.templates=/etc/prometheus/consoles'
|
||||
- '--storage.tsdb.retention.time=200h'
|
||||
- '--web.enable-lifecycle'
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
# Grafana pour les dashboards
|
||||
grafana:
|
||||
image: grafana/grafana:10.2.0
|
||||
container_name: devops-grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin123
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-clock-panel
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
- GF_SERVER_DOMAIN=localhost
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- grafana-data:/var/lib/grafana
|
||||
- ./grafana-dashboards:/etc/grafana/provisioning/dashboards
|
||||
- ./grafana-datasources:/etc/grafana/provisioning/datasources
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- prometheus
|
||||
|
||||
# Portainer pour gérer Docker
|
||||
portainer:
|
||||
image: portainer/portainer-ce:latest
|
||||
container_name: devops-portainer
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9443:9443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- portainer-data:/data
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
command: -H unix:///var/run/docker.sock
|
||||
|
||||
# Inclusion du service Nginx à partir du fichier docker-compose-nginx.yml
|
||||
nginx:
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- devops-network
|
||||
|
||||
networks:
|
||||
devops-network:
|
||||
driver: bridge
|
||||
name: devops-network
|
||||
|
||||
volumes:
|
||||
prometheus-data:
|
||||
name: prometheus-data
|
||||
grafana-data:
|
||||
name: grafana-data
|
||||
portainer-data:
|
||||
name: portainer-data
|
||||
app-logs:
|
||||
name: app-logs
|
||||
x-logging: &default-logging
|
||||
driver: fluentd
|
||||
options:
|
||||
fluentd-address: localhost:24224
|
||||
tag: devops.*
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: src/app/Dockerfile
|
||||
container_name: devops-app
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- ENV=development
|
||||
- HOSTNAME=devops-local
|
||||
volumes:
|
||||
- ../src/app:/app
|
||||
- app-logs:/app/logs
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
- "com.devops.description=Application FastAPI"
|
||||
- "prometheus.scrape=true"
|
||||
- "prometheus.port=8000"
|
||||
- "prometheus.path=/metrics"
|
||||
logging: *default-logging
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.47.2
|
||||
container_name: devops-prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ../config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus-data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||||
- '--web.console.templates=/etc/prometheus/consoles'
|
||||
- '--storage.tsdb.retention.time=200h'
|
||||
- '--web.enable-lifecycle'
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- app
|
||||
logging: *default-logging
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:10.2.0
|
||||
container_name: devops-grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin123
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-clock-panel
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
- GF_SERVER_DOMAIN=localhost
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- grafana-data:/var/lib/grafana
|
||||
- ../monitoring/grafana-dashboards:/etc/grafana/provisioning/dashboards
|
||||
- ../monitoring/grafana-datasources:/etc/grafana/provisioning/datasources
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- prometheus
|
||||
logging: *default-logging
|
||||
|
||||
portainer:
|
||||
image: portainer/portainer-ce:latest
|
||||
container_name: devops-portainer
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9443:9443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- portainer-data:/data
|
||||
networks:
|
||||
- devops-network
|
||||
restart: unless-stopped
|
||||
command: -H unix:///var/run/docker.sock
|
||||
logging: *default-logging
|
||||
|
||||
networks:
|
||||
devops-network:
|
||||
driver: bridge
|
||||
name: devops-network
|
||||
|
||||
volumes:
|
||||
prometheus-data:
|
||||
name: prometheus-data
|
||||
grafana-data:
|
||||
name: grafana-data
|
||||
portainer-data:
|
||||
name: portainer-data
|
||||
app-logs:
|
||||
name: app-logs
|
||||
Reference in New Issue
Block a user