Added init services for DB schema create only to compose file

This commit is contained in:
Alexey Pustovalov 2024-12-21 21:19:17 +09:00
parent 0cad94f31e
commit 850cde0309
9 changed files with 340 additions and 32 deletions

View File

@ -62,6 +62,54 @@ services:
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-server"
server-mysql-db-init:
init: true
attach: true
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
command: init_db_only
tmpfs: /tmp
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
database:
aliases:
- zabbix-server-mysql-init
labels:
com.zabbix.description: "Zabbix server with MySQL database support (database init)"
com.zabbix.dbtype: "mysql"
server-pgsql-db-init:
init: true
attach: true
# volumes:
# - ${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
command: init_db_only
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
networks:
database:
aliases:
- zabbix-server-pgsql-init
labels:
com.zabbix.description: "Zabbix server with PostgreSQL database support (database init)"
com.zabbix.dbtype: "pgsql"
server-mysql:
extends:
service: server
@ -171,6 +219,34 @@ services:
com.zabbix.description: "Zabbix proxy with SQLite3 database support"
com.zabbix.dbtype: "sqlite3"
proxy-mysql-db-init:
init: true
profiles:
- all
attach: true
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
command: init_db_only
tmpfs: /tmp
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
database:
aliases:
- zabbix-proxy-mysql-init
labels:
com.zabbix.description: "Zabbix proxy with MySQL database support (database init)"
com.zabbix.dbtype: "mysql"
proxy-mysql:
extends:
service: proxy

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-mysql-db-init
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-pgsql-db-init
image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
postgres-server:
condition: service_started
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-mysql-db-init
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-pgsql-db-init
image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
postgres-server:
condition: service_started
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_CENTOS_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${CENTOS_OS_TAG}"

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-mysql-db-init
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${OL_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${OL_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"

View File

@ -1,4 +1,30 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-pgsql-db-init
image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
postgres-server:
condition: service_started
labels:
com.zabbix.os: "${OL_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_OL_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${OL_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
@ -7,7 +33,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -29,7 +56,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -41,7 +69,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"
@ -53,7 +82,8 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${OL_OS_TAG}"

View File

@ -1,11 +1,34 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-mysql-db-init
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
service: server-mysql
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -23,7 +46,8 @@ services:
service: proxy-mysql
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -33,7 +57,8 @@ services:
service: web-apache-mysql
image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -43,7 +68,8 @@ services:
service: web-nginx-mysql
image: "${ZABBIX_WEB_NGINX_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- mysql-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"

View File

@ -1,11 +1,34 @@
services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-pgsql-db-init
image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
postgres-server:
condition: service_started
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
proxy-db-init:
extends:
file: compose_zabbix_components.yaml
service: proxy-mysql-db-init
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
service: server-pgsql
image: "${ZABBIX_SERVER_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -23,7 +46,8 @@ services:
service: proxy-mysql
image: "${ZABBIX_PROXY_MYSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- mysql-server
proxy-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -33,7 +57,8 @@ services:
service: web-apache-pgsql
image: "${ZABBIX_WEB_APACHE_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"
@ -43,7 +68,8 @@ services:
service: web-nginx-pgsql
image: "${ZABBIX_WEB_NGINX_PGSQL_IMAGE}:${ZABBIX_UBUNTU_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
depends_on:
- postgres-server
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${UBUNTU_OS_TAG}"