mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-09 08:35:05 +02:00
Added Oracle Linux 8 images instead of CentOS 8
This commit is contained in:
1
web-apache-mysql/ol/.dockerignore
Normal file
1
web-apache-mysql/ol/.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
build.sh
|
120
web-apache-mysql/ol/Dockerfile
Normal file
120
web-apache-mysql/ol/Dockerfile
Normal file
@ -0,0 +1,120 @@
|
||||
FROM oraclelinux:8-slim
|
||||
|
||||
LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
org.opencontainers.image.vendor="Zabbix LLC" \
|
||||
org.opencontainers.image.url="https://zabbix.com/" \
|
||||
org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \
|
||||
org.opencontainers.image.licenses="GPL v2.0"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"]
|
||||
|
||||
RUN set -eux && \
|
||||
groupadd --system --gid 1995 zabbix && \
|
||||
useradd \
|
||||
--system --comment "Zabbix monitoring system" \
|
||||
-g zabbix -G root \
|
||||
--uid 1997 \
|
||||
--shell /sbin/nologin \
|
||||
--home-dir /var/lib/zabbix/ \
|
||||
zabbix && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /etc/zabbix/web && \
|
||||
mkdir -p /etc/zabbix/web/certs && \
|
||||
microdnf -y module enable mysql && \
|
||||
microdnf -y module enable php:7.4 && \
|
||||
INSTALL_PKGS="dejavu-sans-fonts \
|
||||
curl \
|
||||
httpd \
|
||||
mysql \
|
||||
mod_ssl \
|
||||
php \
|
||||
php-fpm \
|
||||
php-bcmath \
|
||||
php-gd \
|
||||
php-ldap \
|
||||
php-mbstring \
|
||||
php-mysqlnd \
|
||||
php-json \
|
||||
php-xml \
|
||||
supervisor" && \
|
||||
microdnf -y install --setopt=install_weak_deps=0 --best \
|
||||
--nodocs ${INSTALL_PKGS} && \
|
||||
rm -f "/etc/httpd/conf.d/default.conf" && \
|
||||
rm -f "/etc/httpd/conf.d/ssl.conf" && \
|
||||
rm -f /etc/php-fpm.d/www.conf && \
|
||||
sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
|
||||
"/etc/httpd/conf/httpd.conf" && \
|
||||
sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \
|
||||
microdnf -y clean all && \
|
||||
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
|
||||
rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki
|
||||
|
||||
ARG MAJOR_VERSION=5.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.12
|
||||
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
||||
|
||||
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
|
||||
|
||||
LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="${ZBX_SOURCES}"
|
||||
|
||||
COPY ["conf/etc/", "/etc/"]
|
||||
|
||||
RUN set -eux && \
|
||||
REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \
|
||||
INSTALL_PKGS="glibc-locale-source \
|
||||
gettext \
|
||||
findutils \
|
||||
git" && \
|
||||
microdnf -y install --setopt=install_weak_deps=0 --best \
|
||||
--nodocs dnf && \
|
||||
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
|
||||
--setopt=tsflags=nodocs ${INSTALL_PKGS} && \
|
||||
cd /usr/share/ && \
|
||||
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \
|
||||
mkdir /usr/share/zabbix/ && \
|
||||
cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \
|
||||
rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \
|
||||
cd /usr/share/zabbix/ && \
|
||||
./locale/make_mo.sh && \
|
||||
rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \
|
||||
rm -rf tests && \
|
||||
rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \
|
||||
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
|
||||
ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \
|
||||
cat /usr/share/zabbix/include/locales.inc.php | grep display | grep true | awk '{$1=$1};1' | \
|
||||
cut -d"'" -f 2 | sort | \
|
||||
xargs -I '{}' bash -c 'echo "{}" && localedef -c -i {} -f UTF-8 {}.UTF-8 2>/dev/null' && \
|
||||
chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/modules/ && \
|
||||
chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/modules/ && \
|
||||
chmod -R g=u /etc/zabbix/ /usr/share/zabbix/modules/ && \
|
||||
chown --quiet -R zabbix:root /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \
|
||||
chgrp -R 0 /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \
|
||||
chmod -R g=u /etc/httpd/ /etc/php-fpm.d/ /etc/php-fpm.conf && \
|
||||
chown --quiet -R zabbix:root /run/httpd/ /var/lib/php/session/ && \
|
||||
chgrp -R 0 /run/httpd/ /var/lib/php/session/ && \
|
||||
chmod -R g=u /run/httpd/ /var/lib/php/session/ && \
|
||||
chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \
|
||||
chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \
|
||||
chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \
|
||||
dnf -y history undo last && \
|
||||
dnf -y clean all && \
|
||||
microdnf -y remove dnf && \
|
||||
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
|
||||
rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki
|
||||
|
||||
EXPOSE 8080/TCP 8443/TCP
|
||||
|
||||
WORKDIR /usr/share/zabbix
|
||||
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
USER 1997
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
275
web-apache-mysql/ol/README.md
Normal file
275
web-apache-mysql/ol/README.md
Normal file
@ -0,0 +1,275 @@
|
||||

