Services/Zabbix/docker-compose.yml

102 lines
3.3 KiB
YAML

version: '3.7'
services:
# Database-server (MariaDB)
mariadb:
image: mariadb:10.4-bionic
restart: always
# Forteller Docker at den skal hente konfigurasjon (miljøvariabler) fra fil `.env`
env_file:
- .env
# Hvilke nettverksporter som skal "forwardes" på host.
# I dette tilfellet blir port 33306 på loopback til host sendt videre til port 3306 på container.
ports:
- "127.0.0.1:33306:3306"
# Lokale mapper der data skal lagres
volumes:
- ./mariadb-data:/var/lib/mysql
- ./mariadb-cnf:/etc/mysql/conf.d
networks:
backend:
aliases:
- mariadb
- mysql-server
command: --character-set-server=utf8 --collation-server=utf8_bin
# Zabbix Java Gateway
gateway:
image: zabbix/zabbix-java-gateway:latest
restart: always
env_file:
- .env
networks:
- backend
ports:
- "10052:10052"
depends_on:
- mariadb
# Zabbix Server
# Denne Docker-malen er spesifikt satt opp for å støtte tilkobling til en MySQL/MariaDB database
zabbix-mysql:
image: zabbix/zabbix-server-mysql:latest
restart: always
networks:
backend:
aliases:
- zabbix-mysql
- zabbix-server
ports:
- "10051:10051"
env_file:
- .env
depends_on:
- mariadb
- gateway
volumes:
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
# Zabbix Agent sammen med serveren
zabbix-agent:
image: zabbix/zabbix-agent:latest
restart: always
networks:
backend:
aliases:
- zabbix-agent
ports:
- "10050:10050"
volumes:
- ./zbx_env/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
env_file:
- .env
depends_on:
- zabbix-mysql
# Mal for Zabbix sitt web-grensesnitt med støtte for MySQL/MariaDB
nginx:
image: zabbix/zabbix-web-nginx-mysql:latest
restart: always
networks:
- backend
env_file:
- .env
ports:
- "127.0.0.1:8080:80"
depends_on:
- mariadb
volumes:
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
networks:
backend: