From 5211530f556f4839903782d7394ff95b0c169161 Mon Sep 17 00:00:00 2001 From: Thumbscrew Date: Sat, 12 Feb 2022 14:02:26 +0000 Subject: [PATCH] add initial docker-compose.yaml --- .env.example | 9 ++++ .gitignore | 3 ++ docker-compose.yaml | 89 +++++++++++++++++++++++++++++++++++++++ secrets/postgres_db.txt | 1 + secrets/postgres_user.txt | 1 + 5 files changed, 103 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 docker-compose.yaml create mode 100644 secrets/postgres_db.txt create mode 100644 secrets/postgres_user.txt diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f7a658c --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# Docker +VOLUME_PATH=/data/zabbix + +# PostgreSQL +POSTGRES_TAG=13 + +# Zabbix +ZABBIX_TAG=5.4-alpine-latest +ZABBIX_TZ="Europe/London" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1f4a22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env + +secrets/postgres_password.txt \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..f7c2163 --- /dev/null +++ b/docker-compose.yaml @@ -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 \ No newline at end of file diff --git a/secrets/postgres_db.txt b/secrets/postgres_db.txt new file mode 100644 index 0000000..c0a5886 --- /dev/null +++ b/secrets/postgres_db.txt @@ -0,0 +1 @@ +zabbix \ No newline at end of file diff --git a/secrets/postgres_user.txt b/secrets/postgres_user.txt new file mode 100644 index 0000000..c0a5886 --- /dev/null +++ b/secrets/postgres_user.txt @@ -0,0 +1 @@ +zabbix \ No newline at end of file