feat: enable external access to gitea #344
@ -7,6 +7,7 @@ profiles::haproxy::dns::vrrp_cnames:
|
|||||||
- readarr.main.unkin.net
|
- readarr.main.unkin.net
|
||||||
- prowlarr.main.unkin.net
|
- prowlarr.main.unkin.net
|
||||||
- nzbget.main.unkin.net
|
- nzbget.main.unkin.net
|
||||||
|
- git.unkin.net
|
||||||
|
|
||||||
profiles::haproxy::mappings:
|
profiles::haproxy::mappings:
|
||||||
fe_http:
|
fe_http:
|
||||||
@ -22,6 +23,7 @@ profiles::haproxy::mappings:
|
|||||||
- 'nzbget.main.unkin.net be_nzbget'
|
- 'nzbget.main.unkin.net be_nzbget'
|
||||||
- 'jellyfin.main.unkin.net be_jellyfin'
|
- 'jellyfin.main.unkin.net be_jellyfin'
|
||||||
- 'fafflix.unkin.net be_jellyfin'
|
- 'fafflix.unkin.net be_jellyfin'
|
||||||
|
- 'git.unkin.net be_gitea'
|
||||||
fe_https:
|
fe_https:
|
||||||
ensure: present
|
ensure: present
|
||||||
mappings:
|
mappings:
|
||||||
@ -35,6 +37,7 @@ profiles::haproxy::mappings:
|
|||||||
- 'nzbget.main.unkin.net be_nzbget'
|
- 'nzbget.main.unkin.net be_nzbget'
|
||||||
- 'jellyfin.main.unkin.net be_jellyfin'
|
- 'jellyfin.main.unkin.net be_jellyfin'
|
||||||
- 'fafflix.unkin.net be_jellyfin'
|
- 'fafflix.unkin.net be_jellyfin'
|
||||||
|
- 'git.unkin.net be_gitea'
|
||||||
|
|
||||||
profiles::haproxy::frontends:
|
profiles::haproxy::frontends:
|
||||||
fe_http:
|
fe_http:
|
||||||
@ -53,6 +56,7 @@ profiles::haproxy::frontends:
|
|||||||
- 'acl_nzbget req.hdr(host) -i nzbget.main.unkin.net'
|
- 'acl_nzbget req.hdr(host) -i nzbget.main.unkin.net'
|
||||||
- 'acl_jellyfin req.hdr(host) -i jellyfin.main.unkin.net'
|
- 'acl_jellyfin req.hdr(host) -i jellyfin.main.unkin.net'
|
||||||
- 'acl_fafflix req.hdr(host) -i fafflix.unkin.net'
|
- 'acl_fafflix req.hdr(host) -i fafflix.unkin.net'
|
||||||
|
- 'acl_gitea req.hdr(host) -i git.unkin.net'
|
||||||
- 'acl_internalsubnets src 198.18.0.0/16 10.10.12.0/24'
|
- 'acl_internalsubnets src 198.18.0.0/16 10.10.12.0/24'
|
||||||
use_backend:
|
use_backend:
|
||||||
- "%[req.hdr(host),lower,map(/etc/haproxy/fe_https.map,be_default)]"
|
- "%[req.hdr(host),lower,map(/etc/haproxy/fe_https.map,be_default)]"
|
||||||
@ -68,6 +72,7 @@ profiles::haproxy::frontends:
|
|||||||
- 'set-header X-Frame-Options DENY if acl_nzbget'
|
- 'set-header X-Frame-Options DENY if acl_nzbget'
|
||||||
- 'set-header X-Frame-Options DENY if acl_jellyfin'
|
- 'set-header X-Frame-Options DENY if acl_jellyfin'
|
||||||
- 'set-header X-Frame-Options DENY if acl_fafflix'
|
- 'set-header X-Frame-Options DENY if acl_fafflix'
|
||||||
|
- 'set-header X-Frame-Options DENY if acl_gitea'
|
||||||
- 'set-header X-Content-Type-Options nosniff'
|
- 'set-header X-Content-Type-Options nosniff'
|
||||||
- 'set-header X-XSS-Protection 1;mode=block'
|
- 'set-header X-XSS-Protection 1;mode=block'
|
||||||
|
|
||||||
@ -215,6 +220,22 @@ profiles::haproxy::backends:
|
|||||||
- set-header X-Forwarded-Port %[dst_port]
|
- set-header X-Forwarded-Port %[dst_port]
|
||||||
- add-header X-Forwarded-Proto https if { dst_port 443 }
|
- add-header X-Forwarded-Proto https if { dst_port 443 }
|
||||||
redirect: 'scheme https if !{ ssl_fc }'
|
redirect: 'scheme https if !{ ssl_fc }'
|
||||||
|
be_gitea:
|
||||||
|
description: Backend for gitea cluster
|
||||||
|
collect_exported: false # handled in custom function
|
||||||
|
options:
|
||||||
|
balance: roundrobin
|
||||||
|
option:
|
||||||
|
- httpchk GET /
|
||||||
|
- forwardfor
|
||||||
|
- http-keep-alive
|
||||||
|
- prefer-last-server
|
||||||
|
cookie: SRVNAME insert indirect nocache
|
||||||
|
http-reuse: always
|
||||||
|
http-request:
|
||||||
|
- set-header X-Forwarded-Port %[dst_port]
|
||||||
|
- add-header X-Forwarded-Proto https if { dst_port 443 }
|
||||||
|
redirect: 'scheme https if !{ ssl_fc }'
|
||||||
|
|
||||||
profiles::haproxy::certlist::enabled: true
|
profiles::haproxy::certlist::enabled: true
|
||||||
profiles::haproxy::certlist::certificates:
|
profiles::haproxy::certlist::certificates:
|
||||||
@ -227,6 +248,7 @@ profiles::haproxy::certlist::certificates:
|
|||||||
- /etc/pki/tls/letsencrypt/prowlarr.main.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/prowlarr.main.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/letsencrypt/nzbget.main.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/nzbget.main.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/letsencrypt/fafflix.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/fafflix.unkin.net/fullchain_combined.pem
|
||||||
|
- /etc/pki/tls/letsencrypt/git.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/vault/certificate.pem
|
- /etc/pki/tls/vault/certificate.pem
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
@ -252,3 +274,4 @@ certbot::client::domains:
|
|||||||
- prowlarr.main.unkin.net
|
- prowlarr.main.unkin.net
|
||||||
- nzbget.main.unkin.net
|
- nzbget.main.unkin.net
|
||||||
- fafflix.unkin.net
|
- fafflix.unkin.net
|
||||||
|
- git.unkin.net
|
||||||
|
|||||||
@ -3,6 +3,7 @@ hiera_include:
|
|||||||
- profiles::sql::postgresdb
|
- profiles::sql::postgresdb
|
||||||
- profiles::nginx::simpleproxy
|
- profiles::nginx::simpleproxy
|
||||||
- profiles::gitea::user
|
- profiles::gitea::user
|
||||||
|
- profiles::gitea::haproxy
|
||||||
- gitea
|
- gitea
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
@ -70,10 +71,15 @@ profiles::nginx::simpleproxy::proxy_port: 3000
|
|||||||
profiles::nginx::simpleproxy::proxy_path: '/'
|
profiles::nginx::simpleproxy::proxy_path: '/'
|
||||||
nginx::client_max_body_size: 1024M
|
nginx::client_max_body_size: 1024M
|
||||||
|
|
||||||
|
# enable external access via haproxy
|
||||||
|
profiles::gitea::haproxy::enable: true
|
||||||
|
|
||||||
|
# manage a pgsql database + user
|
||||||
profiles::sql::postgresdb::cluster_name: "patroni-shared-%{facts.environment}"
|
profiles::sql::postgresdb::cluster_name: "patroni-shared-%{facts.environment}"
|
||||||
profiles::sql::postgresdb::dbname: gitea
|
profiles::sql::postgresdb::dbname: gitea
|
||||||
profiles::sql::postgresdb::dbuser: gitea
|
profiles::sql::postgresdb::dbuser: gitea
|
||||||
|
|
||||||
|
# deploy gitea
|
||||||
gitea::ensure: '1.22.4'
|
gitea::ensure: '1.22.4'
|
||||||
gitea::checksum: 'd549104f55067e6fb156e7ba060c9af488f36e12d5e747db7563fcc99eaf8532'
|
gitea::checksum: 'd549104f55067e6fb156e7ba060c9af488f36e12d5e747db7563fcc99eaf8532'
|
||||||
gitea::manage_user: false
|
gitea::manage_user: false
|
||||||
@ -96,11 +102,11 @@ gitea::custom_configuration:
|
|||||||
server:
|
server:
|
||||||
PROTOCOL: 'http'
|
PROTOCOL: 'http'
|
||||||
DOMAIN: 'git.unkin.net'
|
DOMAIN: 'git.unkin.net'
|
||||||
ROOT_URL: 'https://git.query.consul'
|
ROOT_URL: 'https://git.unkin.net'
|
||||||
HTTP_ADDR: '0.0.0.0'
|
HTTP_ADDR: '0.0.0.0'
|
||||||
HTTP_PORT: 3000
|
HTTP_PORT: 3000
|
||||||
START_SSH_SERVER: false
|
START_SSH_SERVER: false
|
||||||
SSH_DOMAIN: 'git.query.consul'
|
SSH_DOMAIN: 'git.unkin.net'
|
||||||
SSH_PORT: 2222
|
SSH_PORT: 2222
|
||||||
SSH_LISTEN_HOST: '0.0.0.0'
|
SSH_LISTEN_HOST: '0.0.0.0'
|
||||||
OFFLINE_MODE: true
|
OFFLINE_MODE: true
|
||||||
|
|||||||
@ -13,3 +13,4 @@ certbot::domains:
|
|||||||
- prowlarr.main.unkin.net
|
- prowlarr.main.unkin.net
|
||||||
- nzbget.main.unkin.net
|
- nzbget.main.unkin.net
|
||||||
- fafflix.unkin.net
|
- fafflix.unkin.net
|
||||||
|
- git.unkin.net
|
||||||
|
|||||||
21
site/profiles/manifests/gitea/haproxy.pp
Normal file
21
site/profiles/manifests/gitea/haproxy.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# enable external access via haproxy
|
||||||
|
class profiles::gitea::haproxy (
|
||||||
|
Boolean $enable = false,
|
||||||
|
){
|
||||||
|
|
||||||
|
# export haproxy balancemember
|
||||||
|
profiles::haproxy::balancemember { "${facts['networking']['fqdn']}_443":
|
||||||
|
service => 'be_gitea',
|
||||||
|
ports => [443],
|
||||||
|
options => [
|
||||||
|
"cookie ${facts['networking']['hostname']}",
|
||||||
|
'ssl',
|
||||||
|
'verify none',
|
||||||
|
'check',
|
||||||
|
'inter 2s',
|
||||||
|
'rise 3',
|
||||||
|
'fall 2',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user