From d0f02b7268d929c1b6321f3c3906167e1ccfc31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Sun, 6 Jan 2019 21:27:17 +0100 Subject: [PATCH] Re-add dependency of nginx to lms/cms We re-introduce the dependency of the nginx container on the lms/cms images. This dependency was removed to address a debugging scenario which is actually not practical. Without this dependency, we are forced to use an external docker-specific resolver which makes the local nginx configuration incompatible with the kubernetes configuration. --- deploy/local/templates/docker-compose.yml | 4 ++++ deploy/templates/nginx/cms.conf | 9 +++++---- deploy/templates/nginx/extra.conf | 9 +++++---- deploy/templates/nginx/lms.conf | 9 +++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/deploy/local/templates/docker-compose.yml b/deploy/local/templates/docker-compose.yml index 945ae00..9ba0ffc 100644 --- a/deploy/local/templates/docker-compose.yml +++ b/deploy/local/templates/docker-compose.yml @@ -47,6 +47,10 @@ services: - ../env/nginx:/etc/nginx/conf.d/ - ../../data/openedx:/var/www/openedx:ro - ../../data/letsencrypt:/etc/letsencrypt/:ro + depends_on: + - lms + - cms + {% if ACTIVATE_NOTES %}- notes{% endif %} rabbitmq: image: rabbitmq:3.6.10 diff --git a/deploy/templates/nginx/cms.conf b/deploy/templates/nginx/cms.conf index 0d525e8..045aaa8 100644 --- a/deploy/templates/nginx/cms.conf +++ b/deploy/templates/nginx/cms.conf @@ -1,3 +1,7 @@ +upstream cms-backend { + server cms:8000 fail_timeout=0; +} + {% if ACTIVATE_HTTPS %} server { server_name {{ CMS_HOST }}; @@ -31,10 +35,7 @@ server { proxy_set_header Host $http_host; proxy_redirect off; - # Docker resolver - resolver 127.0.0.11 valid=10s; - set $upstream cms; - proxy_pass http://$upstream:8000; + proxy_pass http://cms-backend; } location / { diff --git a/deploy/templates/nginx/extra.conf b/deploy/templates/nginx/extra.conf index b6c33c1..3792183 100644 --- a/deploy/templates/nginx/extra.conf +++ b/deploy/templates/nginx/extra.conf @@ -1,4 +1,8 @@ {% if ACTIVATE_NOTES %} +upstream notes-backend { + server notes:8000 fail_timeout=0; +} + {% if ACTIVATE_HTTPS %} server { server_name notes.{{ LMS_HOST }}; @@ -26,10 +30,7 @@ server { proxy_set_header Host $http_host; proxy_redirect off; - # Docker resolver - resolver 127.0.0.11 valid=10s; - set $upstream notes; - proxy_pass http://$upstream:8000; + proxy_pass http://notes-backend:8000; } } {% endif %} diff --git a/deploy/templates/nginx/lms.conf b/deploy/templates/nginx/lms.conf index 295dbc1..ba52ed8 100644 --- a/deploy/templates/nginx/lms.conf +++ b/deploy/templates/nginx/lms.conf @@ -1,3 +1,7 @@ +upstream lms-backend { + server lms:8000 fail_timeout=0; +} + {% if ACTIVATE_HTTPS %} server { server_name {{ LMS_HOST }} preview.{{ LMS_HOST }}; @@ -31,10 +35,7 @@ server { proxy_set_header Host $http_host; proxy_redirect off; - # Docker resolver - resolver 127.0.0.11 valid=10s; - set $upstream lms; - proxy_pass http://$upstream:8000; + proxy_pass http://lms-backend; } location / {