ansible-role-docker_wordpress/templates/docker-compose.yml

47 lines
1.5 KiB
YAML
Raw Normal View History

2022-07-20 12:02:01 +02:00
# {{ ansible_managed }}
version: '3.1'
services:
wordpress:
image: wordpress:{{ docker_wordpress_image_version }}
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: "{{ docker_wordpress_db_user }}"
WORDPRESS_DB_PASSWORD: "{{ docker_wordpress_db_password }}"
WORDPRESS_DB_NAME: "{{ docker_wordpress_db_name }}"
volumes:
2023-01-09 22:09:19 +01:00
- {{ docker_wordpress_data_dir }}/{{ docker_wordpress_service_id }}/wp_html:/var/www/html
2022-08-06 12:05:09 +02:00
depends_on:
- db
2022-07-20 12:02:01 +02:00
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.{{ docker_wordpress_service_id }}.entrypoints=web"
- "traefik.http.routers.{{ docker_wordpress_service_id }}.rule=Host(`{{ docker_wordpress_fqdn }}`)"
- "traefik.http.services.{{ docker_wordpress_service_id }}.loadbalancer.server.port=80"
networks:
- wordpress
- traefik
db:
image: mariadb:10.8.2-rc-focal
restart: always
volumes:
2023-01-09 22:09:19 +01:00
- {{ docker_wordpress_data_dir }}/{{ docker_wordpress_service_id }}/mysql:/var/lib/mysql
2022-07-20 12:02:01 +02:00
environment:
# genere un mdp root et l'affiche au demarrage sur stdout
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MARIADB_DATABASE: "{{ docker_wordpress_db_name }}"
MARIADB_USER: "{{ docker_wordpress_db_user }}"
MARIADB_PASSWORD: "{{ docker_wordpress_db_password }}"
networks:
- wordpress
networks:
traefik:
external: true
wordpress:
internal: true