mirror of
https://mirror.skon.top/github.com/zabbix/zabbix-docker
synced 2026-04-23 02:11:20 +08:00
Some checks failed
Build images (DockerHub) / Initialize build (push) Has been cancelled
Build images (DockerHub) / Build base on ${{ matrix.os }} (push) Has been cancelled
Build images (DockerHub) / Build ${{ matrix.build }} base on ${{ matrix.os }} (push) Has been cancelled
Build images (DockerHub) / Build ${{ matrix.build }} on ${{ matrix.os }} (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
SonarCloud analysis / Analysis (push) Has been cancelled
Build images (DockerHub, Windows) / Initialize build (push) Has been cancelled
Build images (DockerHub, Windows) / Build ${{ matrix.component }} base on ${{ matrix.os }} (push) Has been cancelled
Build images (DockerHub, Windows) / Build ${{ matrix.component }} sources on ${{ matrix.os }} (push) Has been cancelled
Build images (DockerHub, Windows) / Build ${{ matrix.component }} on ${{ matrix.os }} (push) Has been cancelled
77 lines
1.7 KiB
Bash
77 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
readonly ENTRYPOINT_LIBS="/usr/lib/docker-entrypoint"
|
|
source "${ENTRYPOINT_LIBS}/bootstrap.sh"
|
|
|
|
source "${ENTRYPOINT_LIBS}/pgsql.sh"
|
|
source "${ENTRYPOINT_LIBS}/php.sh"
|
|
source "${ENTRYPOINT_LIBS}/web.sh"
|
|
source "${ENTRYPOINT_LIBS}/apache.sh"
|
|
|
|
: "${ZBX_SERVER_NAME:=Zabbix docker}"
|
|
: "${PHP_TZ:=Europe/Riga}"
|
|
|
|
prepare_runtime_commands() {
|
|
APACHE_BIN="${APACHE_BIN:-/usr/sbin/httpd}"
|
|
PHP_FPM_BIN="${PHP_FPM_BIN:-/usr/sbin/php-fpm}"
|
|
PHP_FPM_CONFIG="${PHP_FPM_CONFIG:-/etc/php-fpm.conf}"
|
|
|
|
APACHE_ARGS=(-D FOREGROUND)
|
|
PHP_FPM_ARGS=(--nodaemonize --fpm-config "${PHP_FPM_CONFIG}")
|
|
}
|
|
|
|
start_web_stack() {
|
|
local php_pid=""
|
|
local web_pid=""
|
|
local exit_code=0
|
|
|
|
term_handler() {
|
|
[[ -n "$php_pid" ]] && kill "$php_pid" 2>/dev/null || true
|
|
[[ -n "$web_pid" ]] && kill "$web_pid" 2>/dev/null || true
|
|
[[ -n "$php_pid" ]] && wait "$php_pid" 2>/dev/null || true
|
|
[[ -n "$web_pid" ]] && wait "$web_pid" 2>/dev/null || true
|
|
}
|
|
|
|
trap term_handler TERM INT
|
|
|
|
"${PHP_FPM_BIN}" "${PHP_FPM_ARGS[@]}" &
|
|
php_pid=$!
|
|
|
|
"${APACHE_BIN}" "${APACHE_ARGS[@]}" &
|
|
web_pid=$!
|
|
|
|
if wait -n "$php_pid" "$web_pid"; then
|
|
exit_code=0
|
|
else
|
|
exit_code=$?
|
|
fi
|
|
|
|
term_handler
|
|
return "$exit_code"
|
|
}
|
|
|
|
prepare_service() {
|
|
info "** Preparing Zabbix web-interface (Apache) with PostgreSQL database"
|
|
|
|
check_db_variables "zabbix"
|
|
check_db_connect "true"
|
|
prepare_php_config "POSTGRESQL"
|
|
prepare_web_server
|
|
prepare_zbx_config
|
|
}
|
|
|
|
#################################################
|
|
|
|
if [ $# -eq 0 ]; then
|
|
prepare_service
|
|
prepare_runtime_commands
|
|
start_web_stack
|
|
exit $?
|
|
fi
|
|
|
|
exec "$@"
|
|
|
|
#################################################
|