|
@@ -18,18 +18,26 @@ services:
|
|
|
{% if swarm %}
|
|
{% if swarm %}
|
|
|
deploy:
|
|
deploy:
|
|
|
replicas: {{ swarm_replicas | default(1) }}
|
|
replicas: {{ swarm_replicas | default(1) }}
|
|
|
- restart_policy:
|
|
|
|
|
- condition: on-failure
|
|
|
|
|
|
|
+ {% if traefik %}
|
|
|
|
|
+ labels:
|
|
|
|
|
+ - traefik.enable={{ traefik_enable | default(true) }}
|
|
|
|
|
+ - traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
|
|
|
|
|
+ - traefik.http.routers.{{ container_name }}.entrypoints=websecure
|
|
|
|
|
+ - traefik.http.routers.{{ container_name }}.rule=Host(`{{ traefik_host | default('example.com') }}`)
|
|
|
|
|
+ - traefik.http.routers.{{ container_name }}.tls={{ traefik_tls | default(true) }}
|
|
|
|
|
+ - traefik.http.routers.{{ container_name }}.tls.certresolver={{ traefik_certresolver }}
|
|
|
|
|
+ - traefik.http.routers.{{ container_name }}.service={{ container_name }}
|
|
|
|
|
+ {% endif %}
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
{% if not traefik %}
|
|
{% if not traefik %}
|
|
|
ports:
|
|
ports:
|
|
|
- "{{ service_port['http'] | default(8080) }}:80"
|
|
- "{{ service_port['http'] | default(8080) }}:80"
|
|
|
- "{{ service_port['https'] | default(8443) }}:443"
|
|
- "{{ service_port['https'] | default(8443) }}:443"
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
- volumes:
|
|
|
|
|
- - ./config/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
|
|
|
- - ./data:/usr/share/nginx/html:ro
|
|
|
|
|
- {% if traefik %}
|
|
|
|
|
|
|
+ # volumes:
|
|
|
|
|
+ # - ./config/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
|
|
|
+ # - ./data:/usr/share/nginx/html:ro
|
|
|
|
|
+ {% if traefik and not swarm %}
|
|
|
labels:
|
|
labels:
|
|
|
- traefik.enable={{ traefik_enable | default(true) }}
|
|
- traefik.enable={{ traefik_enable | default(true) }}
|
|
|
- traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
|
|
- traefik.http.services.{{ container_name }}.loadbalancer.server.port=80
|