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