Use env variables in Zabbix web images

This commit is contained in:
Alexey Pustovalov
2020-09-11 02:49:29 -04:00
55 changed files with 867 additions and 1729 deletions

View File

@ -2,6 +2,8 @@
listen = /tmp/php-fpm.sock
clear_env = no
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
@ -16,10 +18,10 @@ php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[max_execution_time]= 300
php_value[memory_limit]= 128M
php_value[post_max_size]= 16M
php_value[upload_max_filesize]= 2M
php_value[max_input_time]= 300
php_value[max_input_vars]= 10000
; php_value[date.timezone]= Europe/Riga
php_value[max_execution_time] = ${ZBX_MAXEXECUTIONTIME}
php_value[memory_limit] = ${ZBX_MEMORYLIMIT}
php_value[post_max_size] = ${ZBX_POSTMAXSIZE}
php_value[upload_max_filesize] = ${ZBX_UPLOADMAXFILESIZE}
php_value[max_input_time] = ${ZBX_MAXINPUTTIME}
php_value[max_input_vars] = 10000
php_value[date.timezone] = ${PHP_TZ}

View File

@ -2,37 +2,49 @@
// Zabbix GUI configuration file.
global $DB, $HISTORY;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '{DB_SERVER_HOST}';
$DB['PORT'] = '{DB_SERVER_PORT}';
$DB['DATABASE'] = '{DB_SERVER_DBNAME}';
$DB['USER'] = '{DB_SERVER_USER}';
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
$DB['TYPE'] = getenv('DB_SERVER_TYPE');
$DB['SERVER'] = getenv('DB_SERVER_HOST');
$DB['PORT'] = getenv('DB_SERVER_PORT');
$DB['DATABASE'] = getenv('DB_SERVER_DBNAME');
$DB['USER'] = getenv('DB_SERVER_USER');
$DB['PASSWORD'] = getenv('DB_SERVER_PASS');
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
$DB['SCHEMA'] = getenv('DB_SERVER_SCHEMA');
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
$ZBX_SERVER_NAME = '{ZBX_SERVER_NAME}';
$ZBX_SERVER = getenv('ZBX_SERVER_HOST');
$ZBX_SERVER_PORT = getenv('ZBX_SERVER_PORT');
$ZBX_SERVER_NAME = getenv('ZBX_SERVER_NAME');
// Used for TLS connection.
$DB['ENCRYPTION'] = {ZBX_DB_ENCRYPTION};
$DB['KEY_FILE'] = '{ZBX_DB_KEY_FILE}';
$DB['CERT_FILE'] = '{ZBX_DB_CERT_FILE}';
$DB['CA_FILE'] = '{ZBX_DB_CA_FILE}';
$DB['VERIFY_HOST'] = {ZBX_DB_VERIFY_HOST};
$DB['CIPHER_LIST'] = '{ZBX_DB_CIPHER_LIST}';
$DB['ENCRYPTION'] = getenv('ZBX_DB_ENCRYPTION') == 'true' ? true: false;
$DB['KEY_FILE'] = getenv('ZBX_DB_KEY_FILE');
$DB['CERT_FILE'] = getenv('ZBX_DB_CERT_FILE');
$DB['CA_FILE'] = getenv('ZBX_DB_CA_FILE');
$DB['VERIFY_HOST'] = getenv('ZBX_DB_VERIFY_HOST') == 'true' ? true: false;
$DB['CIPHER_LIST'] = getenv('ZBX_DB_CIPHER_LIST') ? getenv('ZBX_DB_CIPHER_LIST') : '';
// Use IEEE754 compatible value range for 64-bit Numeric (float) history values.
// This option is enabled by default for new Zabbix installations.
// For upgraded installations, please read database upgrade notes before enabling this option.
$DB['DOUBLE_IEEE754'] = {DB_DOUBLE_IEEE754};
$DB['DOUBLE_IEEE754'] = getenv('DB_DOUBLE_IEEE754') == 'true' ? true: false;
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
// Elasticsearch url (can be string if same url is used for all types).
$HISTORY['url'] = '{ZBX_HISTORYSTORAGEURL}';
$history_url = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGEURL'));
$HISTORY['url'] = (json_decode($history_url)) ? json_decode($history_url) : $history_url;
// Value types stored in Elasticsearch.
$HISTORY['types'] = {ZBX_HISTORYSTORAGETYPES};
$storage_types = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGETYPES'));
$HISTORY['types'] = (json_decode($storage_types)) ? json_decode($storage_types) : array();
// Used for SAML authentication.
// Uncomment to override the default paths to SP private key, SP and IdP X.509 certificates, and to set extra settings.
$SSO['SP_KEY'] = file_exists('/etc/zabbix/web/certs/sp.key') ? '/etc/zabbix/web/certs/sp.key' : '';
$SSO['SP_CERT'] = file_exists('/etc/zabbix/web/certs/sp.crt') ? '/etc/zabbix/web/certs/sp.crt' : '';
$SSO['IDP_CERT'] = file_exists('/etc/zabbix/web/certs/idp.crt') ? '/etc/zabbix/web/certs/idp.crt' : '';
$sso_settings = str_replace("'","\"",getenv('ZBX_SSO_SETTINGS'));
$SSO['SETTINGS'] = (json_decode($sso_settings)) ? json_decode($sso_settings) : array();