Skip to content
Snippets Groups Projects
Commit 1306b608 authored by jurgenhaas's avatar jurgenhaas
Browse files

composer/library/docker-traefik#5 Make traefik configurable

parent eb890d28
No related branches found
No related tags found
No related merge requests found
......@@ -12,3 +12,7 @@ commands:
imports:
- ahoy.debug.yml
usage: PHP debugging
changelog:
imports:
- ./.ahoy.l3d/changelog.yml
usage: Changelog tools.
vendor
.env
composer.lock
/.ahoy.l3d
......@@ -192,6 +192,13 @@ docker4drupal:
docker0:
ip: [IP OF YOUR DOCKER HOST]
proxy: [IP OF TRAEFIK PROXY]
traefik:
domain: docker.localhost
usessl: 0
port: 8000
ports: 8443
cert: fullchain.pem
key: privkey.pem
live:
root: ''
uri: ''
......
......@@ -28,7 +28,7 @@
"php": ">=7.2",
"composer-plugin-api": "^1||^2",
"lakedrops/composer-json-utils": "^2.0||dev-master",
"lakedrops/docker-traefik": "^1.3||dev-master"
"lakedrops/docker-traefik": "^1.4||dev-master"
},
"require-dev": {
"composer/composer": "^1||^2",
......
......@@ -42,6 +42,14 @@ class Handler extends BaseHandler {
$this->getDockerProxy($projectname) :
FALSE,
],
'traefik' => [
'domain' => $this->env->receive('traefik_domain', '', 'docker.localhost'),
'usessl' => 0,
'port' => $this->env->receive('traefik_port', '', '8000'),
'ports' => $this->env->receive('traefik_ports', '', '8443'),
'cert' => $this->env->receive('traefik_cert', '', 'fullchain.pem'),
'key' => $this->env->receive('traefik_key', '', 'privkey.pem'),
],
'live' => [
'root' => '',
'uri' => '',
......@@ -264,7 +272,14 @@ class Handler extends BaseHandler {
$this->gitIgnore('tests/backstop/backstop_data/html_report');
$this->gitLFS('tests/backstop/**/*.png');
$traefik = new Traefik($this->config->readValue('projectname'));
$traefik = new Traefik(
$this->config->readValue('projectname'),
$this->config->readValue(['traefik', 'domain']),
$this->config->readValue(['traefik', 'port']),
$this->config->readValue(['traefik', 'ports']),
$this->config->readValue(['traefik', 'cert']),
$this->config->readValue(['traefik', 'key'])
);
$traefik->update();
// Set permissions, see https://wodby.com/stacks/drupal/docs/local/permissions
......
dev:
root: '/var/www/html/{{ webRoot }}/'
uri: '{{ projectname }}.docker.localhost:8000'
uri: '{{ projectname }}.{{ traefik.domain }}{% if traefik.usessl and traefik.ports != 443 %}:{{ traefik.ports }}{% elseif not traefik.usessl and traefik.port != 80 %}:{{ traefik.port }}{% endif %}'
behat:
root: '/var/www/html/{{ webRoot }}/'
uri: '{{ webserver.type }}'
......
......@@ -54,7 +54,7 @@ services:
- './.docker-init/wkhtmltox.sh:/docker-entrypoint-init.d/50-wkhtmltox.sh'
{% endif %}
extra_hosts:
- '{{ projectname }}.docker.localhost:{{ docker0.ip }}'
- '{{ projectname }}.{{ traefik.domain }}:{{ docker0.ip }}'
{{ webserver.type }}:
image: {% if webserver.type == 'nginx' %}'wodby/drupal-nginx:{{ webserver.version|default("1.18") }}'{% elseif webserver.type == 'apache' %}'wodby/apache:2.4'{% endif %}
......@@ -82,7 +82,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_{{ webserver.type }}_1'
traefik.port: '80'
traefik.frontend.rule: 'Host:{{ projectname }}.docker.localhost{% for domain in extradomains|default([]) %},{{ domain }}{% endfor %}'
traefik.frontend.rule: 'Host:{{ projectname }}.{{ traefik.domain }}{% for domain in extradomains|default([]) %},{{ domain }}{% endfor %}'
{% if varnish.enable %}
varnish:
......@@ -96,7 +96,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_varnish_1'
traefik.port: '6081'
traefik.frontend.rule: 'Host:varnish.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:varnish.{{ projectname }}.{{ traefik.domain }}'
{% endif %}
redis:
......@@ -110,7 +110,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_adminer_1'
traefik.port: '9000'
traefik.frontend.rule: 'Host:adminer.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:adminer.{{ projectname }}.{{ traefik.domain }}'
{% elseif dbbrowser.type == 'pma' %}
pma:
image: 'phpmyadmin/phpmyadmin:5'
......@@ -123,7 +123,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_pma_1'
traefik.port: '80'
traefik.frontend.rule: 'Host:pma.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:pma.{{ projectname }}.{{ traefik.domain }}'
{% endif %}
{% if solr.enable %}
......@@ -134,7 +134,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_solr_1'
traefik.port: '8983'
traefik.frontend.rule: 'Host:solr.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:solr.{{ projectname }}.{{ traefik.domain }}'
{% endif %}
mailhog:
......@@ -142,7 +142,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_mailhog_1'
traefik.port: '8025'
traefik.frontend.rule: 'Host:mailhog.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:mailhog.{{ projectname }}.{{ traefik.domain }}'
{% if node.enable %}
nodejs:
......@@ -152,7 +152,7 @@ services:
labels:
traefik.backend: 'nodejs'
traefik.port: '8080'
traefik.frontend.rule: 'Host:nodejs.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:nodejs.{{ projectname }}.{{ traefik.domain }}'
volumes:
- {{ projectroot }}/{{ node.path }}:/app
command: sh -c 'npm install && npm run start'
......@@ -163,7 +163,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_node_1'
traefik.port: '3000'
traefik.frontend.rule: 'Host:front.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:front.{{ projectname }}.{{ traefik.domain }}'
expose:
- '3000'
volumes:
......@@ -210,7 +210,7 @@ services:
labels:
traefik.backend: '{{ projectname }}_webgrind_1'
traefik.port: '8080'
traefik.frontend.rule: 'Host:webgrind.{{ projectname }}.docker.localhost'
traefik.frontend.rule: 'Host:webgrind.{{ projectname }}.{{ traefik.domain }}'
volumes:
- {{ projectroot }}/files:/mnt/files
{% endif %}
......
......@@ -3,7 +3,7 @@ drush:
config:
- '${env.home}/.drush/config/drush.yml'
options:
uri: 'http://{{ projectname }}.docker.localhost:8000'
uri: 'http{% if traefik.usessl %}s{% endif %}://{{ projectname }}.{{ traefik.domain }}{% if traefik.usessl and traefik.ports != 443 %}:{{ traefik.ports }}{% elseif not traefik.usessl and traefik.port != 80 %}:{{ traefik.port }}{% endif %}'
command:
core:
rsync:
......
......@@ -46,7 +46,7 @@ $databases = array(
),
);
$base_url = 'http://{{ projectname }}.docker.localhost:8000';
$base_url = 'http{% if traefik.usessl %}s{% endif %}://{{ projectname }}.{{ traefik.domain }}{% if traefik.usessl and traefik.ports != 443 %}:{{ traefik.ports }}{% elseif not traefik.usessl and traefik.port != 80 %}:{{ traefik.port }}{% endif %}';
$conf['smtp_host'] = 'mailhog';
$conf['smtp_hostbackup'] = '';
$conf['smtp_port'] = '1025';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment