Add option to use implicit search path in postgres

This commit is contained in:
Alexey Pustovalov 2021-08-05 18:43:04 +02:00
commit b69d746993
25 changed files with 102 additions and 29 deletions

View File

@ -8,3 +8,4 @@ POSTGRES_PASSWORD_FILE=/run/secrets/POSTGRES_PASSWORD
POSTGRES_DB=zabbix
# DB_SERVER_SCHEMA=public
# ENABLE_TIMESCALEDB=true
# POSTGRES_USE_IMPLICIT_SEARCH_PATH=false

View File

@ -103,6 +103,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_LOADMODULE`
The variable is list of comma separated loadable Zabbix modules. It works with volume ``/var/lib/zabbix/modules``. The syntax of the variable is ``dummy1.so,dummy2.so``.

View File

@ -154,6 +154,8 @@ check_variables_postgresql() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect_postgresql() {
@ -174,7 +176,7 @@ check_db_connect_postgresql() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -213,7 +215,7 @@ psql_query() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -248,7 +250,7 @@ create_db_database_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -296,7 +298,7 @@ create_db_schema_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -103,6 +103,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_LOADMODULE`
The variable is list of comma separated loadable Zabbix modules. It works with volume ``/var/lib/zabbix/modules``. The syntax of the variable is ``dummy1.so,dummy2.so``.

View File

@ -154,6 +154,8 @@ check_variables_postgresql() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect_postgresql() {
@ -174,7 +176,7 @@ check_db_connect_postgresql() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -213,7 +215,7 @@ psql_query() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -248,7 +250,7 @@ create_db_database_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -296,7 +298,7 @@ create_db_schema_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -103,6 +103,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_LOADMODULE`
The variable is list of comma separated loadable Zabbix modules. It works with volume ``/var/lib/zabbix/modules``. The syntax of the variable is ``dummy1.so,dummy2.so``.

View File

@ -154,6 +154,8 @@ check_variables_postgresql() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect_postgresql() {
@ -174,7 +176,7 @@ check_db_connect_postgresql() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -213,7 +215,7 @@ psql_query() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -248,7 +250,7 @@ create_db_database_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -296,7 +298,7 @@ create_db_schema_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -103,6 +103,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_LOADMODULE`
The variable is list of comma separated loadable Zabbix modules. It works with volume ``/var/lib/zabbix/modules``. The syntax of the variable is ``dummy1.so,dummy2.so``.

View File

@ -154,6 +154,8 @@ check_variables_postgresql() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect_postgresql() {
@ -174,7 +176,7 @@ check_db_connect_postgresql() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -213,7 +215,7 @@ psql_query() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -248,7 +250,7 @@ create_db_database_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi
@ -296,7 +298,7 @@ create_db_schema_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -104,7 +106,7 @@ check_db_connect() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -104,7 +106,7 @@ check_db_connect() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -104,7 +106,7 @@ check_db_connect() {
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -103,8 +105,8 @@ check_db_connect() {
fi
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -103,8 +105,8 @@ check_db_connect() {
fi
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -103,8 +105,8 @@ check_db_connect() {
fi
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -103,8 +105,8 @@ check_db_connect() {
fi
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi

View File

@ -120,6 +120,10 @@ By default, values for `POSTGRES_USER` and `POSTGRES_PASSWORD` are `zabbix`, `za
The variable is Zabbix database name. By default, value is `zabbix`.
### `POSTGRES_USE_IMPLICIT_SEARCH_PATH`
In some setups, for example including [PgBouncer](https://www.pgbouncer.org), setting the `search_path` via connection parameters fails. If this variable is set to `"true"`, the image skips setting the `search_path` and trusts that the `search_path` of the Zabbix user is setup correctly in PostgreSQL database.
### `ZBX_HISTORYSTORAGEURL`
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.

View File

@ -75,6 +75,8 @@ check_variables() {
: ${DB_SERVER_SCHEMA:="public"}
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
}
check_db_connect() {
@ -103,8 +105,8 @@ check_db_connect() {
fi
WAIT_TIMEOUT=5
if [ -n "${DB_SERVER_SCHEMA}" ]; then
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
export PGOPTIONS
fi