summaryrefslogtreecommitdiffstats
path: root/roles/cgit
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-16 17:36:44 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-16 17:36:44 +0200
commite8c668bc0bbf46bd2ca6e8c946ad297b157dd347 (patch)
tree7b7cf0b132b0d86ee671f44d2cb37a4d5eb1ade7 /roles/cgit
parentb8a256f91c0d278e38f19943eca53951aa7c4946 (diff)
Allow cgit to theoretically deploy to public URL
Diffstat (limited to 'roles/cgit')
-rw-r--r--roles/cgit/meta/argument_specs.yml4
-rw-r--r--roles/cgit/templates/cgit.caddy.j27
-rw-r--r--roles/cgit/templates/cgit.nginx.conf.j216
3 files changed, 22 insertions, 5 deletions
diff --git a/roles/cgit/meta/argument_specs.yml b/roles/cgit/meta/argument_specs.yml
index 9dbe28b1..652598de 100644
--- a/roles/cgit/meta/argument_specs.yml
+++ b/roles/cgit/meta/argument_specs.yml
@@ -34,3 +34,7 @@ argument_specs:
type: "str"
description: "Inventory hostname of the proxy container to deploy vhost on"
default: "proxy.home.arpa"
+ cgit_public_hostname:
+ type: "str"
+ description: "Optional public hostname for cgit (e.g. git.a14m.dev); enables public vhost block with TLS"
+ required: false
diff --git a/roles/cgit/templates/cgit.caddy.j2 b/roles/cgit/templates/cgit.caddy.j2
index 8ddc6d88..7b04a77b 100644
--- a/roles/cgit/templates/cgit.caddy.j2
+++ b/roles/cgit/templates/cgit.caddy.j2
@@ -1,3 +1,10 @@
{{ cgit_hostname }} {
+ tls internal
reverse_proxy {{ network_ipv4_address }}:{{ cgit_port }}
}
+{% if cgit_public_hostname is defined %}
+
+{{ cgit_public_hostname }} {
+ reverse_proxy {{ network_ipv4_address }}:{{ cgit_port }}
+}
+{% endif %}
diff --git a/roles/cgit/templates/cgit.nginx.conf.j2 b/roles/cgit/templates/cgit.nginx.conf.j2
index 62fa6669..4ac0ae43 100644
--- a/roles/cgit/templates/cgit.nginx.conf.j2
+++ b/roles/cgit/templates/cgit.nginx.conf.j2
@@ -1,22 +1,28 @@
server {
listen 80;
listen [::]:80;
-
server_name {{ cgit_hostname }};
+ location / {
+ proxy_pass http://{{ network_ipv4_address }}:{{ cgit_port }};
+ }
+}
+{% if cgit_public_hostname is defined %}
+server {
+ listen 80;
+ listen [::]:80;
+ server_name {{ cgit_public_hostname }};
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
-
- server_name {{ cgit_hostname }};
-
+ server_name {{ cgit_public_hostname }};
ssl_certificate {{ nginx_ssl_certificate }};
ssl_certificate_key {{ nginx_ssl_certificate_key }};
-
location / {
proxy_pass http://{{ network_ipv4_address }}:{{ cgit_port }};
}
}
+{% endif %}