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

46 lines
1.4 KiB
YAML

# {{ ansible_managed }}
version: '3.1'
services:
wordpress:
image: {{ 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:
- {{ docker_wordpress_data_dir }}/{{ docker_wordpress_service_id }}/wp_html:/var/www/html
depends_on:
- db
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:
- {{ docker_wordpress_data_dir }}/{{ docker_wordpress_service_id }}/mysql:/var/lib/mysql
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