Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3929596
D2084.id5260.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D2084.id5260.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D2084: WIP: Use Docker pillar information in nginx config
Attached
Detach File
Event Timeline
Log In to Comment