|
||||
|
||||
# What is Zabbix?
|
||||
|
||||
Zabbix is an enterprise-class open source distributed monitoring solution.
|
||||
|
||||
Zabbix is software that monitors numerous parameters of a network and the health and integrity of servers. Zabbix uses a flexible notification mechanism that allows users to configure e-mail based alerts for virtually any event. This allows a fast reaction to server problems. Zabbix offers excellent reporting and data visualisation features based on the stored data. This makes Zabbix ideal for capacity planning.
|
||||
|
||||
For more information and related downloads for Zabbix components, please visit https://hub.docker.com/u/zabbix/ and https://zabbix.com
|
||||
|
||||
# What is Zabbix web interface?
|
||||
|
||||
Zabbix web interface is a part of Zabbix software. It is used to manage resources under monitoring and view monitoring statistics.
|
||||
|
||||
# Zabbix web interface images
|
||||
|
||||
These are the only official Zabbix web interface Docker images. They are based on Alpine Linux v3.12, Ubuntu 20.04 (focal) and CentOS 8 images. The available versions of Zabbix web interface are:
|
||||
|
||||
Zabbix web interface 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest) (unsupported)
|
||||
Zabbix web interface 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*) (unsupported)
|
||||
Zabbix web interface 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix web interface 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix web interface 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix web interface 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix web interface 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix web interface 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix web interface 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix web interface 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix web interface 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix web interface 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
Zabbix web interface 5.0 (tags: alpine-5.0-latest, ubuntu-5.0-latest, centos-5.0-latest)
|
||||
Zabbix web interface 5.0.* (tags: alpine-5.0.*, ubuntu-5.0.*, centos-5.0.*)
|
||||
Zabbix web interface 5.2 (tags: alpine-5.2-latest, ubuntu-5.2-latest, centos-5.2-latest)
|
||||
Zabbix web interface 5.2.* (tags: alpine-5.2.*, ubuntu-5.2.*, centos-5.2.*)
|
||||
Zabbix web interface 5.4 (tags: alpine-5.4-latest, ubuntu-5.4-latest, centos-5.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
|
||||
Zabbix web interface 5.4.* (tags: alpine-5.4.*, ubuntu-5.4.*, centos-5.4.*)
|
||||
Zabbix web interface 6.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
|
||||
|
||||
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
|
||||
|
||||
Zabbix web interface available in three editions:
|
||||
- Zabbix web-interface based on Apache2 web server with MySQL database support
|
||||
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
|
||||
- Zabbix web-interface based on Nginx web server with MySQL database support
|
||||
- Zabbix web-interface based on Nginx web server with PostgreSQL database support
|
||||
|
||||
The image based on Apache2 web server with MySQL database support.
|
||||
|
||||
# How to use this image
|
||||
|
||||
## Start `zabbix-web-apache-mysql`
|
||||
|
||||
Start a Zabbix web-interface container as follows:
|
||||
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER="some-user" -e MYSQL_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
|
||||
Where `some-zabbix-web-apache-mysql` is the name you want to assign to your container, `some-mysql-server` is IP or DNS name of MySQL server, `some-user` is user to connect to Zabbix database on MySQL server, `some-password` is the password to connect to MySQL server, `some-zabbix-server` is IP or DNS name of Zabbix server or proxy, `some-timezone` is PHP like timezone name and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-web-apache-mysql/tags/).
|
||||
|
||||
## Linking the container to Zabbix server
|
||||
|
||||
docker run --name some-zabbix-web-apache-mysql --link some-zabbix-server:zabbix-server -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER="some-user" -e MYSQL_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
|
||||
## Linking the container to MySQL database
|
||||
|
||||
docker run --name some-zabbix-web-apache-mysql --link some-mysql-server:mysql -e DB_SERVER_HOST="some-mysql-server" -e MYSQL_USER="some-user" -e MYSQL_PASSWORD="some-password" -e ZBX_SERVER_HOST="some-zabbix-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
|
||||
## Container shell access and viewing Zabbix web interface logs
|
||||
|
||||
The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-web-apache-mysql` container:
|
||||
|
||||
```console
|
||||
$ docker exec -ti some-zabbix-web-apache-mysql /bin/bash
|
||||
```
|
||||
|
||||
The Zabbix web interface log is available through Docker's container log:
|
||||
|
||||
```console
|
||||
$ docker logs some-zabbix-web-apache-mysql
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When you start the `zabbix-web-apache-mysql` image, you can adjust the configuration of the Zabbix web interface by passing one or more environment variables on the `docker run` command line.
|
||||
|
||||
### `ZBX_SERVER_HOST`
|
||||
|
||||
This variable is IP or DNS name of Zabbix server. By default, value is `zabbix-server`.
|
||||
|
||||
### `ZBX_SERVER_PORT`
|
||||
|
||||
This variable is port Zabbix server listening on. By default, value is `10051`.
|
||||
|
||||
### `DB_SERVER_HOST`
|
||||
|
||||
This variable is IP or DNS name of MySQL server. By default, value is 'mysql-server'
|
||||
|
||||
### `DB_SERVER_PORT`
|
||||
|
||||
This variable is port of MySQL server. By default, value is '3306'.
|
||||
|
||||
### `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_USER_FILE`, `MYSQL_PASSWORD_FILE`
|
||||
|
||||
These variables are used by Zabbix web-interface to connect to Zabbix database. With the `_FILE` variables you can instead provide the path to a file which contains the user / the password instead. Without Docker Swarm or Kubernetes you also have to map the files. Those are exclusive so you can just provide one type - either `MYSQL_USER` or `MYSQL_USER_FILE`!
|
||||
|
||||
```console
|
||||
docker run --name some-zabbix-web-apache-mysql -e DB_SERVER_HOST="some-mysql-server" -v ./.MYSQL_USER:/run/secrets/MYSQL_USER -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -v ./.MYSQL_PASSWORD:/run/secrets/MYSQL_PASSWORD -e MYSQL_PASSWORD_FILE=/var/run/secrets/MYSQL_PASSWORD -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-apache-mysql:tag
|
||||
```
|
||||
|
||||
With Docker Swarm or Kubernetes this works with secrets. That way it is replicated in your cluster!
|
||||
|
||||
```console
|
||||
printf "zabbix" | docker secret create MYSQL_USER -
|
||||
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`
|
||||
|
||||
The variable is Zabbix database name. By default, value is `zabbix`.
|
||||
|
||||
### `ZBX_HISTORYSTORAGEURL`
|
||||
|
||||
History storage HTTP[S] URL. This parameter is used for Elasticsearch setup. Available since 3.4.5.
|
||||
|
||||
### `ZBX_HISTORYSTORAGETYPES`
|
||||
|
||||
Array of value types to be sent to the history storage. An example: ['uint', 'dbl']. This parameter is used for Elasticsearch setup. Available since 3.4.5.
|
||||
|
||||
### `PHP_TZ`
|
||||
|
||||
The variable is timezone in PHP format. Full list of supported timezones are available on [`php.net`](http://php.net/manual/en/timezones.php). By default, value is 'Europe/Riga' and system timezone since Zabbix 5.2.0.
|
||||
|
||||
### `ZBX_SERVER_NAME`
|
||||
|
||||
The variable is visible Zabbix installation name in right top corner of the web interface.
|
||||
|
||||
### `DB_DOUBLE_IEEE754`
|
||||
|
||||
Use IEEE754 compatible value range for 64-bit Numeric (float) history values. Available since 5.0.0. Enabled by default.
|
||||
|
||||
### `ENABLE_WEB_ACCESS_LOG`
|
||||
|
||||
The variable sets the Access Log directive for Web-server. By default, value corresponds to standard output.
|
||||
|
||||
### `ZBX_MAXEXECUTIONTIME`
|
||||
|
||||
The varable is PHP ``max_execution_time`` option. By default, value is `300`.
|
||||
|
||||
### `ZBX_MEMORYLIMIT`
|
||||
|
||||
The varable is PHP ``memory_limit`` option. By default, value is `128M`.
|
||||
|
||||
### `ZBX_POSTMAXSIZE`
|
||||
|
||||
The varable is PHP ``post_max_size`` option. By default, value is `16M`.
|
||||
|
||||
### `ZBX_UPLOADMAXFILESIZE`
|
||||
|
||||
The varable is PHP ``upload_max_filesize`` option. By default, value is `2M`.
|
||||
|
||||
### `ZBX_MAXINPUTTIME`
|
||||
|
||||
The varable is PHP ``max_input_time`` option. By default, value is `300`.
|
||||
|
||||
### `ZBX_SESSION_NAME`
|
||||
|
||||
The variable is Zabbix frontend [definition](https://www.zabbix.com/documentation/current/manual/web_interface/definitions). String used as the name of the Zabbix frontend session cookie. By default, value is `zbx_sessionid`.
|
||||
|
||||
### `ZBX_DENY_GUI_ACCESS`
|
||||
|
||||
Enable (``true``) maintenance mode for Zabbix web-interface.
|
||||
|
||||
### `ZBX_GUI_ACCESS_IP_RANGE`
|
||||
|
||||
Array of IP addresses which are allowed for accessing to Zabbix web-interface during maintenance period.
|
||||
|
||||
### `ZBX_GUI_WARNING_MSG`
|
||||
|
||||
Information message about maintenance period for Zabbix web-interface.
|
||||
|
||||
### `ZBX_DB_ENCRYPTION`
|
||||
|
||||
The variable allows to activate encryption for connections to Zabbix database. Even if no other environment variables are specified, connections will be TLS-encrypted if `ZBX_DB_ENCRYPTION=true` specified. Available since 5.0.0. Disabled by default.
|
||||
|
||||
### `ZBX_DB_KEY_FILE`
|
||||
|
||||
The variable allows to specify the full path to a valid TLS key file. Available since 5.0.0.
|
||||
|
||||
### `ZBX_DB_CERT_FILE`
|
||||
|
||||
The variable allows to specify the full path to a valid TLS certificate file. Available since 5.0.0.
|
||||
|
||||
### `ZBX_DB_CA_FILE`
|
||||
|
||||
The variable allows to specify the full path to a valid TLS certificate authority file. Available since 5.0.0.
|
||||
|
||||
### `ZBX_DB_VERIFY_HOST`
|
||||
|
||||
The variable allows to activate host verification. Available since 5.0.0.
|
||||
|
||||
### `ZBX_DB_CIPHER_LIST`
|
||||
|
||||
The variable allows to specify a custom list of valid ciphers. The format of the cipher list must conform to the OpenSSL standard. Available since 5.0.0.
|
||||
|
||||
## `ZBX_SSO_SETTINGS`
|
||||
|
||||
The variable allows to specify custom SSO settings in JSON format. Available since 5.0.0.
|
||||
|
||||
### Other variables
|
||||
|
||||
Additionally the image allows to specify many other environment variables listed below:
|
||||
|
||||
```
|
||||
ZBX_VAULTDBPATH= # Available since 5.2.0
|
||||
ZBX_VAULTURL=https://127.0.0.1:8200 # Available since 5.2.0
|
||||
VAULT_TOKEN= # Available since 5.2.0
|
||||
```
|
||||
|
||||
## Allowed volumes for the Zabbix web interface container
|
||||
|
||||
### ``/etc/ssl/apache2``
|
||||
|
||||
The volume allows to enable HTTPS for the Zabbix web interface. The volume must contains two files ``ssl.crt`` and ``ssl.key`` prepared for Apache2 SSL connections.
|
||||
|
||||
Please follow official Apache2 [documentation](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html) to get more details about how to create certificate files.
|
||||
|
||||
### ``/etc/zabbix/web/certs``
|
||||
|
||||
The volume allows to use custom certificates for SAML authentification. The volume must contains three files ``sp.key``, ``sp.crt`` and ``idp.crt``. Available since 5.0.0.
|
||||
|
||||
# The image variants
|
||||
|
||||
The `zabbix-web-apache-mysql` images come in many flavors, each designed for a specific use case.
|
||||
|
||||
## `zabbix-web-apache-mysql:ubuntu-<version>`
|
||||
|
||||
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
|
||||
|
||||
## `zabbix-web-apache-mysql:alpine-<version>`
|
||||
|
||||
This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
|
||||
|
||||
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
|
||||
|
||||
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
|
||||
|
||||
# Supported Docker versions
|
||||
|
||||
This image is officially supported on Docker version 1.12.0.
|
||||
|
||||
Support for older versions (down to 1.6) is provided on a best-effort basis.
|
||||
|
||||
Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon.
|
||||
|
||||
# User Feedback
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for this image is stored in the [`web-apache-mysql/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/web-apache-mysql) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
|
||||
|
||||
## Issues
|
||||
|
||||
If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues).
|
||||
|
||||
### Known issues
|
||||
|
||||
## Contributing
|
||||
|
||||
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
|
||||
|
||||
Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
|
1
web-apache-mysql/ol/build.sh
Symbolic link
1
web-apache-mysql/ol/build.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../../build.sh
|
3
web-apache-mysql/ol/conf/etc/httpd/conf.d/99-zabbix.conf
Normal file
3
web-apache-mysql/ol/conf/etc/httpd/conf.d/99-zabbix.conf
Normal file
@ -0,0 +1,3 @@
|
||||
<IfModule !mpm_netware_module>
|
||||
PidFile "/tmp/httpd.pid"
|
||||
</IfModule>
|
9
web-apache-mysql/ol/conf/etc/php-fpm.conf
Normal file
9
web-apache-mysql/ol/conf/etc/php-fpm.conf
Normal file
@ -0,0 +1,9 @@
|
||||
include=/etc/php-fpm.d/*.conf
|
||||
|
||||
[global]
|
||||
|
||||
pid = /tmp/php-fpm.pid
|
||||
|
||||
error_log = /dev/fd/2
|
||||
|
||||
daemonize = no
|
27
web-apache-mysql/ol/conf/etc/php-fpm.d/zabbix.conf
Normal file
27
web-apache-mysql/ol/conf/etc/php-fpm.d/zabbix.conf
Normal file
@ -0,0 +1,27 @@
|
||||
[zabbix]
|
||||
|
||||
listen = /tmp/php-fpm.sock
|
||||
|
||||
clear_env = no
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 50
|
||||
pm.start_servers = 5
|
||||
pm.min_spare_servers = 5
|
||||
pm.max_spare_servers = 35
|
||||
|
||||
slowlog = /dev/fd/1
|
||||
|
||||
; php_admin_value[error_log] = /dev/fd/2
|
||||
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] = ${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}
|
@ -0,0 +1,30 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:httpd]
|
||||
command = /usr/sbin/%(program_name)s -D FOREGROUND
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=2
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
|
||||
[program:php-fpm]
|
||||
command = /usr/sbin/%(program_name)s -F -y /etc/%(program_name)s.conf
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=2
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
35
web-apache-mysql/ol/conf/etc/supervisor/supervisord.conf
Normal file
35
web-apache-mysql/ol/conf/etc/supervisor/supervisord.conf
Normal file
@ -0,0 +1,35 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
;user = zabbix
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
@ -0,0 +1,6 @@
|
||||
[ol8_developer_EPEL]
|
||||
name=Oracle Linux $releasever EPEL Packages for Development ($basearch)
|
||||
baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/developer/EPEL/$basearch/
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
|
||||
gpgcheck=1
|
||||
enabled=1
|
65
web-apache-mysql/ol/conf/etc/zabbix/apache.conf
Normal file
65
web-apache-mysql/ol/conf/etc/zabbix/apache.conf
Normal file
@ -0,0 +1,65 @@
|
||||
<VirtualHost *:8080>
|
||||
DocumentRoot /usr/share/zabbix/
|
||||
ServerName zabbix
|
||||
DirectoryIndex index.php
|
||||
AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
<Directory "/usr/share/zabbix">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
|
||||
<FilesMatch \.(php|phar)$>
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/conf">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/app">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/include">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/local">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/locale">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/vendor">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
90
web-apache-mysql/ol/conf/etc/zabbix/apache_ssl.conf
Normal file
90
web-apache-mysql/ol/conf/etc/zabbix/apache_ssl.conf
Normal file
@ -0,0 +1,90 @@
|
||||
LoadModule ssl_module modules/mod_ssl.so
|
||||
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
|
||||
|
||||
Listen 8443
|
||||
|
||||
<VirtualHost *:8443>
|
||||
DocumentRoot /usr/share/zabbix/
|
||||
ServerName zabbix
|
||||
DirectoryIndex index.php
|
||||
|
||||
AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
SSLEngine on
|
||||
|
||||
# intermediate configuration
|
||||
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
|
||||
SSLHonorCipherOrder off
|
||||
SSLSessionTickets off
|
||||
|
||||
SSLCertificateFile /etc/ssl/apache2/ssl.crt
|
||||
SSLCertificateKeyFile /etc/ssl/apache2/ssl.key
|
||||
# SSLCACertificatePath /etc/ssl/apache2/chain/
|
||||
|
||||
# enable HTTP/2, if available
|
||||
Protocols h2 http/1.1
|
||||
|
||||
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
|
||||
Header always set Strict-Transport-Security "max-age=63072000"
|
||||
|
||||
<Directory "/usr/share/zabbix">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
|
||||
<FilesMatch \.(php|phar)$>
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/conf">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/app">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/include">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/local">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/locale">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/vendor">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
32
web-apache-mysql/ol/conf/etc/zabbix/web/maintenance.inc.php
Normal file
32
web-apache-mysql/ol/conf/etc/zabbix/web/maintenance.inc.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2016 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
|
||||
// Maintenance mode
|
||||
if (getenv('ZBX_DENY_GUI_ACCESS') == 'true') {
|
||||
define('ZBX_DENY_GUI_ACCESS', 1);
|
||||
|
||||
// IP range, who are allowed to connect to FrontEnd
|
||||
$ip_range = str_replace("'","\"",getenv('ZBX_GUI_ACCESS_IP_RANGE'));
|
||||
$ZBX_GUI_ACCESS_IP_RANGE = (json_decode($ip_range)) ? json_decode($ip_range, true) : array();
|
||||
|
||||
// MSG shown on Warning screen!
|
||||
$_REQUEST['warning_msg'] = getenv('ZBX_GUI_WARNING_MSG');
|
||||
}
|
50
web-apache-mysql/ol/conf/etc/zabbix/web/zabbix.conf.php
Normal file
50
web-apache-mysql/ol/conf/etc/zabbix/web/zabbix.conf.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// Zabbix GUI configuration file.
|
||||
global $DB, $HISTORY;
|
||||
|
||||
$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'] = getenv('DB_SERVER_SCHEMA');
|
||||
|
||||
$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'] = 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'] = 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 = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGEURL'));
|
||||
$HISTORY['url'] = (json_decode($history_url)) ? json_decode($history_url, true) : $history_url;
|
||||
// Value types stored in Elasticsearch.
|
||||
$storage_types = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGETYPES'));
|
||||
|
||||
$HISTORY['types'] = (json_decode($storage_types)) ? json_decode($storage_types, true) : 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' : (file_exists(getenv('ZBX_SSO_SP_KEY')) ? getenv('ZBX_SSO_SP_KEY') : '');
|
||||
$SSO['SP_CERT'] = file_exists('/etc/zabbix/web/certs/sp.crt') ? '/etc/zabbix/web/certs/sp.crt' : (file_exists(getenv('ZBX_SSO_SP_CERT')) ? getenv('ZBX_SSO_SP_CERT') : '');
|
||||
$SSO['IDP_CERT'] = file_exists('/etc/zabbix/web/certs/idp.crt') ? '/etc/zabbix/web/certs/idp.crt' : (file_exists(getenv('ZBX_SSO_IDP_CERT')) ? getenv('ZBX_SSO_IDP_CERT') : '');
|
||||
|
||||
$sso_settings = str_replace("'","\"",getenv('ZBX_SSO_SETTINGS'));
|
||||
$SSO['SETTINGS'] = (json_decode($sso_settings)) ? json_decode($sso_settings, true) : array();
|
258
web-apache-mysql/ol/docker-entrypoint.sh
Executable file
258
web-apache-mysql/ol/docker-entrypoint.sh
Executable file
@ -0,0 +1,258 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
# Script trace mode
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
: ${ZBX_SERVER_NAME:="Zabbix docker"}
|
||||
# Default Zabbix server host
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default timezone for web interface
|
||||
: ${PHP_TZ:="Europe/Riga"}
|
||||
|
||||
# Default directories
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
# Web interface www-root directory
|
||||
ZABBIX_WWW_ROOT="/usr/share/zabbix"
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
|
||||
# (will allow for "$MYSQL_PASSWORD_FILE" to fill in the value of "$MYSQL_PASSWORD" from a file)
|
||||
# unsets the VAR_FILE afterwards and just leaving VAR
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local defaultValue="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo "**** Both variables $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$defaultValue"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
echo "** Using ${var} variable from ENV"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
if [ ! -f "${!fileVar}" ]; then
|
||||
echo "**** Secret file \"${!fileVar}\" is not found"
|
||||
exit 1
|
||||
fi
|
||||
val="$(< "${!fileVar}")"
|
||||
echo "** Using ${var} variable from secret file"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
# Check prerequisites for MySQL database
|
||||
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"}
|
||||
|
||||
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
|
||||
}
|
||||
|
||||
db_tls_params() {
|
||||
local result=""
|
||||
|
||||
if [ "${ZBX_DB_ENCRYPTION,,}" == "true" ]; then
|
||||
result="--ssl-mode=required"
|
||||
|
||||
if [ -n "${ZBX_DB_CA_FILE}" ]; then
|
||||
result="${result} --ssl-ca=${ZBX_DB_CA_FILE}"
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DB_KEY_FILE}" ]; then
|
||||
result="${result} --ssl-key=${ZBX_DB_KEY_FILE}"
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DB_CERT_FILE}" ]; then
|
||||
result="${result} --ssl-cert=${ZBX_DB_CERT_FILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $result
|
||||
}
|
||||
|
||||
check_db_connect() {
|
||||
echo "********************"
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
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
|
||||
echo "********************"
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
|
||||
unset MYSQL_PWD
|
||||
}
|
||||
|
||||
prepare_web_server() {
|
||||
APACHE_SITES_DIR=/etc/httpd/conf.d
|
||||
|
||||
echo "** Adding Zabbix virtual host (HTTP)"
|
||||
if [ -f "$ZABBIX_ETC_DIR/apache.conf" ]; then
|
||||
ln -sfT "$ZABBIX_ETC_DIR/apache.conf" "$APACHE_SITES_DIR/zabbix.conf"
|
||||
else
|
||||
echo "**** Impossible to enable HTTP virtual host"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/ssl/apache2/ssl.crt" ] && [ -f "/etc/ssl/apache2/ssl.key" ]; then
|
||||
echo "** Adding Zabbix virtual host (HTTPS)"
|
||||
if [ -f "$ZABBIX_ETC_DIR/apache_ssl.conf" ]; then
|
||||
ln -sfT "$ZABBIX_ETC_DIR/apache_ssl.conf" "$APACHE_SITES_DIR/zabbix_ssl.conf"
|
||||
else
|
||||
echo "**** Impossible to enable HTTPS virtual host"
|
||||
fi
|
||||
else
|
||||
echo "**** Impossible to enable SSL support for Apache2. Certificates are missed."
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_zbx_web_config() {
|
||||
echo "** Preparing Zabbix frontend configuration file"
|
||||
|
||||
PHP_CONFIG_FILE="/etc/php-fpm.d/zabbix.conf"
|
||||
|
||||
if [ "$(id -u)" == '0' ]; then
|
||||
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
|
||||
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
|
||||
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
|
||||
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
|
||||
fi
|
||||
|
||||
: ${ZBX_DENY_GUI_ACCESS:="false"}
|
||||
export ZBX_DENY_GUI_ACCESS=${ZBX_DENY_GUI_ACCESS,,}
|
||||
export ZBX_GUI_ACCESS_IP_RANGE=${ZBX_GUI_ACCESS_IP_RANGE:-"['127.0.0.1']"}
|
||||
export ZBX_GUI_WARNING_MSG=${ZBX_GUI_WARNING_MSG:-"Zabbix is under maintenance."}
|
||||
|
||||
export ZBX_MAXEXECUTIONTIME=${ZBX_MAXEXECUTIONTIME:-"600"}
|
||||
export ZBX_MEMORYLIMIT=${ZBX_MEMORYLIMIT:-"128M"}
|
||||
export ZBX_POSTMAXSIZE=${ZBX_POSTMAXSIZE:-"16M"}
|
||||
export ZBX_UPLOADMAXFILESIZE=${ZBX_UPLOADMAXFILESIZE:-"2M"}
|
||||
export ZBX_MAXINPUTTIME=${ZBX_MAXINPUTTIME:-"300"}
|
||||
export PHP_TZ=${PHP_TZ}
|
||||
|
||||
export DB_SERVER_TYPE="MYSQL"
|
||||
export DB_SERVER_HOST=${DB_SERVER_HOST}
|
||||
export DB_SERVER_PORT=${DB_SERVER_PORT}
|
||||
export DB_SERVER_DBNAME=${DB_SERVER_DBNAME}
|
||||
export DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA}
|
||||
export DB_SERVER_USER=${DB_SERVER_ZBX_USER}
|
||||
export DB_SERVER_PASS=${DB_SERVER_ZBX_PASS}
|
||||
export ZBX_SERVER_HOST=${ZBX_SERVER_HOST}
|
||||
export ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
export ZBX_SERVER_NAME=${ZBX_SERVER_NAME}
|
||||
|
||||
: ${ZBX_DB_ENCRYPTION:="false"}
|
||||
export ZBX_DB_ENCRYPTION=${ZBX_DB_ENCRYPTION,,}
|
||||
export ZBX_DB_KEY_FILE=${ZBX_DB_KEY_FILE}
|
||||
export ZBX_DB_CERT_FILE=${ZBX_DB_CERT_FILE}
|
||||
export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE}
|
||||
: ${ZBX_DB_VERIFY_HOST:="false"}
|
||||
export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,}
|
||||
|
||||
: ${DB_DOUBLE_IEEE754:="true"}
|
||||
export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,}
|
||||
|
||||
export ZBX_HISTORYSTORAGEURL=${ZBX_HISTORYSTORAGEURL}
|
||||
export ZBX_HISTORYSTORAGETYPES=${ZBX_HISTORYSTORAGETYPES:-"[]"}
|
||||
|
||||
export ZBX_SSO_SETTINGS=${ZBX_SSO_SETTINGS:-""}
|
||||
|
||||
if [ -n "${ZBX_SESSION_NAME}" ]; then
|
||||
cp "$ZABBIX_WWW_ROOT/include/defines.inc.php" "/tmp/defines.inc.php_tmp"
|
||||
sed "/ZBX_SESSION_NAME/s/'[^']*'/'${ZBX_SESSION_NAME}'/2" "/tmp/defines.inc.php_tmp" > "$ZABBIX_WWW_ROOT/include/defines.inc.php"
|
||||
rm -f "/tmp/defines.inc.php_tmp"
|
||||
fi
|
||||
|
||||
: ${ENABLE_WEB_ACCESS_LOG:="true"}
|
||||
|
||||
if [ "${ENABLE_WEB_ACCESS_LOG,,}" == "false" ]; then
|
||||
sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /dev/null!g' \
|
||||
"/etc/httpd/conf/httpd.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
#################################################
|
||||
|
||||
echo "** Deploying Zabbix web-interface (Apache) with MySQL database"
|
||||
|
||||
check_variables
|
||||
check_db_connect
|
||||
prepare_web_server
|
||||
prepare_zbx_web_config
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
elif [ -f "/usr/bin/supervisord" ]; then
|
||||
echo "** Executing supervisord"
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
else
|
||||
echo "Unknown instructions. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#################################################
|
Reference in New Issue
Block a user