Page MenuHomeDevCentral

D1259.id3237.diff
No OneTemporary

D1259.id3237.diff

diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -14,8 +14,8 @@
- certificates.certificates
- nodes.nodes
- nodes.forests
+ - webserver.sites
ysul:
- paas-jails.jails
- - webserver-legacy.sites
- viperserv.bots
- viperserv.fantoir
diff --git a/pillar/webserver-legacy/sites.sls b/pillar/webserver/sites.sls
rename from pillar/webserver-legacy/sites.sls
rename to pillar/webserver/sites.sls
--- a/pillar/webserver-legacy/sites.sls
+++ b/pillar/webserver/sites.sls
@@ -57,6 +57,20 @@
autochmod: True
php-fpm: prod
+# -------------------------------------------------------------
+# States
+#
+# Sites with states documenting how to build them
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+web_content_sls:
+ shellserver:
+ - .com/paysannerebelle
+ - .org/eglide
+ webserver-legacy:
+ - .be/dereckson
+ - .org/nasqueron
+
# -------------------------------------------------------------
# Tweaks
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/roles/shellserver/web-hosting/init.sls b/roles/shellserver/web-hosting/init.sls
--- a/roles/shellserver/web-hosting/init.sls
+++ b/roles/shellserver/web-hosting/init.sls
@@ -7,6 +7,7 @@
# -------------------------------------------------------------
{% from "map.jinja" import dirs with context %}
+{% set wwwgroup = "www-data" %}
# -------------------------------------------------------------
# Nginx configuration files
@@ -32,7 +33,19 @@
/var/log/www:
file.directory:
- user: root
- - group: www-data
+ - group: {{ wwwgroup }}
+ - dir_mode: 750
+
+/var/log/www/eglide.org:
+ file.directory:
+ - user: root
+ - group: {{ wwwgroup }}
+ - dir_mode: 750
+
+/var/log/www/paysannerebelle.com:
+ file.directory:
+ - user: hlp
+ - group: {{ wwwgroup }}
- dir_mode: 750
# -------------------------------------------------------------
diff --git a/roles/webserver-content/README.md b/roles/webserver-content/README.md
new file mode 100644
--- /dev/null
+++ b/roles/webserver-content/README.md
@@ -0,0 +1,62 @@
+# Webserver content
+
+## Goal of this role
+
+This role provisions the `/var/wwwroot` folder with the website content,
+when there is a custom logic to prepare it, like a specific Git repository
+to clone, or a build process to follow.
+
+This roles does NOT describe web server configuration,
+which is done in other `webserver-` roles.
+
+## Structure
+
+This role doesn't follow the role/unit folder hierarchy.
+
+Instead, it follows a tld/domain/subdomain.sls logic.
+
+For example, the folder for the `*.acme.tld` sites will be `tld/acme`.
+This structure goal is to play nice with the Salt include syntax, as dots
+are a directory spearator.
+
+The bipbip.acme.tld site will be described in `tld/acme/bipbip.sls` file.
+
+## Add a new domain
+
+ 1. Create a new folder hierarchy for the domain
+ 2. Include a `init.sls` file for your subdomains
+ 3. Declare the new domain in pillar/webserver/sites.sls
+
+For example the tld/acme/init.sls file could be:
+```
+include:
+ - .www
+ - .acme
+```
+
+Alphabetical order is followed, but www is generally first.
+
+In the pillar file, website are assigned to a role.
+
+If you wish to deploy all the sites on one role, you can directly include
+the folder, and your init.sls will do the rest.
+
+If not, two strategies exist: you can use node.filter_by_role in your
+init.sls too or perhaps more simply you can document in init.sls this
+roles can't be deployed directly, and make references to sls files in
+the pillar (without final .sls extension).
+
+For example to deploy bipbip.acme.tld (`tld/acme/bipbip.sls`) on servers with the shellserver role:
+
+```
+shellserver:
+ - .tld/acme/bibpip
+```
+
+## Prune old files
+
+If you need to prune a former website, you can add
+the directory to the /hotfixes/old-directories.sls state.
+
+There is no need to revert your commit when the
+directories or files are deleted.
diff --git a/roles/webserver-legacy/be/dereckson/assets.sls b/roles/webserver-content/be/dereckson/assets.sls
rename from roles/webserver-legacy/be/dereckson/assets.sls
rename to roles/webserver-content/be/dereckson/assets.sls
diff --git a/roles/webserver-legacy/be/dereckson/init.sls b/roles/webserver-content/be/dereckson/init.sls
rename from roles/webserver-legacy/be/dereckson/init.sls
rename to roles/webserver-content/be/dereckson/init.sls
diff --git a/roles/webserver-legacy/org/nasqueron/init.sls b/roles/webserver-content/com/paysannerebelle/init.sls
rename from roles/webserver-legacy/org/nasqueron/init.sls
rename to roles/webserver-content/com/paysannerebelle/init.sls
--- a/roles/webserver-legacy/org/nasqueron/init.sls
+++ b/roles/webserver-content/com/paysannerebelle/init.sls
@@ -1,9 +1,9 @@
# -------------------------------------------------------------
-# Salt — Provision *.nasqueron.org sites
+# Salt — Provision *.paysannerebelle.com sites
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Project: Nasqueron
+# Project: Collectif des paysannes et paysans rebelles
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- - .docs
+ - .robot
diff --git a/roles/webserver-content/com/paysannerebelle/robot.sls b/roles/webserver-content/com/paysannerebelle/robot.sls
new file mode 100644
--- /dev/null
+++ b/roles/webserver-content/com/paysannerebelle/robot.sls
@@ -0,0 +1,20 @@
+# -------------------------------------------------------------
+# Salt — Provision robot.paysannerebelle.com website
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Collectif des paysannes et paysans rebelles
+# Created: 2017-04-16
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% set wwwgroup = "www-data" %}
+
+# -------------------------------------------------------------
+# Site directory
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/var/wwwroot/paysannerebelle.com/robot:
+ file.directory:
+ - user: hlp
+ - group: {{ wwwgroup }}
+ - dir_mode: 711
+ - makedirs: True
diff --git a/roles/webserver-legacy/org/nasqueron/init.sls b/roles/webserver-content/init.sls
copy from roles/webserver-legacy/org/nasqueron/init.sls
copy to roles/webserver-content/init.sls
--- a/roles/webserver-legacy/org/nasqueron/init.sls
+++ b/roles/webserver-content/init.sls
@@ -1,9 +1,10 @@
# -------------------------------------------------------------
-# Salt — Provision *.nasqueron.org sites
+# Salt — Webserver content
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
+# Created: 2017-11-23
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- - .docs
+ {{ salt['node.filter_by_role'](pillar['web_content_sls']) }}
diff --git a/roles/shellserver/eglide-website/init.sls b/roles/webserver-content/org/eglide/www.sls
rename from roles/shellserver/eglide-website/init.sls
rename to roles/webserver-content/org/eglide/www.sls
--- a/roles/shellserver/eglide-website/init.sls
+++ b/roles/webserver-content/org/eglide/www.sls
@@ -32,26 +32,3 @@
- group: {{ wwwgroup }}
- dir_mode: 711
- file_mode: 644
-
-/var/wwwroot/paysannerebelle.com/robot/:
- file.directory:
- - user: hlp
- - group: {{ wwwgroup }}
- - dir_mode: 711
- - makedirs: True
-
-# -------------------------------------------------------------
-# Nginx logs
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-/var/log/www/eglide.org:
- file.directory:
- - user: root
- - group: {{ wwwgroup }}
- - dir_mode: 750
-
-/var/log/www/paysannerebelle.com:
- file.directory:
- - user: hlp
- - group: {{ wwwgroup }}
- - dir_mode: 750
diff --git a/roles/webserver-legacy/org/nasqueron/docs.sls b/roles/webserver-content/org/nasqueron/docs.sls
rename from roles/webserver-legacy/org/nasqueron/docs.sls
rename to roles/webserver-content/org/nasqueron/docs.sls
diff --git a/roles/webserver-legacy/org/nasqueron/files/build-docs-salt-wrapper.sh b/roles/webserver-content/org/nasqueron/files/build-docs-salt-wrapper.sh
rename from roles/webserver-legacy/org/nasqueron/files/build-docs-salt-wrapper.sh
rename to roles/webserver-content/org/nasqueron/files/build-docs-salt-wrapper.sh
diff --git a/roles/webserver-legacy/org/nasqueron/init.sls b/roles/webserver-content/org/nasqueron/init.sls
rename from roles/webserver-legacy/org/nasqueron/init.sls
rename to roles/webserver-content/org/nasqueron/init.sls

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 03:21 (50 m, 55 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259436
Default Alt Text
D1259.id3237.diff (8 KB)

Event Timeline