Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
monitoring-container ressources
version: '3'
services:
app:
build:
context: .
dockerfile: ./Dockerfile
depends_on:
- db
environment:
# Change to prod in production
- SYMFONY_ENV=dev
volumes:
# Comment out the next line in production
- ./:/srv/api-platform:rw
# This is for assets:install
- ./web:/srv/api-platform/web:rw
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
- /srv/api-platform/var/
- /srv/api-platform/var/cache/
- /srv/api-platform/var/logs/
- /srv/api-platform/var/sessions/
- /srv/api-platform/vendor/
db:
build:
context: ./docker/db
dockerfile: ./Dockerfile
environment:
- MYSQL_DATABASE=api_platform
# You should definitely change the password in production
- MYSQL_PASSWORD=api_platform
- MYSQL_RANDOM_ROOT_PASSWORD=true
- MYSQL_USER=api_platform
volumes:
- db-data:/var/lib/mysql:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/mysql:rw
nginx:
build:
context: ./docker/nginx
dockerfile: ./Dockerfile
volumes:
# Comment out the next line in production
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
- ./web:/srv/api-platform/web:ro
ports:
- "8080:80"
varnish:
build:
context: ./docker/varnish
dockerfile: ./Dockerfile
depends_on:
- app
- nginx
volumes:
- ./docker/varnish/conf:/etc/varnish:ro
ports:
- "80:80"
cadvisor:
image: google/cadvisor
container_name: cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
expose:
- 8080
ports:
- "8005:8080"
networks:
- monitoring
prometheus:
image: prom/prometheus:v2.0.0
container_name: prometheus
volumes:
- ./docker/prometheus/:/etc/prometheus/
- 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=200h'
expose:
- 9090
ports:
- "9090:9090"
networks:
- monitoring
grafana:
image: grafana/grafana:4.6.2
container_name: grafana
volumes:
- grafana-data:/var/lib/grafana
expose:
- 3000
ports:
- "3000:3000"
networks:
- monitoring
volumes:
app-web: {}
db-data: {}
prometheus-data: {}
grafana-data: {}
networks:
monitoring:
driver: bridge
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'docker-host-alpha'
rule_files:
- "targets.rules"
- "host.rules"
- "containers.rules"
scrape_configs:
- job_name: 'cadvisor'
scrape_interval: 5s
static_configs:
- targets: ['cadvisor:8080']
- job_name: 'prometheus'
scrape_interval: 10s
static_configs:
- targets: ['localhost:9090']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.