Page MenuHomeDevCentral

D1413.id3651.diff
No OneTemporary

D1413.id3651.diff

diff --git a/pillar/paas/docker.sls b/pillar/paas/docker.sls
--- a/pillar/paas/docker.sls
+++ b/pillar/paas/docker.sls
@@ -30,4 +30,7 @@
docker_containers:
equatower:
- - jenkins # CD
+ # CD
+ jenkins:
+ host: cd.nasqueron.org
+ app_port: 38080
diff --git a/roles/paas-docker/containers/init.sls b/roles/paas-docker/containers/init.sls
--- a/roles/paas-docker/containers/init.sls
+++ b/roles/paas-docker/containers/init.sls
@@ -6,7 +6,7 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% set containers = salt['pillar.get']('docker_containers:' + grains['id'], []) %}
+{% set containers = salt['node.filter_by_name']('docker_containers') %}
include:
{% for container in containers %}
diff --git a/roles/paas-docker/nginx/config.sls b/roles/paas-docker/nginx/config.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/nginx/config.sls
@@ -0,0 +1,40 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-03-16
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+{% set containers = salt['pillar.get']('docker_containers:' + grains['id'], {}) %}
+
+# -------------------------------------------------------------
+# includes folder
+#
+# :: general configuration
+# :: application-specific code
+# -------------------------------------------------------------
+
+{{ dirs.etc }}/nginx/includes:
+ file.recurse:
+ - source: salt://roles/paas-docker/nginx/files/includes
+ - dir_mode: 755
+ - file_mode: 644
+
+# -------------------------------------------------------------
+# vhosts folder
+# -------------------------------------------------------------
+
+{% for container, args in containers.items() %}
+
+{{ dirs.etc }}/nginx/vhosts/{{ container }}.conf:
+ file.managed:
+ - source: salt://roles/paas-docker/nginx/files/vhosts/{{ container }}.conf
+ - mode: 644
+ - template: jinja
+ - context:
+ fqdn: {{ args['host'] }}
+ app_port: {{ args['app_port'] }}
+
+{% endfor %}
diff --git a/roles/paas-docker/nginx/files/includes/letsencrypt b/roles/paas-docker/nginx/files/includes/letsencrypt
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/nginx/files/includes/letsencrypt
@@ -0,0 +1,20 @@
+# -------------------------------------------------------------
+# Configuration for Let's encrypt nginx
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Author: Sébastien Santoro aka Dereckson
+# Created: 2016-01-05
+# Description: Get SSL certificates from Let's encrypt
+# Source file: roles/paas-docker/nginx/files/includes/letsencrypt
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+ location /.well-known/acme-challenge {
+ default_type text/plain;
+ root /data/letsencrypt/www;
+ }
diff --git a/roles/paas-docker/nginx/files/vhosts/jenkins.conf b/roles/paas-docker/nginx/files/vhosts/jenkins.conf
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/nginx/files/vhosts/jenkins.conf
@@ -0,0 +1,43 @@
+# -------------------------------------------------------------
+# Configuration for Docker PaaS front-end nginx
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Author: Sébastien Santoro aka Dereckso
+# Created: 2018-03-12
+# Source file: roles/paas-docker/nginx/files/vhosts/jenkins.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+server {
+ listen 80;
+ listen [::]:80;
+ server_name {{ fqdn }};
+
+ include includes/letsencrypt;
+
+ return 301 https://$host$request_uri;
+}
+
+server {
+ server_name {{ fqdn }};
+
+ include ssl_params;
+ ssl_certificate /data/letsencrypt/etc/live/{{ fqdn }}/fullchain.pem;
+ ssl_certificate_key /data/letsencrypt/etc/live/{{ fqdn }}/privkey.pem;
+
+ location / {
+ proxy_redirect http:// https://;
+ proxy_pass http://localhost:{{ app_port }};
+
+ # Required for new HTTP-based CLI
+ # https://wiki.jenkins.io/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy
+ proxy_http_version 1.1;
+ proxy_request_buffering off;
+ proxy_buffering off; # Required for HTTP-based CLI to work over SSL
+ }
+}
diff --git a/roles/paas-docker/containers/init.sls b/roles/paas-docker/nginx/init.sls
copy from roles/paas-docker/containers/init.sls
copy to roles/paas-docker/nginx/init.sls
--- a/roles/paas-docker/containers/init.sls
+++ b/roles/paas-docker/nginx/init.sls
@@ -2,13 +2,9 @@
# Salt — Provision Docker engine
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
-# Created: 2018-03-11
+# Created: 2018-03-16
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% set containers = salt['pillar.get']('docker_containers:' + grains['id'], []) %}
-
include:
-{% for container in containers %}
- - .{{ container }}
-{% endfor %}
+ - .config

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 07:29 (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2274237
Default Alt Text
D1413.id3651.diff (5 KB)

Event Timeline