forked from wonderful/docker-k8s-devops
55 lines
930 B
YAML
Executable File
55 lines
930 B
YAML
Executable File
version: '3'
|
|
|
|
services:
|
|
|
|
web:
|
|
image: wordpress
|
|
ports:
|
|
- 8080:80
|
|
secrets:
|
|
- my-pw
|
|
environment:
|
|
WORDPRESS_DB_HOST: mysql
|
|
WORDPRESS_DB_PASSWORD_FILE: /run/secrets/my-pw
|
|
networks:
|
|
- my-network
|
|
depends_on:
|
|
- mysql
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 3
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
update_config:
|
|
parallelism: 1
|
|
delay: 10s
|
|
|
|
mysql:
|
|
image: mysql
|
|
secrets:
|
|
- my-pw
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/my-pw
|
|
MYSQL_DATABASE: wordpress
|
|
volumes:
|
|
- mysql-data:/var/lib/mysql
|
|
networks:
|
|
- my-network
|
|
deploy:
|
|
mode: global
|
|
placement:
|
|
constraints:
|
|
- node.role == manager
|
|
|
|
volumes:
|
|
mysql-data:
|
|
|
|
networks:
|
|
my-network:
|
|
driver: overlay
|
|
|
|
# secrets:
|
|
# my-pw:
|
|
# file: ./password |