mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-11-25 01:04:01 +01:00
Added variable for root user. Removed DB root from web images
This commit is contained in:
parent
7e626287a9
commit
585593e8a8
@ -148,6 +148,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -162,7 +163,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -148,6 +148,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -162,7 +163,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -148,6 +148,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -162,7 +163,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -148,6 +148,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -162,7 +163,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -148,6 +148,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -162,7 +163,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -143,6 +143,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -157,7 +158,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -143,6 +143,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -157,7 +158,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -143,6 +143,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -157,7 +158,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -143,6 +143,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -157,7 +158,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -143,6 +143,7 @@ check_variables_mysql() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
file_env MYSQL_ROOT_USER
|
||||
file_env MYSQL_ROOT_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
@ -157,7 +158,7 @@ check_variables_mysql() {
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_USER=${MYSQL_ROOT_USER:-"root"}
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_PASS} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -116,8 +116,6 @@ printf "zabbix" | docker secret create MYSQL_PASSWORD -
|
||||
docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql:tag
|
||||
```
|
||||
|
||||
This method is also applicable for `MYSQL_ROOT_PASSWORD` with `MYSQL_ROOT_PASSWORD_FILE`.
|
||||
|
||||
By default, values for `MYSQL_USER` and `MYSQL_PASSWORD` are `zabbix`, `zabbix`.
|
||||
|
||||
### `MYSQL_DATABASE`
|
||||
|
@ -59,32 +59,10 @@ file_env() {
|
||||
check_variables() {
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
fi
|
||||
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -119,10 +97,6 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -132,9 +106,9 @@ check_db_connect() {
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -62,10 +62,6 @@ check_variables() {
|
||||
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
@ -84,20 +80,11 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
fi
|
||||
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
|
||||
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
echo "********************"
|
||||
|
||||
if [ "${USE_DB_ROOT_USER}" != "true" ]; then
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ZBX_USER}
|
||||
DB_SERVER_ROOT_PASS=${DB_SERVER_ZBX_PASS}
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
@ -116,7 +103,7 @@ check_db_connect() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
@ -34,6 +34,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -151,6 +152,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -487,6 +489,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -71,6 +71,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -203,6 +204,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -583,6 +585,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -146,6 +146,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -506,6 +507,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_var/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -210,6 +210,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -613,6 +614,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -34,6 +34,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -151,6 +152,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -486,6 +488,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -71,6 +71,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -203,6 +204,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -580,6 +582,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -146,6 +146,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -505,6 +506,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -210,6 +210,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -612,6 +613,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -34,6 +34,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -151,6 +152,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -486,6 +488,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -71,6 +71,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -203,6 +204,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -580,6 +582,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -146,6 +146,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -505,6 +506,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -210,6 +210,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -612,6 +613,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -33,6 +33,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -146,6 +147,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -478,6 +480,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -70,6 +70,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -200,6 +201,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
# - client-key.pem
|
||||
# - client-cert.pem
|
||||
@ -574,6 +576,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
# client-key.pem:
|
||||
|
@ -143,6 +143,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -499,6 +500,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
@ -207,6 +207,7 @@ services:
|
||||
secrets:
|
||||
- MYSQL_USER
|
||||
- MYSQL_PASSWORD
|
||||
- MYSQL_ROOT_USER
|
||||
- MYSQL_ROOT_PASSWORD
|
||||
depends_on:
|
||||
- mysql-server
|
||||
@ -606,6 +607,8 @@ secrets:
|
||||
file: ./env_vars/.MYSQL_USER
|
||||
MYSQL_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_PASSWORD
|
||||
MYSQL_ROOT_USER:
|
||||
file: ./env_vars/.MYSQL_ROOT_USER
|
||||
MYSQL_ROOT_PASSWORD:
|
||||
file: ./env_vars/.MYSQL_ROOT_PASSWORD
|
||||
POSTGRES_USER:
|
||||
|
1
env_vars/.MYSQL_ROOT_USER
Normal file
1
env_vars/.MYSQL_ROOT_USER
Normal file
@ -0,0 +1 @@
|
||||
root
|
Loading…
Reference in New Issue
Block a user