diff --git a/.env b/.env new file mode 100644 index 000000000..9f30d1932 --- /dev/null +++ b/.env @@ -0,0 +1,82 @@ +# Zabbix images +ZABBIX_ALPINE_IMAGE_TAG=alpine +ZABBIX_CENTOS_IMAGE_TAG=centos +ZABBIX_OL_IMAGE_TAG=ol +ZABBIX_UBUNTU_IMAGE_TAG=ubuntu +ZABBIX_IMAGE_TAG_POSTFIX=-trunk +ZABBIX_LOCAL_IMAGE_TAG_POSTFIX=-local + +ZABBIX_SERVER_MYSQL_IMAGE=zabbix/zabbix-server-mysql +ZABBIX_SERVER_PGSQL_IMAGE=zabbix/zabbix-server-pgsql +ZABBIX_PROXY_MYSQL_IMAGE=zabbix/zabbix-proxy-mysql +ZABBIX_PROXY_SQLITE3_IMAGE=zabbix/zabbix-proxy-sqlite3 +ZABBIX_WEB_NGINX_MYSQL_IMAGE=zabbix/zabbix-web-nginx-mysql +ZABBIX_WEB_APACHE_MYSQL_IMAGE=zabbix/zabbix-web-apache-mysql +ZABBIX_WEB_NGINX_PGSQL_IMAGE=zabbix/zabbix-web-nginx-pgsql +ZABBIX_WEB_APACHE_PGSQL_IMAGE=zabbix/zabbix-web-apache-pgsql +ZABBIX_AGENT_IMAGE=zabbix/zabbix-agent +ZABBIX_JAVA_GATEWAY_IMAGE=zabbix/zabbix-java-gateway +ZABBIX_SNMPTRAPS_IMAGE=zabbix/zabbix-snmptraps +ZABBIX_WEB_SERVICE_IMAGE=zabbix/zabbix-web-service + +# Database images +MYSQL_IMAGE=mysql +MYSQL_IMAGE_TAG=8.0-oracle +POSTGRESQL_IMAGE=postgres +POSTGRESQL_IMAGE_TAG=16-alpine + +ELASTICSEARCH_IMAGE=elasticsearch +ELASTICSEARCH_IMAGE_TAG=latest + +# Expose ports per service +ZABBIX_SERVER_PORT=10051 +ZABBIX_PROXY_MYSQL_PORT=10071 +ZABBIX_PROXY_SQLITE3_PORT=10061 +ZABBIX_WEB_NGINX_HTTP_PORT=80 +ZABBIX_WEB_NGINX_HTTPS_PORT=443 +ZABBIX_WEB_APACHE_HTTP_PORT=8081 +ZABBIX_WEB_APACHE_HTTPS_PORT=8443 +ZABBIX_AGENT_PORT=10050 +ZABBIX_JAVA_GATEWAY_PORT=10052 +ZABBIX_SNMPTRAPS_PORT=162 +ZABBIX_WEB_SERVICE_PORT=10053 + +# Network IP ranges +FRONTEND_NETWORK_DRIVER=default +FRONTEND_SUBNET=172.16.238.0/24 +FRONTEND_ENABLE_IPV6=false +BACKEND_NETWORK_DRIVER=default +BACKEND_SUBNET=172.16.239.0/24 +BACKEND_ENABLE_IPV6=false + +# Locations +DATA_DIRECTORY=./zbx_env +ENV_VARS_DIRECTORY=./env_vars + +# Options +RESTART_POLICY=unless-stopped + +# Cache base images +ALPINE_CACHE_FROM=alpine:3.19 +CENTOS_CACHE_FROM=quay.io/centos/centos:stream9 +OL_CACHE_FROM=oraclelinux:9-slim +UBUNTU_CACHE_FROM=ubuntu:jammy + +# Base images +BUILD_BASE_IMAGE=zabbix-build-base +BUILD_BASE_MYSQL_IMAGE=zabbix-build-mysql +BUILD_BASE_PGSQL_IMAGE=zabbix-build-pgsql +BUILD_BASE_SQLITE3_IMAGE=zabbix-build-sqlite3 + +# Operating System tags +ALPINE_OS_TAG=Alpine +ALPINE_OS_TAG_SHORT=alpine + +CENTOS_OS_TAG=CentOS +CENTOS_OS_TAG_SHORT=centos + +OL_OS_TAG=Oracle Linux +OL_OS_TAG_SHORT=ol + +UBUNTU_OS_TAG=Ubuntu +UBUNTU_OS_TAG_SHORT=ubuntu diff --git a/compose.yaml b/compose.yaml new file mode 120000 index 000000000..02375b222 --- /dev/null +++ b/compose.yaml @@ -0,0 +1 @@ +docker-compose_v3_alpine_mysql_latest.yaml \ No newline at end of file diff --git a/docker-compose_v3_alpine_mysql_latest.yaml b/docker-compose_v3_alpine_mysql_latest.yaml index 36c34a251..286fcccfa 100644 --- a/docker-compose_v3_alpine_mysql_latest.yaml +++ b/docker-compose_v3_alpine_mysql_latest.yaml @@ -1,22 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:alpine-trunk + image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -32,8 +33,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -49,8 +50,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-alpine-mysql - - zabbix-server-mysql-alpine zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -65,23 +64,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:alpine-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -97,8 +97,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -106,8 +106,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-alpine-sqlite3 - - zabbix-proxy-sqlite3-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -115,24 +113,25 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:alpine-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -148,9 +147,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -167,8 +166,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-alpine-mysql - - zabbix-proxy-mysql-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -176,21 +173,22 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-apache-mysql: - image: zabbix/zabbix-web-apache-mysql:alpine-trunk + image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -200,8 +198,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -221,8 +219,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-alpine-mysql - - zabbix-web-apache-mysql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -233,19 +229,20 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-nginx-mysql: - image: zabbix/zabbix-web-nginx-mysql:alpine-trunk + image: "${ZABBIX_WEB_NGINX_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -255,8 +252,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -276,8 +273,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-alpine-mysql - - zabbix-web-nginx-mysql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -288,23 +283,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:alpine-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -315,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -323,21 +319,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:alpine-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -347,21 +343,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:alpine-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -369,7 +364,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -381,7 +377,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -392,19 +388,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:alpine-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -414,21 +411,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -440,11 +436,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -454,7 +451,6 @@ services: # - root-ca.pem stop_grace_period: 1m networks: - zbx_net_frontend: zbx_net_backend: aliases: - mysql-server @@ -464,10 +460,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -483,20 +480,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -504,20 +501,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_alpine_mysql_local.yaml b/docker-compose_v3_alpine_mysql_local.yaml index 6ee08269f..3ecc2619a 100644 --- a/docker-compose_v3_alpine_mysql_local.yaml +++ b/docker-compose_v3_alpine_mysql_local.yaml @@ -1,30 +1,31 @@ +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/alpine + context: ./Dockerfiles/build-base/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 - image: zabbix-build-base:alpine-local + - "${ALPINE_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/alpine + context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:alpine-local - image: zabbix-build-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/alpine + context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:alpine-local - image: zabbix-build-sqlite3:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -32,27 +33,28 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-mysql/alpine + context: ./Dockerfiles/server-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-server-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-mysql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -68,8 +70,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -86,8 +88,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-alpine-mysql - - zabbix-server-mysql-alpine zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -102,29 +102,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/alpine + context: ./Dockerfiles/proxy-sqlite3/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:alpine-local - image: zabbix-proxy-sqlite3:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -140,8 +141,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -150,8 +151,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-alpine-sqlite3 - - zabbix-proxy-sqlite3-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -159,30 +158,31 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/alpine + context: ./Dockerfiles/proxy-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-proxy-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -198,9 +198,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -218,8 +218,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-alpine-mysql - - zabbix-proxy-mysql-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -227,27 +225,28 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-apache-mysql: build: - context: ./Dockerfiles/web-apache-mysql/alpine + context: ./Dockerfiles/web-apache-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-web-apache-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-mysql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -257,8 +256,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -279,8 +278,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-alpine-mysql - - zabbix-web-apache-mysql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -291,25 +288,26 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-nginx-mysql: build: - context: ./Dockerfiles/web-nginx-mysql/alpine + context: ./Dockerfiles/web-nginx-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-web-nginx-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-mysql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -319,8 +317,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -341,8 +339,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-alpine-mysql - - zabbix-web-nginx-mysql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -353,29 +349,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/alpine + context: ./Dockerfiles/agent/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-agent:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -386,7 +383,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -396,27 +393,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/alpine + context: ./Dockerfiles/java-gateway/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-java-gateway:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -426,27 +423,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/alpine + context: ./Dockerfiles/snmptraps/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 - image: zabbix-snmptraps:alpine-local + - "${ALPINE_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -454,7 +450,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -466,7 +463,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -477,25 +474,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/alpine + context: ./Dockerfiles/web-service/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-web-service:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -505,23 +503,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -533,13 +530,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql - ports: - - "3306:3306/tcp" + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -549,7 +545,6 @@ services: # - root-ca.pem stop_grace_period: 1m networks: - zbx_net_frontend: zbx_net_backend: aliases: - mysql-server @@ -559,10 +554,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -578,20 +574,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -599,20 +595,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_alpine_pgsql_latest.yaml b/docker-compose_v3_alpine_pgsql_latest.yaml index 6eb6b7573..e6b7d8f92 100644 --- a/docker-compose_v3_alpine_pgsql_latest.yaml +++ b/docker-compose_v3_alpine_pgsql_latest.yaml @@ -1,25 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:alpine-trunk + image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro + - snmptraps:/var/lib/zabbix/snmptraps:rw +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -34,8 +35,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -46,8 +47,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-alpine-pgsql - - zabbix-server-pgsql-alpine zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -62,23 +61,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:alpine-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -94,8 +94,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -103,8 +103,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-alpine-sqlite3 - - zabbix-proxy-sqlite3-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -112,23 +110,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:alpine-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -144,9 +143,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -160,8 +159,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-alpine-mysql - - zabbix-proxy-mysql-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -169,23 +166,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-apache-pgsql: - image: zabbix/zabbix-web-apache-pgsql:alpine-trunk + image: "${ZABBIX_WEB_APACHE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -195,8 +193,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -213,8 +211,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-alpine-pgsql - - zabbix-web-apache-pgsql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -225,21 +221,22 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-nginx-pgsql: - image: zabbix/zabbix-web-nginx-pgsql:alpine-trunk + image: "${ZABBIX_WEB_NGINX_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -249,8 +246,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -267,8 +264,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-alpine-pgsql - - zabbix-web-nginx-pgsql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -279,23 +274,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:alpine-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -306,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -314,21 +310,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:alpine-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -338,21 +334,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:alpine-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -360,7 +355,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -372,7 +368,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -383,19 +379,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:alpine-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -405,21 +402,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -428,10 +424,11 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -445,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -470,15 +468,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -494,34 +493,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_alpine_pgsql_local.yaml b/docker-compose_v3_alpine_pgsql_local.yaml index f0bb0eb8e..bd96fe17a 100644 --- a/docker-compose_v3_alpine_pgsql_local.yaml +++ b/docker-compose_v3_alpine_pgsql_local.yaml @@ -1,31 +1,31 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/alpine + context: ./Dockerfiles/build-base/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 - image: zabbix-build-base:alpine-local + - "${ALPINE_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-pgsql: build: - context: ./Dockerfiles/build-pgsql/alpine + context: ./Dockerfiles/build-pgsql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:alpine-local - image: zabbix-build-pgsql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/alpine + context: ./Dockerfiles/build-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:alpine-local - image: zabbix-build-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -33,12 +33,12 @@ services: zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/alpine + context: ./Dockerfiles/build-sqlite3/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:alpine-local - image: zabbix-build-sqlite3:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -46,30 +46,31 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-pgsql/alpine + context: ./Dockerfiles/server-pgsql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-server-pgsql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-pgsql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -84,8 +85,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -97,8 +98,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-alpine-pgsql - - zabbix-server-pgsql-alpine zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -113,29 +112,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/alpine + context: ./Dockerfiles/proxy-sqlite3/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:alpine-local - image: zabbix-proxy-sqlite3:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -151,8 +151,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -161,8 +161,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-alpine-sqlite3 - - zabbix-proxy-sqlite3-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -170,29 +168,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/alpine + context: ./Dockerfiles/proxy-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:alpine-local - image: zabbix-proxy-mysql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -208,9 +207,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -225,8 +224,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-alpine-mysql - - zabbix-proxy-mysql-alpine zbx_net_frontend: stop_grace_period: 30s labels: @@ -234,29 +231,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-apache-pgsql: build: - context: ./Dockerfiles/web-apache-pgsql/alpine + context: ./Dockerfiles/web-apache-pgsql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-web-apache-pgsql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-pgsql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -266,8 +264,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -285,8 +283,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-alpine-pgsql - - zabbix-web-apache-pgsql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -297,27 +293,28 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-nginx-pgsql: build: - context: ./Dockerfiles/web-nginx-pgsql/alpine + context: ./Dockerfiles/web-nginx-pgsql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-web-nginx-pgsql:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-pgsql:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -327,8 +324,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -346,8 +343,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-alpine-pgsql - - zabbix-web-nginx-pgsql-alpine zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -358,29 +353,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/alpine + context: ./Dockerfiles/agent/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-agent:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -391,7 +387,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -401,27 +397,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/alpine + context: ./Dockerfiles/java-gateway/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-java-gateway:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -431,27 +427,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/alpine + context: ./Dockerfiles/snmptraps/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 - image: zabbix-snmptraps:alpine-local + - "${ALPINE_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -459,7 +454,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -471,7 +467,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -482,25 +478,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/alpine + context: ./Dockerfiles/web-service/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.19 + - "${ALPINE_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:alpine-local - image: zabbix-web-service:alpine-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -510,23 +507,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-alpine stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "alpine" + com.zabbix.os: "${ALPINE_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -535,10 +531,16 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 +# Use TLS encryption for connections to database +# - --require-secure-transport +# - --ssl-ca=/run/secrets/root-ca.pem +# - --ssl-cert=/run/secrets/server-cert.pem +# - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -552,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -577,15 +580,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -601,34 +605,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_centos_mysql_latest.yaml b/docker-compose_v3_centos_mysql_latest.yaml index a85a43fb8..12775a87a 100644 --- a/docker-compose_v3_centos_mysql_latest.yaml +++ b/docker-compose_v3_centos_mysql_latest.yaml @@ -1,22 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:centos-trunk + image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -32,8 +33,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -49,8 +50,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-centos-mysql - - zabbix-server-mysql-centos zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -65,23 +64,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:centos-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -97,8 +97,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -106,8 +106,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-centos-sqlite3 - - zabbix-proxy-sqlite3-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -115,24 +113,25 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:centos-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -148,9 +147,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -167,8 +166,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-centos-mysql - - zabbix-proxy-mysql-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -176,21 +173,22 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-apache-mysql: - image: zabbix/zabbix-web-apache-mysql:centos-trunk + image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -200,8 +198,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -221,8 +219,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-centos-mysql - - zabbix-web-apache-mysql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -233,19 +229,20 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-nginx-mysql: - image: zabbix/zabbix-web-nginx-mysql:centos-trunk + image: "${ZABBIX_WEB_NGINX_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -255,8 +252,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -276,8 +273,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-centos-mysql - - zabbix-web-nginx-mysql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -288,23 +283,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:centos-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -315,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -323,21 +319,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:centos-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -347,21 +343,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:centos-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -369,7 +364,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -381,7 +377,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -392,19 +388,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:centos-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -414,21 +411,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -440,11 +436,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -463,10 +460,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -482,20 +480,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -503,20 +501,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_centos_mysql_local.yaml b/docker-compose_v3_centos_mysql_local.yaml index 4085aa024..a05956f39 100644 --- a/docker-compose_v3_centos_mysql_local.yaml +++ b/docker-compose_v3_centos_mysql_local.yaml @@ -1,59 +1,60 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/centos + context: ./Dockerfiles/build-base/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 - image: zabbix-build-base:centos-local + - "${CENTOS_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/centos + context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:centos-local - image: zabbix-build-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/centos + context: ./Dockerfiles/build-sqlite3/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:centos-local - image: zabbix-build-sqlite3:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: - zabbix-build-base zabbix-server: - build: - context: ./Dockerfiles/server-mysql/centos + build: + context: ./Dockerfiles/server-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-server-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-mysql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -69,8 +70,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -87,8 +88,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-centos-mysql - - zabbix-server-mysql-centos zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -103,29 +102,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/centos + context: ./Dockerfiles/proxy-sqlite3/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:centos-local - image: zabbix-proxy-sqlite3:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -141,8 +141,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -151,8 +151,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-centos-sqlite3 - - zabbix-proxy-sqlite3-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -160,30 +158,31 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/centos + context: ./Dockerfiles/proxy-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-proxy-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -199,9 +198,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -219,8 +218,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-centos-mysql - - zabbix-proxy-mysql-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -228,27 +225,28 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-apache-mysql: build: - context: ./Dockerfiles/web-apache-mysql/centos + context: ./Dockerfiles/web-apache-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-web-apache-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-mysql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -258,8 +256,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -280,8 +278,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-centos-mysql - - zabbix-web-apache-mysql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -292,25 +288,26 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-nginx-mysql: build: - context: ./Dockerfiles/web-nginx-mysql/centos + context: ./Dockerfiles/web-nginx-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-web-nginx-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-mysql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -320,8 +317,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -342,8 +339,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-centos-mysql - - zabbix-web-nginx-mysql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -354,29 +349,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/centos + context: ./Dockerfiles/agent/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-agent:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -387,37 +383,37 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: - - zabbix-build-mysql + - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/centos + context: ./Dockerfiles/java-gateway/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-java-gateway:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -427,27 +423,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/centos + context: ./Dockerfiles/snmptraps/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 - image: zabbix-snmptraps:centos-local + - "${CENTOS_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -455,7 +450,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -467,7 +463,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -478,25 +474,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/centos + context: ./Dockerfiles/web-service/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-web-service:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -506,23 +503,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -534,11 +530,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -557,10 +554,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -576,20 +574,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -597,20 +595,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_centos_pgsql_latest.yaml b/docker-compose_v3_centos_pgsql_latest.yaml index 9d0437fcc..c6b90cecb 100644 --- a/docker-compose_v3_centos_pgsql_latest.yaml +++ b/docker-compose_v3_centos_pgsql_latest.yaml @@ -1,25 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:centos-trunk + image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -34,8 +35,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -46,8 +47,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-centos-pgsql - - zabbix-server-pgsql-centos zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -62,23 +61,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:centos-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -94,8 +94,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -103,8 +103,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-centos-sqlite3 - - zabbix-proxy-sqlite3-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -112,23 +110,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:centos-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -144,9 +143,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -160,8 +159,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-centos-mysql - - zabbix-proxy-mysql-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -169,23 +166,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-apache-pgsql: - image: zabbix/zabbix-web-apache-pgsql:centos-trunk + image: "${ZABBIX_WEB_APACHE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -195,8 +193,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -213,8 +211,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-centos-pgsql - - zabbix-web-apache-pgsql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -225,21 +221,22 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-nginx-pgsql: - image: zabbix/zabbix-web-nginx-pgsql:centos-trunk + image: "${ZABBIX_WEB_NGINX_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -249,8 +246,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -267,8 +264,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-centos-pgsql - - zabbix-web-nginx-pgsql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -279,23 +274,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:centos-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -306,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -314,21 +310,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:centos-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -338,21 +334,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:centos-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -360,7 +355,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -372,7 +368,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -383,19 +379,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:centos-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -405,21 +402,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -428,10 +424,11 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -445,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -470,15 +468,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -494,34 +493,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_centos_pgsql_local.yaml b/docker-compose_v3_centos_pgsql_local.yaml index 0c9f568a3..dd40ddab4 100644 --- a/docker-compose_v3_centos_pgsql_local.yaml +++ b/docker-compose_v3_centos_pgsql_local.yaml @@ -1,31 +1,31 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/centos + context: ./Dockerfiles/build-base/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 - image: zabbix-build-base:centos-local + - "${CENTOS_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-pgsql: build: - context: ./Dockerfiles/build-pgsql/centos + context: ./Dockerfiles/build-pgsql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:centos-local - image: zabbix-build-pgsql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/centos + context: ./Dockerfiles/build-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:centos-local - image: zabbix-build-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -33,12 +33,12 @@ services: zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/centos + context: ./Dockerfiles/build-sqlite3/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:centos-local - image: zabbix-build-sqlite3:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -46,30 +46,31 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-pgsql/centos + context: ./Dockerfiles/server-pgsql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-server-pgsql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-pgsql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -84,8 +85,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -97,8 +98,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-centos-pgsql - - zabbix-server-pgsql-centos zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -113,29 +112,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/centos + context: ./Dockerfiles/proxy-sqlite3/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-proxy-sqlite3:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -151,18 +151,16 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps - - zabbix-build-pgsql + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-centos-sqlite3 - - zabbix-proxy-sqlite3-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -170,29 +168,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/centos + context: ./Dockerfiles/proxy-mysql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:centos-local - image: zabbix-proxy-mysql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -208,9 +207,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -225,8 +224,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-centos-mysql - - zabbix-proxy-mysql-centos zbx_net_frontend: stop_grace_period: 30s labels: @@ -234,29 +231,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-apache-pgsql: build: - context: ./Dockerfiles/web-apache-pgsql/centos + context: ./Dockerfiles/web-apache-pgsql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-web-apache-pgsql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-pgsql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -266,8 +264,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -285,8 +283,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-centos-pgsql - - zabbix-web-apache-pgsql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -297,27 +293,28 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-nginx-pgsql: build: - context: ./Dockerfiles/web-nginx-pgsql/centos + context: ./Dockerfiles/web-nginx-pgsql/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-web-nginx-pgsql:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-pgsql:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -327,8 +324,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -346,8 +343,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-centos-pgsql - - zabbix-web-nginx-pgsql-centos zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -358,29 +353,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/centos + context: ./Dockerfiles/agent/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-agent:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -391,7 +387,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -401,27 +397,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/centos + context: ./Dockerfiles/java-gateway/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-java-gateway:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -431,27 +427,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/centos + context: ./Dockerfiles/snmptraps/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 - image: zabbix-snmptraps:centos-local + - "${CENTOS_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -459,7 +454,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -471,7 +467,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -482,25 +478,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/centos + context: ./Dockerfiles/web-service/${CENTOS_OS_TAG_SHORT} cache_from: - - quay.io/centos/centos:stream9 + - "${CENTOS_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:centos-local - image: zabbix-web-service:centos-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -510,23 +507,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-centos stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "centos" + com.zabbix.os: "${CENTOS_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -535,10 +531,16 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 +# Use TLS encryption for connections to database +# - --require-secure-transport +# - --ssl-ca=/run/secrets/root-ca.pem +# - --ssl-cert=/run/secrets/server-cert.pem +# - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -552,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -577,15 +580,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -601,34 +605,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_ol_mysql_latest.yaml b/docker-compose_v3_ol_mysql_latest.yaml index 27cd691d5..f4c20dd0c 100644 --- a/docker-compose_v3_ol_mysql_latest.yaml +++ b/docker-compose_v3_ol_mysql_latest.yaml @@ -1,22 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:ol-trunk + image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -32,8 +33,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -49,8 +50,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-ol-mysql - - zabbix-server-mysql-ol zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -65,23 +64,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:ol-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -97,8 +97,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -106,8 +106,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ol-sqlite3 - - zabbix-proxy-sqlite3-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -115,24 +113,25 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:ol-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -148,9 +147,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -167,8 +166,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ol-mysql - - zabbix-proxy-mysql-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -176,21 +173,22 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-apache-mysql: - image: zabbix/zabbix-web-apache-mysql:ol-trunk + image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -200,8 +198,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -221,8 +219,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-ol-mysql - - zabbix-web-apache-mysql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -233,19 +229,20 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-nginx-mysql: - image: zabbix/zabbix-web-nginx-mysql:ol-trunk + image: "${ZABBIX_WEB_NGINX_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -255,8 +252,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -276,8 +273,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-ol-mysql - - zabbix-web-nginx-mysql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -288,23 +283,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:ol-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -315,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -323,21 +319,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:ol-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -347,21 +343,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:ol-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -369,7 +364,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -381,7 +377,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -392,19 +388,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:ol-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -414,21 +411,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -440,11 +436,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -463,10 +460,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -482,20 +480,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -503,20 +501,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_ol_mysql_local.yaml b/docker-compose_v3_ol_mysql_local.yaml index 6bd4e8184..74e9496a6 100644 --- a/docker-compose_v3_ol_mysql_local.yaml +++ b/docker-compose_v3_ol_mysql_local.yaml @@ -1,59 +1,60 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/ol + context: ./Dockerfiles/build-base/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim - image: zabbix-build-base:ol-local + - "${OL_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/ol + context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ol-local - image: zabbix-build-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/ol + context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ol-local - image: zabbix-build-sqlite3:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: - zabbix-build-base zabbix-server: - build: - context: ./Dockerfiles/server-mysql/ol + build: + context: ./Dockerfiles/server-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-server-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-mysql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro + - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -69,8 +70,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -87,8 +88,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-ol-mysql - - zabbix-server-mysql-ol zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -103,29 +102,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/ol + context: ./Dockerfiles/proxy-sqlite3/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local - image: zabbix-proxy-sqlite3:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -141,8 +141,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -151,8 +151,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ol-sqlite3 - - zabbix-proxy-sqlite3-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -160,30 +158,31 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/ol + context: ./Dockerfiles/proxy-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-proxy-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -199,9 +198,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -219,8 +218,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ol-mysql - - zabbix-proxy-mysql-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -228,27 +225,28 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-apache-mysql: build: - context: ./Dockerfiles/web-apache-mysql/ol + context: ./Dockerfiles/web-apache-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-web-apache-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-mysql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -258,8 +256,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -280,8 +278,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-ol-mysql - - zabbix-web-apache-mysql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -292,25 +288,26 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-nginx-mysql: build: - context: ./Dockerfiles/web-nginx-mysql/ol + context: ./Dockerfiles/web-nginx-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-web-nginx-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-mysql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -320,8 +317,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -342,8 +339,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-ol-mysql - - zabbix-web-nginx-mysql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -354,29 +349,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/ol + context: ./Dockerfiles/agent/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-agent:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -387,7 +383,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -397,27 +393,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/ol + context: ./Dockerfiles/java-gateway/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-java-gateway:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -427,27 +423,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/ol + context: ./Dockerfiles/snmptraps/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim - image: zabbix-snmptraps:ol-local + - "${OL_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -455,7 +450,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -467,7 +463,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -478,25 +474,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/ol + context: ./Dockerfiles/web-service/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-web-service:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -506,23 +503,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -534,11 +530,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -557,10 +554,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -576,20 +574,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -597,20 +595,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_ol_pgsql_latest.yaml b/docker-compose_v3_ol_pgsql_latest.yaml index f217aa35c..2df0340eb 100644 --- a/docker-compose_v3_ol_pgsql_latest.yaml +++ b/docker-compose_v3_ol_pgsql_latest.yaml @@ -1,25 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:ol-trunk + image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -34,8 +35,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -46,8 +47,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-ol-pgsql - - zabbix-server-pgsql-ol zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -62,23 +61,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:ol-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -94,8 +94,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -103,8 +103,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ol-sqlite3 - - zabbix-proxy-sqlite3-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -112,23 +110,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:ol-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -144,9 +143,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -160,8 +159,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ol-mysql - - zabbix-proxy-mysql-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -169,23 +166,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-apache-pgsql: - image: zabbix/zabbix-web-apache-pgsql:ol-trunk + image: "${ZABBIX_WEB_APACHE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -195,8 +193,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -213,8 +211,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-ol-pgsql - - zabbix-web-apache-pgsql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -225,21 +221,22 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-nginx-pgsql: - image: zabbix/zabbix-web-nginx-pgsql:ol-trunk + image: "${ZABBIX_WEB_NGINX_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -249,8 +246,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -267,8 +264,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-ol-pgsql - - zabbix-web-nginx-pgsql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -279,23 +274,24 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:ol-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -306,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -314,21 +310,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:ol-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -338,21 +334,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:ol-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -360,7 +355,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -372,7 +368,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -383,19 +379,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:ol-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -405,21 +402,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -428,10 +424,11 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -445,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -470,15 +468,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -494,34 +493,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_ol_pgsql_local.yaml b/docker-compose_v3_ol_pgsql_local.yaml index b7224f312..69fdf7afe 100644 --- a/docker-compose_v3_ol_pgsql_local.yaml +++ b/docker-compose_v3_ol_pgsql_local.yaml @@ -1,31 +1,31 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/ol + context: ./Dockerfiles/build-base/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim - image: zabbix-build-base:ol-local + - "${OL_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-pgsql: build: - context: ./Dockerfiles/build-pgsql/ol + context: ./Dockerfiles/build-pgsql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ol-local - image: zabbix-build-pgsql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/ol + context: ./Dockerfiles/build-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ol-local - image: zabbix-build-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -33,12 +33,12 @@ services: zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/ol + context: ./Dockerfiles/build-sqlite3/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ol-local - image: zabbix-build-sqlite3:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -46,30 +46,31 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-pgsql/ol + context: ./Dockerfiles/server-pgsql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-server-pgsql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-pgsql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -84,8 +85,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -97,8 +98,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-ol-pgsql - - zabbix-server-pgsql-ol zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -113,29 +112,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/ol + context: ./Dockerfiles/proxy-sqlite3/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local - image: zabbix-proxy-sqlite3:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -151,8 +151,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -161,8 +161,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ol-sqlite3 - - zabbix-proxy-sqlite3-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -170,29 +168,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/ol + context: ./Dockerfiles/proxy-mysql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local - image: zabbix-proxy-mysql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone: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 + - /etc/timezone:/etc/timezone:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -208,9 +207,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -225,8 +224,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ol-mysql - - zabbix-proxy-mysql-ol zbx_net_frontend: stop_grace_period: 30s labels: @@ -234,29 +231,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-apache-pgsql: build: - context: ./Dockerfiles/web-apache-pgsql/ol + context: ./Dockerfiles/web-apache-pgsql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-web-apache-pgsql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-pgsql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -266,8 +264,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -285,8 +283,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-ol-pgsql - - zabbix-web-apache-pgsql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -297,27 +293,28 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-nginx-pgsql: build: - context: ./Dockerfiles/web-nginx-pgsql/ol + context: ./Dockerfiles/web-nginx-pgsql/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-web-nginx-pgsql:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-pgsql:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -327,8 +324,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -346,8 +343,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-ol-pgsql - - zabbix-web-nginx-pgsql-ol zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -358,29 +353,30 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/ol + context: ./Dockerfiles/agent/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-agent:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -391,7 +387,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -401,27 +397,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/ol + context: ./Dockerfiles/java-gateway/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-java-gateway:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -431,27 +427,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/ol + context: ./Dockerfiles/snmptraps/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim - image: zabbix-snmptraps:ol-local + - "${OL_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -459,7 +454,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -471,7 +467,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -482,25 +478,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/ol + context: ./Dockerfiles/web-service/${OL_OS_TAG_SHORT} cache_from: - - oraclelinux:9-slim + - "${OL_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local - image: zabbix-web-service:ol-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -510,23 +507,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ol stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "oracle linux" + com.zabbix.os: "${OL_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -535,10 +531,16 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 +# Use TLS encryption for connections to database +# - --require-secure-transport +# - --ssl-ca=/run/secrets/root-ca.pem +# - --ssl-cert=/run/secrets/server-cert.pem +# - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -552,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -577,15 +580,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -601,34 +605,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_ubuntu_mysql_latest.yaml b/docker-compose_v3_ubuntu_mysql_latest.yaml index b60c27bf8..5f46254be 100644 --- a/docker-compose_v3_ubuntu_mysql_latest.yaml +++ b/docker-compose_v3_ubuntu_mysql_latest.yaml @@ -1,21 +1,22 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:ubuntu-trunk + image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -31,8 +32,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -48,8 +49,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-ubuntu-mysql - - zabbix-server-mysql-ubuntu zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -64,22 +63,23 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:ubuntu-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -95,8 +95,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -104,8 +104,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ubuntu-sqlite3 - - zabbix-proxy-sqlite3-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -113,23 +111,24 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:ubuntu-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -145,11 +144,13 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server + - zabbix-java-gateway + - zabbix-snmptraps secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -162,8 +163,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ubuntu-mysql - - zabbix-proxy-mysql-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -171,20 +170,21 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-apache-mysql: - image: zabbix/zabbix-web-apache-mysql:ubuntu-trunk + image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -194,8 +194,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -215,8 +215,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-ubuntu-mysql - - zabbix-web-apache-mysql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -227,18 +225,19 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-nginx-mysql: - image: zabbix/zabbix-web-nginx-mysql:ubuntu-trunk + image: "${ZABBIX_WEB_NGINX_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -248,8 +247,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -269,8 +268,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-ubuntu-mysql - - zabbix-web-nginx-mysql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -281,22 +278,23 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:ubuntu-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -307,7 +305,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -315,21 +313,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:ubuntu-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -339,21 +337,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:ubuntu-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -361,7 +358,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -373,7 +371,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -384,19 +382,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:ubuntu-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -406,21 +405,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -432,11 +430,12 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -455,10 +454,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -474,20 +474,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -495,20 +495,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_ubuntu_mysql_local.yaml b/docker-compose_v3_ubuntu_mysql_local.yaml index 1c8ef9e09..bf2f57e6b 100644 --- a/docker-compose_v3_ubuntu_mysql_local.yaml +++ b/docker-compose_v3_ubuntu_mysql_local.yaml @@ -1,58 +1,59 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/ubuntu + context: ./Dockerfiles/build-base/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy - image: zabbix-build-base:ubuntu-local + - "${UBUNTU_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/ubuntu + context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local - image: zabbix-build-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/ubuntu + context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local - image: zabbix-build-sqlite3:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: - zabbix-build-base zabbix-server: - build: - context: ./Dockerfiles/server-mysql/ubuntu + build: + context: ./Dockerfiles/server-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-server-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-mysql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -68,8 +69,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -86,8 +87,6 @@ services: aliases: - zabbix-server - zabbix-server-mysql - - zabbix-server-ubuntu-mysql - - zabbix-server-mysql-ubuntu zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -102,28 +101,29 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/ubuntu + context: ./Dockerfiles/proxy-sqlite3/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:ubuntu-local - image: zabbix-proxy-sqlite3:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -139,8 +139,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -149,8 +149,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ubuntu-sqlite3 - - zabbix-proxy-sqlite3-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -158,29 +156,30 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/ubuntu + context: ./Dockerfiles/proxy-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-proxy-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -196,9 +195,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql depends_on: - mysql-server - zabbix-java-gateway @@ -216,8 +215,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ubuntu-mysql - - zabbix-proxy-mysql-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -225,26 +222,27 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-apache-mysql: build: - context: ./Dockerfiles/web-apache-mysql/ubuntu + context: ./Dockerfiles/web-apache-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-web-apache-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-mysql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -254,8 +252,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -276,8 +274,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-mysql - - zabbix-web-apache-ubuntu-mysql - - zabbix-web-apache-mysql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -288,24 +284,25 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-nginx-mysql: build: - context: ./Dockerfiles/web-nginx-mysql/ubuntu + context: ./Dockerfiles/web-nginx-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-web-nginx-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-mysql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro # - dbsocket:/var/run/mysqld/ - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro deploy: resources: limits: @@ -315,8 +312,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_mysql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -337,8 +334,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-mysql - - zabbix-web-nginx-ubuntu-mysql - - zabbix-web-nginx-mysql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -349,28 +344,29 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/ubuntu + context: ./Dockerfiles/agent/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-agent:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -381,7 +377,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -391,27 +387,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/ubuntu + context: ./Dockerfiles/java-gateway/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-java-gateway:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -421,27 +417,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/ubuntu + context: ./Dockerfiles/snmptraps/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy - image: zabbix-snmptraps:ubuntu-local + - "${UBUNTU_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -449,7 +444,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -461,7 +457,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -472,25 +468,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/ubuntu + context: ./Dockerfiles/web-service/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-web-service:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -500,23 +497,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-mysql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" command: - mysqld - --character-set-server=utf8mb4 @@ -528,11 +524,14 @@ services: # - --ssl-ca=/run/secrets/root-ca.pem # - --ssl-cert=/run/secrets/server-cert.pem # - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # - dbsocket:/var/run/mysqld/ env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql + ports: + - "3306:3306/tcp" secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -551,10 +550,11 @@ services: db_data_mysql: image: busybox volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -570,20 +570,20 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: @@ -591,20 +591,20 @@ volumes: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD # client-key.pem: -# file: ./env_vars/.ZBX_DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE # client-cert.pem: -# file: ./env_vars/.ZBX_DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE # root-ca.pem: -# file: ./env_vars/.ZBX_DB_CA_FILE +# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE # server-cert.pem: -# file: ./env_vars/.DB_CERT_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE # server-key.pem: -# file: ./env_vars/.DB_KEY_FILE +# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE diff --git a/docker-compose_v3_ubuntu_pgsql_latest.yaml b/docker-compose_v3_ubuntu_pgsql_latest.yaml index ed45f54fc..bb616ca6d 100644 --- a/docker-compose_v3_ubuntu_pgsql_latest.yaml +++ b/docker-compose_v3_ubuntu_pgsql_latest.yaml @@ -1,24 +1,25 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:ubuntu-trunk + image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -33,8 +34,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -45,8 +46,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-ubuntu-pgsql - - zabbix-server-pgsql-ubuntu zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -61,22 +60,23 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-sqlite3: - image: zabbix/zabbix-proxy-sqlite3:ubuntu-trunk + image: "${ZABBIX_PROXY_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -92,8 +92,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -101,8 +101,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ubuntu-sqlite3 - - zabbix-proxy-sqlite3-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -110,22 +108,23 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-mysql: - image: zabbix/zabbix-proxy-mysql:ubuntu-trunk + image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -141,9 +140,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -157,8 +156,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ubuntu-mysql - - zabbix-proxy-mysql-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -166,22 +163,23 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-apache-pgsql: - image: zabbix/zabbix-web-apache-pgsql:ubuntu-trunk + image: "${ZABBIX_WEB_APACHE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -191,8 +189,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -200,7 +198,7 @@ services: - postgres-server - zabbix-server healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/"] + test: ["CMD", "curl", "-f", "http://localhost:8080/ping"] interval: 10s timeout: 5s retries: 3 @@ -209,8 +207,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-ubuntu-pgsql - - zabbix-web-apache-pgsql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -221,20 +217,21 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-nginx-pgsql: - image: zabbix/zabbix-web-nginx-pgsql:ubuntu-trunk + image: "${ZABBIX_WEB_NGINX_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -244,8 +241,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -262,8 +259,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-ubuntu-pgsql - - zabbix-web-nginx-pgsql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -274,22 +269,23 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-agent: - image: zabbix/zabbix-agent:ubuntu-trunk + image: "${ZABBIX_AGENT_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -300,7 +296,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -308,21 +304,21 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-java-gateway: - image: zabbix/zabbix-java-gateway:ubuntu-trunk + image: "${ZABBIX_JAVA_GATEWAY_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -332,21 +328,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-snmptraps: - image: zabbix/zabbix-snmptraps:ubuntu-trunk + image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -354,7 +349,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -366,7 +362,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -377,19 +373,20 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-service: - image: zabbix/zabbix-web-service:ubuntu-trunk + image: "${ZABBIX_WEB_SERVICE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}" profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -399,21 +396,20 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -422,10 +418,11 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -439,15 +436,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -464,15 +462,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -488,34 +487,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD diff --git a/docker-compose_v3_ubuntu_pgsql_local.yaml b/docker-compose_v3_ubuntu_pgsql_local.yaml index efc26b668..606ecfced 100644 --- a/docker-compose_v3_ubuntu_pgsql_local.yaml +++ b/docker-compose_v3_ubuntu_pgsql_local.yaml @@ -1,31 +1,31 @@ -version: '3.5' +version: '3.8' services: zabbix-build-base: build: - context: ./Dockerfiles/build-base/ubuntu + context: ./Dockerfiles/build-base/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy - image: zabbix-build-base:ubuntu-local + - "${UBUNTU_CACHE_FROM}" + image: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} zabbix-build-pgsql: build: - context: ./Dockerfiles/build-pgsql/ubuntu + context: ./Dockerfiles/build-pgsql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local - image: zabbix-build-pgsql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} depends_on: - zabbix-build-base zabbix-build-mysql: build: - context: ./Dockerfiles/build-mysql/ubuntu + context: ./Dockerfiles/build-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local - image: zabbix-build-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -33,12 +33,12 @@ services: zabbix-build-sqlite3: build: - context: ./Dockerfiles/build-sqlite3/ubuntu + context: ./Dockerfiles/build-sqlite3/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-base:ubuntu-local - image: zabbix-build-sqlite3:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all depends_on: @@ -46,29 +46,30 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-pgsql/ubuntu + context: ./Dockerfiles/server-pgsql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-server-pgsql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-server-pgsql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true ports: - - "10051:10051" + - "${ZABBIX_SERVER_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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/dbscripts:/var/lib/zabbix/dbscripts:ro - - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - - ./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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro ulimits: nproc: 65535 nofile: @@ -83,8 +84,8 @@ services: cpus: '0.5' memory: 512M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_srv + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_srv secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -96,8 +97,6 @@ services: aliases: - zabbix-server - zabbix-server-pgsql - - zabbix-server-ubuntu-pgsql - - zabbix-server-pgsql-ubuntu zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -112,28 +111,29 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-server" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-sqlite3: build: - context: ./Dockerfiles/proxy-sqlite3/ubuntu + context: ./Dockerfiles/proxy-sqlite3/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-sqlite3:ubuntu-local - image: zabbix-proxy-sqlite3:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_SQLITE3_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-sqlite3:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10061:10051" + - "${ZABBIX_PROXY_SQLITE3_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -149,8 +149,8 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_prx - - ./env_vars/.env_prx_sqlite3 + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3 depends_on: - zabbix-java-gateway - zabbix-snmptraps @@ -159,8 +159,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-sqlite3 - - zabbix-proxy-ubuntu-sqlite3 - - zabbix-proxy-sqlite3-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -168,28 +166,29 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "sqlite3" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-proxy-mysql: build: - context: ./Dockerfiles/proxy-mysql/ubuntu + context: ./Dockerfiles/proxy-mysql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-mysql:ubuntu-local - image: zabbix-proxy-mysql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-proxy-mysql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - all ports: - - "10071:10051" + - "${ZABBIX_PROXY_MYSQL_PORT}:10051" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime: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 + - ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - snmptraps:/var/lib/zabbix/snmptraps:rw ulimits: nproc: 65535 @@ -205,9 +204,9 @@ services: cpus: '0.3' memory: 256M env_file: - - ./env_vars/.env_db_mysql_proxy - - ./env_vars/.env_prx - - ./env_vars/.env_prx_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy + - ${ENV_VARS_DIRECTORY}/.env_prx + - ${ENV_VARS_DIRECTORY}/.env_prx_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -222,8 +221,6 @@ services: zbx_net_backend: aliases: - zabbix-proxy-mysql - - zabbix-proxy-ubuntu-mysql - - zabbix-proxy-mysql-ubuntu zbx_net_frontend: stop_grace_period: 30s labels: @@ -231,28 +228,29 @@ services: com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-proxy" com.zabbix.dbtype: "mysql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-apache-pgsql: build: - context: ./Dockerfiles/web-apache-pgsql/ubuntu + context: ./Dockerfiles/web-apache-pgsql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-web-apache-pgsql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-apache-pgsql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - all ports: - - "8081:8080" - - "8443:8443" + - "${ZABBIX_WEB_APACHE_HTTP_PORT}:8080" + - "${ZABBIX_WEB_APACHE_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -262,8 +260,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -281,8 +279,6 @@ services: zbx_net_backend: aliases: - zabbix-web-apache-pgsql - - zabbix-web-apache-ubuntu-pgsql - - zabbix-web-apache-pgsql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -293,26 +289,27 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "apache2" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-nginx-pgsql: build: - context: ./Dockerfiles/web-nginx-pgsql/ubuntu + context: ./Dockerfiles/web-nginx-pgsql/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-web-nginx-pgsql:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-nginx-pgsql:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} ports: - - "80:8080" - - "443:8443" + - "${ZABBIX_WEB_NGINX_HTTP_PORT}:8080" + - "${ZABBIX_WEB_NGINX_HTTPS_PORT}:8443" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - - ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro -# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro -# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro -# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro + - ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro + - ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro +# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro deploy: resources: limits: @@ -322,8 +319,8 @@ services: cpus: '0.5' memory: 256M env_file: - - ./env_vars/.env_db_pgsql - - ./env_vars/.env_web + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_web secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -341,8 +338,6 @@ services: zbx_net_backend: aliases: - zabbix-web-nginx-pgsql - - zabbix-web-nginx-ubuntu-pgsql - - zabbix-web-nginx-pgsql-ubuntu zbx_net_frontend: stop_grace_period: 10s sysctls: @@ -353,28 +348,29 @@ services: com.zabbix.component: "zabbix-frontend" com.zabbix.webserver: "nginx" com.zabbix.dbtype: "pgsql" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-agent: build: - context: ./Dockerfiles/agent/ubuntu + context: ./Dockerfiles/agent/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-agent:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-agent:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} init: true profiles: - full - all ports: - - "10050:10050" + - "${ZABBIX_AGENT_PORT}:10050" + restart: "${RESTART_POLICY}" volumes: - /etc/localtime:/etc/localtime:ro - - ./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 + - ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro deploy: resources: limits: @@ -385,7 +381,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" depends_on: @@ -395,27 +391,27 @@ services: aliases: - zabbix-agent - zabbix-agent-passive - - zabbix-agent-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix agent" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "zabbix-agentd" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-java-gateway: build: - context: ./Dockerfiles/java-gateway/ubuntu + context: ./Dockerfiles/java-gateway/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-java-gateway:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-java-gateway:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10052:10052" + - "${ZABBIX_JAVA_GATEWAY_PORT}:10052" + restart: "${RESTART_POLICY}" deploy: resources: limits: @@ -425,27 +421,26 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_java + - ${ENV_VARS_DIRECTORY}/.env_java depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-java-gateway - - zabbix-java-gateway-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix Java Gateway" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "java-gateway" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-snmptraps: build: - context: ./Dockerfiles/snmptraps/ubuntu + context: ./Dockerfiles/snmptraps/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy - image: zabbix-snmptraps:ubuntu-local + - "${UBUNTU_CACHE_FROM}" + image: zabbix-snmptraps:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} # Override snmptrapd command arguments to receive SNMP traps by DNS # It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable # command: /usr/sbin/snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lo -A @@ -453,7 +448,8 @@ services: - full - all ports: - - "162:1162/udp" + - "${ZABBIX_SNMPTRAPS_PORT}:1162/udp" + restart: "${RESTART_POLICY}" volumes: - snmptraps:/var/lib/zabbix/snmptraps:rw deploy: @@ -465,7 +461,7 @@ services: cpus: '0.25' memory: 128M env_file: - - ./env_vars/.env_snmptraps + - ${ENV_VARS_DIRECTORY}/.env_snmptraps networks: zbx_net_frontend: aliases: @@ -476,25 +472,26 @@ services: com.zabbix.description: "Zabbix snmptraps" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "snmptraps" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" zabbix-web-service: build: - context: ./Dockerfiles/web-service/ubuntu + context: ./Dockerfiles/web-service/${UBUNTU_OS_TAG_SHORT} cache_from: - - ubuntu:jammy + - "${UBUNTU_CACHE_FROM}" args: - BUILD_BASE_IMAGE: zabbix-build-pgsql:ubuntu-local - image: zabbix-web-service:ubuntu-local + BUILD_BASE_IMAGE: ${BUILD_BASE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} + image: zabbix-web-service:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_LOCAL_IMAGE_TAG_POSTFIX} profiles: - full - all ports: - - "10053:10053" + - "${ZABBIX_WEB_SERVICE_PORT}:10053" + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro + - ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro security_opt: - - seccomp:./env_vars/chrome_dp.json + - seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json deploy: resources: limits: @@ -504,23 +501,22 @@ services: cpus: '0.25' memory: 256M env_file: - - ./env_vars/.env_web_service + - ${ENV_VARS_DIRECTORY}/.env_web_service depends_on: - zabbix-build-pgsql networks: zbx_net_backend: aliases: - zabbix-web-service - - zabbix-web-service-ubuntu stop_grace_period: 5s labels: com.zabbix.description: "Zabbix web service" com.zabbix.company: "Zabbix LLC" com.zabbix.component: "web-service" - com.zabbix.os: "ubuntu" + com.zabbix.os: "${UBUNTU_OS_TAG}" mysql-server: - image: mysql:8.0-oracle + image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}" profiles: - all command: @@ -529,10 +525,16 @@ services: - --collation-server=utf8mb4_bin # Only during upgrade from versions prior 6.4 # - --log_bin_trust_function_creators=1 +# Use TLS encryption for connections to database +# - --require-secure-transport +# - --ssl-ca=/run/secrets/root-ca.pem +# - --ssl-cert=/run/secrets/server-cert.pem +# - --ssl-key=/run/secrets/server-key.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw env_file: - - ./env_vars/.env_db_mysql + - ${ENV_VARS_DIRECTORY}/.env_db_mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -546,15 +548,16 @@ services: - mysql-database postgres-server: - image: postgres:16-alpine + image: "${POSTGRESQL_IMAGE}:${POSTGRESQL_IMAGE_TAG}" # command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem + restart: "${RESTART_POLICY}" volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro - - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro - - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro + - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro env_file: - - ./env_vars/.env_db_pgsql + - ${ENV_VARS_DIRECTORY}/.env_db_pgsql secrets: - POSTGRES_USER - POSTGRES_PASSWORD @@ -571,15 +574,16 @@ services: profiles: - all volumes: - - ./zbx_env/var/lib/mysql:/var/lib/mysql:rw + - ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw db_data_pgsql: image: busybox volumes: - - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw + - ${DATA_DIRECTORY}/var/lib/postgresql/data:/var/lib/postgresql/data:rw # elasticsearch: -# image: elasticsearch +# image: "${ELASTICSEARCH_IMAGE}:${ELASTICSEARCH_IMAGE_TAG}" +# restart: "${RESTART_POLICY}" # profiles: # - full # - all @@ -595,34 +599,34 @@ networks: zbx_net_frontend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${FRONTEND_ENABLE_IPV6}" ipam: - driver: default + driver: "${FRONTEND_NETWORK_DRIVER}" config: - - subnet: 172.16.238.0/24 + - subnet: "${FRONTEND_SUBNET}" zbx_net_backend: driver: bridge driver_opts: - com.docker.network.enable_ipv6: "false" + com.docker.network.enable_ipv6: "${BACKEND_ENABLE_IPV6}" internal: true ipam: - driver: default + driver: "${BACKEND_NETWORK_DRIVER}" config: - - subnet: 172.16.239.0/24 + - subnet: "${BACKEND_SUBNET}" volumes: snmptraps: secrets: MYSQL_USER: - file: ./env_vars/.MYSQL_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER MYSQL_PASSWORD: - file: ./env_vars/.MYSQL_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD MYSQL_ROOT_USER: - file: ./env_vars/.MYSQL_ROOT_USER + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER MYSQL_ROOT_PASSWORD: - file: ./env_vars/.MYSQL_ROOT_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD POSTGRES_USER: - file: ./env_vars/.POSTGRES_USER + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_USER POSTGRES_PASSWORD: - file: ./env_vars/.POSTGRES_PASSWORD + file: ${ENV_VARS_DIRECTORY}/.POSTGRES_PASSWORD