diff --git a/README.md b/README.md index 29dce45..b0d5248 100644 --- a/README.md +++ b/README.md @@ -7,59 +7,25 @@ Mysql files are mounted at datadir. \ `startservices.sh` contain script to start `zabbix_server`, `nginx` and `php-fpm` ## Getting started +### Building - git clone and cd into git dir - Build zabbix image - cd into configdir and configure according to your set up. ```bash -git clone https://gitlab.com/alliedmaldives/ops/zabbix-dockerfile zabbix-docker -cd zabbix-docker -docker-compose up -d +git clone https://git.shihaam.dev/dockerfiles/zabbix-server.git +cd zabbix-server +docker-compose -f docker-compose-build.yml up -d xdg-open http://localhost:8000 ``` - -## Running production -This includes database config \ -copy paste this in docker-compose.yml \ -run `docker compose up -d` -``` -version: '3.5' -services: -######################### - zabbix: - image: git.shihaam.dev/dockerfiles/zabbix-server - volumes: - - $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf - - $PWD/configdir/etc/zabbix/nginx.conf:/etc/zabbix/nginx.conf - - $PWD/configdir/etc/zabbix/web/zabbix.conf.php:/etc/zabbix/web/zabbix.conf.php - - $PWD/configdir/etc/php/7.4/fpm/php-fpm.conf:/etc/php/7.4/fpm/php-fpm.conf - - $PWD/datadir/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts - - $PWD/datadir/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts - ports: - - 8000:80 - - 10051:10051 - restart: always -######################### - db: - image: mysql:8 - environment: - MYSQL_DATABASE: zabbix - MYSQL_USER: zabbix - MYSQL_PASSWORD: zabbix - MYSQL_ALLOW_EMPTY_PASSWORD: true - command: - - mysqld - - --character-set-server=utf8mb4 - - --collation-server=utf8mb4_bin - - --skip-character-set-client-handshake - - --default-authentication-plugin=mysql_native_password - volumes: - - $PWD/configdir/init/init.db:/docker-entrypoint-initdb.d - - $PWD/datadir/mysql:/var/lib/mysql - restart: always - depends_on: - - zabbix +### Running production +- Git clone this repo and run `docker compose up -d` +```bash +git clone https://git.shihaam.dev/dockerfiles/zabbix-server.git +cd zabbix-server +docker-compose up -d ``` +- You will have Zabbix frontent avaible on port 8009 ## To-do - mount all needed config dirs outside container. (currently only basic configs are there) diff --git a/docker-compose-build.yml b/docker-compose-build.yml new file mode 100644 index 0000000..467272b --- /dev/null +++ b/docker-compose-build.yml @@ -0,0 +1,17 @@ +version: '3.5' +services: +######################### + zabbix: + build: . + image: git.shihaam.dev/dockerfiles/zabbix-server + volumes: + - $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf + - $PWD/configdir/etc/zabbix/nginx.conf:/etc/zabbix/nginx.conf + - $PWD/configdir/etc/zabbix/web/zabbix.conf.php:/etc/zabbix/web/zabbix.conf.php + - $PWD/configdir/etc/php/7.4/fpm/php-fpm.conf:/etc/php/7.4/fpm/php-fpm.conf + - $PWD/datadir/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts + - $PWD/datadir/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts + ports: + - 8000:80 + - 10051:10051 + restart: always diff --git a/docker-compose.yml b/docker-compose.yml index 467272b..2fd2ef0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,6 @@ version: '3.5' services: ######################### zabbix: - build: . image: git.shihaam.dev/dockerfiles/zabbix-server volumes: - $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf @@ -15,3 +14,24 @@ services: - 8000:80 - 10051:10051 restart: always +######################### + db: + image: mysql:8 + environment: + MYSQL_DATABASE: zabbix + MYSQL_USER: zabbix + MYSQL_PASSWORD: zabbix + MYSQL_ALLOW_EMPTY_PASSWORD: true + command: + - mysqld + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_bin + - --skip-character-set-client-handshake + - --default-authentication-plugin=mysql_native_password + volumes: + - $PWD/configdir/init/init.db:/docker-entrypoint-initdb.d + - $PWD/datadir/mysql:/var/lib/mysql + restart: always + depends_on: + - zabbix +