added secrets

This commit is contained in:
2026-02-25 14:54:50 +01:00
parent 6bc4ea5e45
commit f4900ef5ab

View File

@@ -2,13 +2,16 @@ services:
mysql:
image: mysql:8.0-oracle
container_name: mysql
secrets:
- mysql-password
- mysql-root-password
networks:
- zabbix-net
environment:
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: /etc/zabbix-passwd/secrets/mysql-password
MYSQL_ROOT_PASSWORD: /etc/zabbix-passwd/secrets/mysql-root-password
MYSQL_PASSWORD_FILE: /run/secrets/mysql-password
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql-root-password
volumes:
- ./mysql_data:/var/lib/mysql
command:
@@ -25,41 +28,51 @@ services:
zabbix-server:
image: zabbix/zabbix-server-mysql
container-name: zabbix-server
container_name: zabbix-server
secrets:
- mysql-password
- mysql-root-password
networks:
- zabbix-net
restart: unless-stopped
environnment:
environment:
DB_SERVER_HOST: mysql
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: /etc/zabbix-passwd/secrets/mysql-password
MYSQL_ROOT_PASSWORD: /etc/zabbix-passwd/secrets/mysql-root-password
MYSQL_PASSWORD_FILE: /run/secrets/mysql-password
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql-root-password
ZBX_JAVAGATEWAY: zabbix-java-gateway
ports:
- 10051:10051
zabbix-web-nginx:
image: zabbix/zabbix-web-nginx-mysql:alpine-7.4-latest
container_name: zabbix-web-nginx
restart: unless-stopped
newtorks:
- zabbix-net
environment:
ZBX_SERVER_HOST: zabbix-server
DB_SERVER_HOST: mysql
MYSQL_DATABSE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: /etc/zabbix-passwd/secrets/mysql-password
MYSQL_ROOT_PASSWORD: /etc/zabbix-passwd/secrets/mysql-root-password
ports:
- 80:8080
image: zabbix/zabbix-web-nginx-mysql:alpine-7.4-latest
container_name: zabbix-web-nginx
secrets:
- mysql-password
- mysql-root-password
restart: unless-stopped
networks:
- zabbix-net
environment:
ZBX_SERVER_HOST: zabbix-server
DB_SERVER_HOST: mysql
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD_FILE: /run/secrets/mysql-password
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql-root-password
ports:
- 80:8080
networks:
zabbix-net:
ipam:
driver: default
config:
- subnet: "192.168.1.0/24"
- subnet: "192.168.1.0/24"
secrets:
mysql-password:
file: /etc/zabbix-passwd/secrets/mysql-password
mysql-root-password:
file: /etc/zabbix-passwd/secrets/mysql-root-password