2021-04-26 23:56:52 +02:00
|
|
|
version: "{{ compose_version }}"
|
|
|
|
|
|
|
|
networks:
|
|
|
|
proxy:
|
|
|
|
name: "{{ traefik_network }}"
|
|
|
|
php:
|
|
|
|
name: php
|
|
|
|
|
|
|
|
services:
|
|
|
|
{% for website in websites_to_up %}
|
|
|
|
{{ website.name }}:
|
|
|
|
container_name: web_{{ website.name }}
|
|
|
|
image: nginx:alpine
|
|
|
|
volumes:
|
|
|
|
- {{ websites_basepath }}/{{ website.name }}:/var/www/html:ro
|
|
|
|
- {{ websites_basepath }}/{{ website.name }}.conf:/etc/nginx/conf.d/default.conf:ro
|
2021-07-23 14:04:42 +02:00
|
|
|
- /etc/timezone:/etc/timezone:ro
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
2021-04-26 23:56:52 +02:00
|
|
|
labels:
|
|
|
|
traefik.http.routers.{{ website.name }}.entrypoints: websecure
|
|
|
|
traefik.http.routers.{{ website.name }}.rule: "Host(`{{ website.name }}.{{ domain_name }}`)"
|
|
|
|
traefik.http.services.{{ website.name }}.loadbalancer.server.port: "{{ nginx_internal_port }}"
|
|
|
|
traefik.enable: true
|
|
|
|
networks:
|
|
|
|
- proxy
|
|
|
|
- php
|
|
|
|
read_only: true
|
|
|
|
tmpfs:
|
|
|
|
- /var/cache/nginx
|
|
|
|
- /run
|
|
|
|
restart: unless-stopped
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{# Up a php container if any of the website needs PHP #}
|
|
|
|
{% if websites_to_up | selectattr('php', 'equalto', 'true') | list | length > 0 %}
|
|
|
|
php:
|
|
|
|
container_name: php
|
|
|
|
image: php:{{ php_version }}
|
|
|
|
networks:
|
|
|
|
- php
|
|
|
|
volumes:
|
|
|
|
{# Mount files from websites which need PHP #}
|
|
|
|
{% for website in websites_to_up %}
|
|
|
|
{% if website.php == "true" %}
|
|
|
|
- {{ websites_basepath }}/{{ website.name }}:/var/www/html/{{ website.name }}:ro
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2021-07-23 14:04:42 +02:00
|
|
|
- /etc/timezone:/etc/timezone:ro
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
2021-04-26 23:56:52 +02:00
|
|
|
restart: unless-stopped
|
|
|
|
{% endif %}
|