From 8d66952c49fbbca985919110ecc40c729211f6b3 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sun, 2 Jul 2023 16:31:23 +0200 Subject: [PATCH 1/3] Add a template for spaceapi handling on pottwal --- templates/pottwal/spaceapi-apache-site.j2 | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 templates/pottwal/spaceapi-apache-site.j2 diff --git a/templates/pottwal/spaceapi-apache-site.j2 b/templates/pottwal/spaceapi-apache-site.j2 new file mode 100644 index 0000000..5d6961d --- /dev/null +++ b/templates/pottwal/spaceapi-apache-site.j2 @@ -0,0 +1,53 @@ +{% if 'address' in ansible_default_ipv6 %} + +{% else %} + +{% endif %} + ServerAdmin {{ server_admin }} + ServerName {{ site_name }} + ServerAlias {{ site_name }} + ErrorLog /var/log/apache2/{{ site_name }}-error.log + CustomLog /var/log/apache2/{{ site_name }}-access.log common + + Alias /.well-known/acme-challenge {{ dehydrated_wellknown_dir }} + + + RewriteEngine On + RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/ + RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] + + + + + + +{% if 'address' in ansible_default_ipv6 %} + +{% else %} + +{% endif %} + ServerAdmin {{ server_admin }} + ServerName {{ site_name }} + ServerAlias {{ site_name }} + + ErrorLog /var/log/apache2/{{ site_name }}-error.log + CustomLog /var/log/apache2/{{ site_name }}-access.log common + + SSLEngine on + SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown + SSLCertificateFile {{dehydrated_certs_dir}}/{{ site_name }}/cert.pem + SSLCertificateKeyFile {{dehydrated_certs_dir}}/{{ site_name }}/privkey.pem + SSLCertificateChainFile {{dehydrated_certs_dir}}/{{ site_name }}/chain.pem + + AllowEncodedSlashes NoDecode + RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} + RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS} + ProxyPreserveHost {{ proxy_preserve_host | default("Off") }} + + ProxyPass /json http://172.23.48.7/spaceapi + ProxyPass /text http://172.23.48.7/state.txt + ProxyPass /state.png http://172.23.48.7/state.png + + + + From ed29dc7221ea50ae2756489f4cce960aa1fb08d1 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sun, 2 Jul 2023 16:31:38 +0200 Subject: [PATCH 2/3] Create spaceapi.n39.eu site on pottwal --- host-pottwal.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/host-pottwal.yml b/host-pottwal.yml index a09d591..e1f265f 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -24,6 +24,7 @@ - name: uptime.n39.eu - name: "{{ grafana_domain_name }}" - name: "{{ homebox_domain_name }}" + - name: spaceapi.n39.eu - role: penguineer.dehydrated_cron - role: dd24_dyndns_cron # variables are set in the inventory @@ -513,9 +514,27 @@ proxy_port: "{{ homebox_host_port }}" proxy_preserve_host: "On" + - name: Setup proxy site spaceapi.n39.eu + template: + src: templates/pottwal/spaceapi-apache-site.j2 + dest: /etc/apache2/sites-available/spaceapi.n39.eu.conf + mode: "0644" + vars: + site_name: "spaceapi.n39.eu" + proxy_preserve_host: "On" + notify: Restart apache2 + tags: + - dev + handlers: - name: Restart prosody community.docker.docker_container: name: prosody state: started restart: yes + + - name: Restart apache2 + service: + name: apache2 + state: restarted + From e9d700eef4d7b4ad2a3de7c22c3b0caf8eca8405 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sun, 2 Jul 2023 16:31:50 +0200 Subject: [PATCH 3/3] Move spaceapi handling to pottwal on holmium --- host-holmium.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/host-holmium.yml b/host-holmium.yml index a6620c7..6cd608e 100644 --- a/host-holmium.yml +++ b/host-holmium.yml @@ -9,9 +9,6 @@ - role: nginx_https_ingress vars: ingress: - - server: kant - hosts: - - name: spaceapi.n39.eu - server: krypton hosts: - name: entities.svc.n39.eu @@ -31,6 +28,7 @@ - name: uptime.n39.eu - name: grafana.n39.eu - name: inventory.n39.eu + - name: spaceapi.n39.eu - server: radon hosts: - name: nodered.n39.eu