Skip to content

Commit

Permalink
Allow HTTPS for traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
OdyX committed Jun 26, 2019
1 parent 571f6ba commit 368f6d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ You can change the configuration of the docker images by setting various environ
| `MOODLE_DOCKER_WEB_PORT` | no | any integer value | 8000 | The port number for web. If set to 0, no port is used |
| `MOODLE_DOCKER_SELENIUM_VNC_PORT` | no | any integer value | not set | If set, the selenium node will expose a vnc session on the port specified |
| `MOODLE_DOCKER_TRAEFIK` | no | any value | not set | If set, integrate the docker containers in traefik |
| `MOODLE_DOCKER_TRAEFIK_HTTPS` | no | any value | not set | If set, use an https url in traefik |

## Advanced usage

Expand Down
7 changes: 6 additions & 1 deletion config.docker-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
}
$CFG->wwwroot = "http://{$host}";
$port = getenv('MOODLE_DOCKER_WEB_PORT');
if (!empty($port) && empty(getenv('MOODLE_DOCKER_TRAEFIK'))) {
if (!empty(getenv('MOODLE_DOCKER_TRAEFIK'))) {
if (!empty(getenv('MOODLE_DOCKER_TRAEFIK_HTTPS'))) {
$CFG->sslproxy = true;
$CFG->wwwroot = "https://{$host}";
}
} else if (!empty($port)) {
$CFG->wwwroot .= ":{$port}";
}
$CFG->dataroot = '/var/www/moodledata';
Expand Down
1 change: 1 addition & 0 deletions traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
webserver:
environment:
MOODLE_DOCKER_TRAEFIK: "${MOODLE_DOCKER_TRAEFIK}"
MOODLE_DOCKER_TRAEFIK_HTTPS: "${MOODLE_DOCKER_TRAEFIK_HTTPS}"
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:${MOODLE_DOCKER_WEB_HOST}"
Expand Down

0 comments on commit 368f6d1

Please sign in to comment.