[extensions-web/wip/openshift] openshift: provide correct address of Django backend



commit a97a7b4a1d7bc021ba92a7858e898a014d6db23e
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Thu Dec 6 18:53:42 2018 +0400

    openshift: provide correct address of Django backend

 openshift/docker/docker-compose.yml           |  2 ++
 openshift/docker/nginx/Dockerfile             |  4 +++-
 openshift/docker/nginx/nginx.conf             |  2 +-
 openshift/templates/extensions-web-nginx.json | 18 ++++++++++++++++--
 4 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/openshift/docker/docker-compose.yml b/openshift/docker/docker-compose.yml
index c202dfc..3762229 100644
--- a/openshift/docker/docker-compose.yml
+++ b/openshift/docker/docker-compose.yml
@@ -38,6 +38,8 @@ services:
     build:
       context: nginx
       dockerfile: Dockerfile
+    environment:
+      EGO_NODE_ADDRESS: extensions-web
     restart: always
     links:
       - extensions-web
diff --git a/openshift/docker/nginx/Dockerfile b/openshift/docker/nginx/Dockerfile
index 45dbeca..a82c234 100644
--- a/openshift/docker/nginx/Dockerfile
+++ b/openshift/docker/nginx/Dockerfile
@@ -2,9 +2,11 @@ FROM nginx:stable
 
 MAINTAINER Yuri Konotopov <ykonotopov gnome org>
 
-COPY nginx.conf /etc/nginx
+COPY nginx.conf /tmp
 
 RUN set -ex \
+       && envsubst < /tmp/nginx.conf > /etc/nginx/nginx.conf \
+       && rm /tmp/nginx.conf \
        && mkdir -p /extensions-web/www \
        && chmod g+rwX -R /extensions-web/www \
        && chmod g+rwX -R /var/log/nginx \
diff --git a/openshift/docker/nginx/nginx.conf b/openshift/docker/nginx/nginx.conf
index 427d86e..33ac82f 100644
--- a/openshift/docker/nginx/nginx.conf
+++ b/openshift/docker/nginx/nginx.conf
@@ -57,7 +57,7 @@ http {
         }
 
         location / {
-            uwsgi_pass  extensions-web:8001;
+            uwsgi_pass  ${EGO_NODE_ADDRESS}:8001;
             include     uwsgi_params;
         }
     }
diff --git a/openshift/templates/extensions-web-nginx.json b/openshift/templates/extensions-web-nginx.json
index c56ca62..83b91ca 100644
--- a/openshift/templates/extensions-web-nginx.json
+++ b/openshift/templates/extensions-web-nginx.json
@@ -61,7 +61,7 @@
           }
         ],
         "selector": {
-          "name": "frontend"
+          "name": "extensions-web"
         }
       }
     },
@@ -181,7 +181,15 @@
           "contextDir": "openshift/docker/nginx"
         },
         "strategy": {
-          "type": "Docker"
+          "type": "Docker",
+          "dockerStrategy": {
+            "env": [
+              {
+                "name": "EGO_NODE_ADDRESS",
+                "value": "${EGO_NODE_ADDRESS}"
+              }
+            ]
+          }
         },
         "output": {
           "to": {
@@ -437,6 +445,12 @@
       "description": "Database URL in format suitable for dj-database-url",
       "value": ""
     },
+    {
+      "name": "EGO_NODE_ADDRESS",
+      "displayName": "Address of extensions-web container",
+      "description": "Either DNS name or IP address. Should be localhost for Openshift.",
+      "value": "localhost"
+    },
     {
       "name": "EGO_SECRET_KEY",
       "displayName": "Django secret key",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]