diff --git a/.env b/.env new file mode 100644 index 000000000..f132b48d8 --- /dev/null +++ b/.env @@ -0,0 +1,82 @@ +# Zabbix images +ZABBIX_ALPINE_IMAGE_TAG=alpine-6.4 +ZABBIX_CENTOS_IMAGE_TAG=centos-6.4 +ZABBIX_OL_IMAGE_TAG=ol-6.4 +ZABBIX_UBUNTU_IMAGE_TAG=ubuntu-6.4 +ZABBIX_IMAGE_TAG_POSTFIX=-latest +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=15-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.17 +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 905a79de1..286fcccfa 100644 --- a/docker-compose_v3_alpine_mysql_latest.yaml +++ b/docker-compose_v3_alpine_mysql_latest.yaml @@ -1,21 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:alpine-6.4-latest + 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 @@ -31,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 @@ -48,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" @@ -64,22 +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-6.4-latest + 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 @@ -95,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 @@ -104,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: @@ -113,23 +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-6.4-latest + 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 @@ -145,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 @@ -164,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: @@ -173,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-6.4-latest + 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: @@ -197,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 @@ -218,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: @@ -230,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-6.4-latest + 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: @@ -252,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 @@ -273,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: @@ -285,22 +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-6.4-latest + 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: @@ -311,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -319,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-6.4-latest + 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: @@ -343,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-6.4-latest + 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 @@ -365,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: @@ -377,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: @@ -388,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-6.4-latest + 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: @@ -410,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 @@ -436,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 @@ -459,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 @@ -478,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: @@ -499,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 a2a6ab79b..3ecc2619a 100644 --- a/docker-compose_v3_alpine_mysql_local.yaml +++ b/docker-compose_v3_alpine_mysql_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.17 - 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.17 + - "${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.17 + - "${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: @@ -33,26 +33,28 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-mysql/alpine + context: ./Dockerfiles/server-mysql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.17 + - "${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,28 +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.17 + - "${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 @@ -139,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 @@ -149,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: @@ -158,29 +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.17 + - "${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 @@ -196,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 @@ -216,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: @@ -225,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.17 + - "${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: @@ -255,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 @@ -277,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: @@ -289,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.17 + - "${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: @@ -317,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 @@ -339,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: @@ -351,28 +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.17 + - "${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: @@ -383,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: @@ -393,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.17 + - "${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: @@ -423,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.17 - 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 @@ -451,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: @@ -463,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: @@ -474,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.17 + - "${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: @@ -502,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 @@ -530,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 @@ -553,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 @@ -572,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: @@ -593,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 f4154900b..e6b7d8f92 100644 --- a/docker-compose_v3_alpine_pgsql_latest.yaml +++ b/docker-compose_v3_alpine_pgsql_latest.yaml @@ -1,24 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:alpine-6.4-latest + 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: @@ -33,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 @@ -45,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" @@ -61,22 +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-6.4-latest + 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 @@ -92,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 @@ -101,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: @@ -110,22 +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-6.4-latest + 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 @@ -141,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 @@ -157,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: @@ -166,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-6.4-latest + 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: @@ -192,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 @@ -210,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: @@ -222,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-6.4-latest + 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: @@ -246,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 @@ -264,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: @@ -276,22 +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-6.4-latest + 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: @@ -302,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -310,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-6.4-latest + 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: @@ -334,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-6.4-latest + 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 @@ -356,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: @@ -368,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: @@ -379,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-6.4-latest + 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: @@ -401,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: @@ -424,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 @@ -441,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -466,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 @@ -490,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 33ac93c8d..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.17 - 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.17 + - "${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.17 + - "${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.17 + - "${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,29 +46,31 @@ services: zabbix-server: build: - context: ./Dockerfiles/server-pgsql/alpine + context: ./Dockerfiles/server-pgsql/${ALPINE_OS_TAG_SHORT} cache_from: - - alpine:3.17 + - "${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: @@ -83,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 @@ -96,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" @@ -112,28 +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.17 + - "${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 @@ -149,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 @@ -159,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: @@ -168,28 +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.17 + - "${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 @@ -205,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 @@ -222,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: @@ -231,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.17 + - "${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: @@ -263,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 @@ -282,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: @@ -294,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.17 + - "${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: @@ -324,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 @@ -343,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: @@ -355,28 +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.17 + - "${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: @@ -387,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: @@ -397,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.17 + - "${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: @@ -427,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.17 - 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 @@ -455,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: @@ -467,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: @@ -478,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.17 + - "${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: @@ -506,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: @@ -531,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 @@ -548,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -573,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 @@ -597,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 aeb19c295..12775a87a 100644 --- a/docker-compose_v3_centos_mysql_latest.yaml +++ b/docker-compose_v3_centos_mysql_latest.yaml @@ -1,21 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:centos-6.4-latest + 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 @@ -31,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 @@ -48,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" @@ -64,22 +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-6.4-latest + 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 @@ -95,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 @@ -104,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: @@ -113,23 +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-6.4-latest + 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 @@ -145,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 @@ -164,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: @@ -173,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-6.4-latest + 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: @@ -197,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 @@ -218,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: @@ -230,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-6.4-latest + 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: @@ -252,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 @@ -273,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: @@ -285,22 +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-6.4-latest + 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: @@ -311,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -319,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-6.4-latest + 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: @@ -343,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-6.4-latest + 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 @@ -365,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: @@ -377,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: @@ -388,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-6.4-latest + 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: @@ -410,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 @@ -436,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 @@ -459,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 @@ -478,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: @@ -499,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 bcca7d199..a05956f39 100644 --- a/docker-compose_v3_centos_mysql_local.yaml +++ b/docker-compose_v3_centos_mysql_local.yaml @@ -1,58 +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 @@ -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-centos-mysql - - zabbix-server-mysql-centos zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -102,28 +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 @@ -139,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 @@ -149,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: @@ -158,29 +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 @@ -196,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 @@ -216,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: @@ -225,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: @@ -255,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 @@ -277,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: @@ -289,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: @@ -317,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 @@ -339,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: @@ -351,28 +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: @@ -383,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: @@ -423,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 @@ -451,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: @@ -463,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: @@ -474,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: @@ -502,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 @@ -530,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 @@ -553,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 @@ -572,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: @@ -593,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 6ffa12e72..c6b90cecb 100644 --- a/docker-compose_v3_centos_pgsql_latest.yaml +++ b/docker-compose_v3_centos_pgsql_latest.yaml @@ -1,24 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:centos-6.4-latest + 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: @@ -33,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 @@ -45,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" @@ -61,22 +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-6.4-latest + 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 @@ -92,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 @@ -101,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: @@ -110,22 +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-6.4-latest + 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 @@ -141,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 @@ -157,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: @@ -166,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-6.4-latest + 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: @@ -192,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 @@ -210,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: @@ -222,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-6.4-latest + 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: @@ -246,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 @@ -264,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: @@ -276,22 +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-6.4-latest + 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: @@ -302,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -310,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-6.4-latest + 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: @@ -334,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-6.4-latest + 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 @@ -356,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: @@ -368,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: @@ -379,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-6.4-latest + 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: @@ -401,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: @@ -424,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 @@ -441,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -466,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 @@ -490,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 2bd5ff122..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,29 +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: @@ -83,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 @@ -96,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" @@ -112,28 +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 @@ -149,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: @@ -168,28 +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 @@ -205,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 @@ -222,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: @@ -231,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: @@ -263,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 @@ -282,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: @@ -294,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: @@ -324,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 @@ -343,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: @@ -355,28 +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: @@ -387,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: @@ -397,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: @@ -427,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 @@ -455,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: @@ -467,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: @@ -478,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: @@ -506,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: @@ -531,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 @@ -548,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -573,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 @@ -597,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 51e96252e..f4c20dd0c 100644 --- a/docker-compose_v3_ol_mysql_latest.yaml +++ b/docker-compose_v3_ol_mysql_latest.yaml @@ -1,21 +1,23 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:ol-6.4-latest + 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 @@ -31,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 @@ -48,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" @@ -64,22 +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-6.4-latest + 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 @@ -95,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 @@ -104,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: @@ -113,23 +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-6.4-latest + 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 @@ -145,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 @@ -164,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: @@ -173,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-6.4-latest + 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: @@ -197,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 @@ -218,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: @@ -230,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-6.4-latest + 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: @@ -252,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 @@ -273,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: @@ -285,22 +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-6.4-latest + 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: @@ -311,7 +311,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -319,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-6.4-latest + 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: @@ -343,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-6.4-latest + 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 @@ -365,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: @@ -377,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: @@ -388,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-6.4-latest + 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: @@ -410,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 @@ -436,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 @@ -459,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 @@ -478,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: @@ -499,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 30ff1d052..74e9496a6 100644 --- a/docker-compose_v3_ol_mysql_local.yaml +++ b/docker-compose_v3_ol_mysql_local.yaml @@ -1,58 +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 @@ -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-ol-mysql - - zabbix-server-mysql-ol zbx_net_frontend: # devices: # - "/dev/ttyUSB0:/dev/ttyUSB0" @@ -102,28 +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 @@ -139,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 @@ -149,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: @@ -158,29 +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 @@ -196,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 @@ -216,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: @@ -225,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: @@ -255,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 @@ -277,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: @@ -289,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: @@ -317,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 @@ -339,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: @@ -351,28 +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: @@ -383,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: @@ -393,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: @@ -423,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 @@ -451,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: @@ -463,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: @@ -474,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: @@ -502,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 @@ -530,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 @@ -553,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 @@ -572,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: @@ -593,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 1eb7957b5..2df0340eb 100644 --- a/docker-compose_v3_ol_pgsql_latest.yaml +++ b/docker-compose_v3_ol_pgsql_latest.yaml @@ -1,24 +1,26 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:ol-6.4-latest + 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: @@ -33,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 @@ -45,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" @@ -61,22 +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-6.4-latest + 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 @@ -92,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 @@ -101,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: @@ -110,22 +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-6.4-latest + 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 @@ -141,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 @@ -157,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: @@ -166,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-6.4-latest + 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: @@ -192,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 @@ -210,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: @@ -222,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-6.4-latest + 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: @@ -246,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 @@ -264,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: @@ -276,22 +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-6.4-latest + 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: @@ -302,7 +302,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -310,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-6.4-latest + 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: @@ -334,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-6.4-latest + 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 @@ -356,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: @@ -368,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: @@ -379,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-6.4-latest + 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: @@ -401,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: @@ -424,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 @@ -441,15 +442,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -466,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 @@ -490,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 52bde38bc..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,29 +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: @@ -83,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 @@ -96,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" @@ -112,28 +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 @@ -149,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 @@ -159,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: @@ -168,28 +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 @@ -205,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 @@ -222,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: @@ -231,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: @@ -263,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 @@ -282,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: @@ -294,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: @@ -324,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 @@ -343,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: @@ -355,28 +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: @@ -387,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: @@ -397,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: @@ -427,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 @@ -455,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: @@ -467,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: @@ -478,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: @@ -506,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: @@ -531,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 @@ -548,15 +554,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -573,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 @@ -597,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 242cc9c21..5f46254be 100644 --- a/docker-compose_v3_ubuntu_mysql_latest.yaml +++ b/docker-compose_v3_ubuntu_mysql_latest.yaml @@ -1,20 +1,22 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-mysql:ubuntu-6.4-latest + 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 @@ -30,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 @@ -47,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" @@ -63,21 +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-6.4-latest + 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 @@ -93,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 @@ -102,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: @@ -111,22 +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-6.4-latest + 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 @@ -142,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 @@ -159,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: @@ -168,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-6.4-latest + 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: @@ -191,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 @@ -212,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: @@ -224,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-6.4-latest + 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: @@ -245,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 @@ -266,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: @@ -278,21 +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-6.4-latest + 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: @@ -303,7 +305,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -311,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-6.4-latest + 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: @@ -335,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-6.4-latest + 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 @@ -357,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: @@ -369,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: @@ -380,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-6.4-latest + 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: @@ -402,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 @@ -428,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 @@ -451,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 @@ -470,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: @@ -491,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 d84bf6377..bf2f57e6b 100644 --- a/docker-compose_v3_ubuntu_mysql_local.yaml +++ b/docker-compose_v3_ubuntu_mysql_local.yaml @@ -1,57 +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 @@ -67,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 @@ -85,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" @@ -101,27 +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 @@ -137,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 @@ -147,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: @@ -156,28 +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 @@ -193,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 @@ -213,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: @@ -222,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: @@ -251,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 @@ -273,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: @@ -285,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: @@ -312,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 @@ -334,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: @@ -346,27 +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: @@ -377,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: @@ -387,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: @@ -417,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 @@ -445,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: @@ -457,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: @@ -468,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: @@ -496,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 @@ -524,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 @@ -547,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 @@ -566,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: @@ -587,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 e24727781..bb616ca6d 100644 --- a/docker-compose_v3_ubuntu_pgsql_latest.yaml +++ b/docker-compose_v3_ubuntu_pgsql_latest.yaml @@ -1,23 +1,25 @@ -version: '3.5' +version: '3.8' services: zabbix-server: - image: zabbix/zabbix-server-pgsql:ubuntu-6.4-latest + 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: @@ -32,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 @@ -44,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" @@ -60,21 +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-6.4-latest + 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 @@ -90,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 @@ -99,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: @@ -108,21 +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-6.4-latest + 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 @@ -138,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 @@ -154,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: @@ -163,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-6.4-latest + 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: @@ -188,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 @@ -197,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 @@ -206,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: @@ -218,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-6.4-latest + 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: @@ -241,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 @@ -259,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: @@ -271,21 +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-6.4-latest + 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: @@ -296,7 +296,7 @@ services: memory: 64M mode: global env_file: - - ./env_vars/.env_agent + - ${ENV_VARS_DIRECTORY}/.env_agent privileged: true pid: "host" networks: @@ -304,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-6.4-latest + 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: @@ -328,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-6.4-latest + 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 @@ -350,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: @@ -362,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: @@ -373,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-6.4-latest + 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: @@ -395,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: @@ -418,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 @@ -435,15 +436,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -460,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 @@ -484,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 a7b8f9157..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,28 +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: @@ -82,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 @@ -95,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" @@ -111,27 +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 @@ -147,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 @@ -157,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: @@ -166,27 +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 @@ -202,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 @@ -219,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: @@ -228,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: @@ -259,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 @@ -278,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: @@ -290,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: @@ -319,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 @@ -338,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: @@ -350,27 +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: @@ -381,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: @@ -391,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: @@ -421,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 @@ -449,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: @@ -461,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: @@ -472,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: @@ -500,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: @@ -525,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 @@ -542,15 +548,16 @@ services: - mysql-database postgres-server: - image: postgres:15-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 @@ -567,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 @@ -591,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