add initial docker-compose.yaml

This commit is contained in:
James 2022-02-12 14:02:26 +00:00
parent b3ba7bf3a3
commit 5211530f55
5 changed files with 103 additions and 0 deletions

9
.env.example Normal file
View File

@ -0,0 +1,9 @@
# Docker
VOLUME_PATH=/data/zabbix
# PostgreSQL
POSTGRES_TAG=13
# Zabbix
ZABBIX_TAG=5.4-alpine-latest
ZABBIX_TZ="Europe/London"

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
secrets/postgres_password.txt

89
docker-compose.yaml Normal file
View File

@ -0,0 +1,89 @@
secrets:
postgres_db:
file: ./secrets/postgres_db.txt
postgres_user:
file: ./secrets/postgres_user.txt
postgres_password:
file: ./secrets/postgres_password.txt
networks:
database:
web:
agent:
services:
postgres-server:
image: postgres:${POSTGRES_TAG}
restart: unless-stopped
volumes:
- ${VOLUME_PATH}/var/lib/postgresql/data:/var/lib/postgresql/data:rw
networks:
- database
secrets:
- postgres_db
- postgres_user
- postgres_password
environment:
POSTGRES_DB_FILE: /run/secrets/postgres_db
POSTGRES_USER_FILE: /run/secrets/postgres_user
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
zabbix-server:
image: zabbix/zabbix-server-pgsql:${ZABBIX_TAG}
restart: unless-stopped
networks:
- database
- web
- agent
secrets:
- postgres_db
- postgres_user
- postgres_password
environment:
POSTGRES_DB_FILE: /run/secrets/postgres_db
POSTGRES_USER_FILE: /run/secrets/postgres_user
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
ZBX_HISTORYSTORAGETYPES: log,text # Zabbix configuration variables
ZBX_DEBUGLEVEL: 1
ZBX_HOUSEKEEPINGFREQUENCY: 1
ZBX_MAXHOUSEKEEPERDELETE: 5000
ports:
- 10051:10051
depends_on:
- postgres-server
volumes:
- ${VOLUME_PATH}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:rw
zabbix-web: # The main Zabbix web UI or interface
image: zabbix/zabbix-web-nginx-pgsql:${ZABBIX_TAG}
restart: unless-stopped
networks:
- database
- web
secrets:
- postgres_db
- postgres_user
- postgres_password
environment: # Postgres database variables
POSTGRES_DB_FILE: /run/secrets/postgres_db
POSTGRES_USER_FILE: /run/secrets/postgres_user
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
ZBX_SERVER_HOST: zabbix-server # Zabbix related and PHP variables
ZBX_POSTMAXSIZE: 64M
PHP_TZ: ${ZABBIX_TZ}
ZBX_MAXEXECUTIONTIME: 500
depends_on:
- postgres-server
- zabbix-server
ports: # Port where Zabbix UI is available
- 80:8080
zabbix-agent: # Zabbix agent service that tracks usage and send to zabbix server
image: zabbix/zabbix-agent:${ZABBIX_TAG}
restart: unless-stopped
networks:
- agent
# network_mode: "host"
privileged: true
depends_on:
- zabbix-server

1
secrets/postgres_db.txt Normal file
View File

@ -0,0 +1 @@
zabbix

View File

@ -0,0 +1 @@
zabbix