Page MenuHomeDevCentral

D2084.id5260.diff
No OneTemporary

D2084.id5260.diff

diff --git a/_modules/paas_docker.py b/_modules/paas_docker.py
--- a/_modules/paas_docker.py
+++ b/_modules/paas_docker.py
@@ -48,3 +48,23 @@
subnets.append("172.17.0.0/16")
return subnets
+
+
+def get_upstreams():
+ """
+ A function to output a hashmap of applications URLs.
+
+ State Example::
+
+ {% upstreams = salt['paas_docker.get_upstreams']() %}
+ """
+ upstreams = {}
+
+ for server in __pillar__["docker_containers"]:
+ url = "http://" + server + ".nasqueron.org:"
+ for app in pillar["docker_containers"][server]:
+ upstreams.update({key:url + str(args["app_port"])
+ for key, args in pillar["docker_containers"][server][app].items()
+ if "app_port" in args})
+
+ return upstreams
diff --git a/roles/webserver-legacy/nginx/config.sls b/roles/webserver-legacy/nginx/config.sls
--- a/roles/webserver-legacy/nginx/config.sls
+++ b/roles/webserver-legacy/nginx/config.sls
@@ -29,3 +29,6 @@
- source: salt://roles/webserver-legacy/nginx/files/vhosts
- dir_mode: 755
- file_mode: 644
+ - template: jinja
+ - context:
+ upstreams: {{ salt['paas_docker.get_upstreams']() }}
diff --git a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
--- a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
+++ b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
@@ -65,7 +65,7 @@
}
location /docker/registry {
- proxy_pass http://equatower.nasqueron.org:20080/;
+ proxy_pass {{ upstreams['api-docker-registry'] }};
include includes/proxy;
include includes/cors-open;
}
diff --git a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/infra.conf b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/infra.conf
--- a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/infra.conf
+++ b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/infra.conf
@@ -53,7 +53,7 @@
location /cd/dashboard {
rewrite ^/cd/dashboard/?(.*)$ /$1 break;
- proxy_pass http://equatower.nasqueron.org:24180;
+ proxy_pass {{ upstreams['jenkins_cd'] }};
include includes/proxy;
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 09:59 (16 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2312247
Default Alt Text
D2084.id5260.diff (2 KB)

Event Timeline