diff --git a/software/manifests/server.pp b/software/manifests/server.pp index 8d812d2..15d477a 100644 --- a/software/manifests/server.pp +++ b/software/manifests/server.pp @@ -58,6 +58,22 @@ require => Package['nginx'], notify => Service['Nginx'] } + + file { '/etc/nginx/sites-enabled/gitea.conf': + ensure => present, + content => epp('software/gitea.conf', { 'key' => $key_file, 'cert' => $cert_file }), + mode => "0644", + require => Package['nginx'], + notify => Service['Nginx'] + } + + file { '/etc/nginx/sites-enabled/gotify.conf': + ensure => present, + content => epp('software/gotify.conf', { 'key' => $key_file, 'cert' => $cert_file }), + mode => "0644", + require => Package['nginx'], + notify => Service['Nginx'] + } file { '/etc/nginx/sites-enabled/exporter.conf': ensure => present, diff --git a/software/templates/gitea.conf.epp b/software/templates/gitea.conf.epp new file mode 100644 index 0000000..d539262 --- /dev/null +++ b/software/templates/gitea.conf.epp @@ -0,0 +1,21 @@ +<%- | String $key, String $cert | -%> +upstream gitea { + server 127.0.0.1:3003; +} + +server { + listen <%= $facts['networking']['ip'] %>:3000 ssl; + server_name _; + + ssl_certificate <%= $cert %>; # managed by Certbot + ssl_certificate_key <%= $key %>; # managed by Certbot + + location / { + proxy_pass http://gitea; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_set_header Origin ""; + } +} diff --git a/software/templates/gotify.conf.epp b/software/templates/gotify.conf.epp new file mode 100644 index 0000000..383fa8a --- /dev/null +++ b/software/templates/gotify.conf.epp @@ -0,0 +1,23 @@ +<%- | String $key, String $cert | -%> +upstream gotify { + server 127.0.0.1:3001; +} + +server { + listen <%= $facts['networking']['ip'] %>:3001 ssl; + server_name _; + + ssl_certificate <%= $cert %>; # managed by Certbot + ssl_certificate_key <%= $key %>; # managed by Certbot + + location / { + proxy_pass http://gotify; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + + proxy_set_header Origin ""; + } +}