diff --git a/pillar/webserver/sites.sls b/pillar/webserver/sites.sls index 42df544..6c0f5b3 100644 --- a/pillar/webserver/sites.sls +++ b/pillar/webserver/sites.sls @@ -1,95 +1,96 @@ # ------------------------------------------------------------- # Salt — Sites to provision on the legacy web server # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- # ------------------------------------------------------------- # Domains we deploy # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - web_domains: # # Directly managed by Nasqueron # nasqueron: - nasqueron.org # # Nasqueron members # nasqueron_members: - dereckson.be # # Wolfplex # wolfplex: - wolfplex.be # ------------------------------------------------------------- # Static sites # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - web_static_sites: nasqueron.org: - www - assets - docker - ftp - trustspace # ------------------------------------------------------------- # PHP sites # # Username must be unique and use max 31 characters. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - php_fpm_instances: # PHP 7.1, generally installed as package/port prod: command: /usr/local/sbin/php-fpm web_php_sites: www.dereckson.be: user: web-be-dereckson-www source: wwwroot/dereckson.be/www target: /var/wwwroot/dereckson.be/www autochmod: True php-fpm: prod # ------------------------------------------------------------- # States # # Sites with states documenting how to build them # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - web_content_sls: # # Eglide # shellserver: # Third party sites hosted to Eglide - .com/paysannerebelle # Directly managed by Eglide project - .org/eglide # # Nasqueron servers # mastodon: - .org/nasqueron/social webserver-legacy: # Nasqueron members - .be/dereckson # Directly managed by Nasqueron + - .org/nasqueron/api - .org/nasqueron/docs # ------------------------------------------------------------- # Tweaks # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - web_autochmod: - /var/wwwroot/dereckson.be/www diff --git a/roles/webserver-content/init.sls b/roles/webserver-content/init.sls index 8cb016b..c6026a4 100644 --- a/roles/webserver-content/init.sls +++ b/roles/webserver-content/init.sls @@ -1,14 +1,15 @@ # ------------------------------------------------------------- # Salt — Webserver content # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Eglide # Created: 2017-11-23 # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- include: - .be/dereckson - .com/paysannerebelle - .org/eglide + - .org/nasqueron/api - .org/nasqueron/docs - .org/nasqueron/social diff --git a/roles/webserver-legacy/nginx/config.sls b/roles/webserver-content/org/nasqueron/api.sls similarity index 51% copy from roles/webserver-legacy/nginx/config.sls copy to roles/webserver-content/org/nasqueron/api.sls index 85a349d..a8bc449 100644 --- a/roles/webserver-legacy/nginx/config.sls +++ b/roles/webserver-content/org/nasqueron/api.sls @@ -1,21 +1,25 @@ # ------------------------------------------------------------- -# Salt — Sites to provision on the legacy web server +# Salt — Provision api.nasqueron.org website # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- -{% from "map.jinja" import dirs with context %} +{% if salt['node.has_web_content'](".org/nasqueron/api") %} # ------------------------------------------------------------- -# includes folder -# -# :: general configuration -# :: application-specific code -# ------------------------------------------------------------- +# Base part from rOPS +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{{ dirs.etc }}/nginx/includes: +/var/wwwroot/nasqueron.org/api: file.recurse: - - source: salt://roles/webserver-legacy/nginx/files/includes + - source: salt://wwwroot/nasqueron.org/api + - exclude_pat: E@.git + - include_empty: True + - clean: False - dir_mode: 755 - file_mode: 644 + - user: deploy + - group: web + +{% endif %} diff --git a/roles/webserver-legacy/nginx/config.sls b/roles/webserver-legacy/nginx/config.sls index 85a349d..3e200b9 100644 --- a/roles/webserver-legacy/nginx/config.sls +++ b/roles/webserver-legacy/nginx/config.sls @@ -1,21 +1,31 @@ # ------------------------------------------------------------- # Salt — Sites to provision on the legacy web server # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- {% from "map.jinja" import dirs with context %} # ------------------------------------------------------------- # includes folder # # :: general configuration # :: application-specific code # ------------------------------------------------------------- {{ dirs.etc }}/nginx/includes: file.recurse: - source: salt://roles/webserver-legacy/nginx/files/includes - dir_mode: 755 - file_mode: 644 + +# ------------------------------------------------------------- +# vhosts folder +# ------------------------------------------------------------- + +{{ dirs.etc }}/nginx/vhosts: + file.recurse: + - source: salt://roles/webserver-legacy/nginx/files/vhosts + - dir_mode: 755 + - file_mode: 644 diff --git a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf new file mode 100644 index 0000000..add4bb8 --- /dev/null +++ b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf @@ -0,0 +1,38 @@ +# ------------------------------------------------------------- +# Webserver +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Nasqueron +# Site: api.nasqueron.org +# License: Trivial work, not eligible to copyright +# Source file: roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf +# ------------------------------------------------------------- +# +# +# 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. +# + +server { + listen 80; + listen [::]:80; + server_name api.nasqueron.org; + + return 301 https://api.nasqueron.org$request_uri; +} + +server { + server_name api.nasqueron.org; + + include includes/tls; + ssl_certificate /usr/local/etc/letsencrypt/live/api.nasqueron.org/fullchain.pem; + ssl_certificate_key /usr/local/etc/letsencrypt/live/api.nasqueron.org/privkey.pem; + + error_log /var/log/www/nasqueron.org/api-error.log; + access_log /var/log/www/nasqueron.org/api-access.log; + + root /var/wwwroot/nasqueron.org/api; + + include includes/letsencrypt; +}