Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/swh/deploy/reverse_proxy.pp
# Reverse proxy to expose staging services | # Reverse proxy to expose staging services | ||||
# https://forge.softwareheritage.org/T2747 | # https://forge.softwareheritage.org/T2747 | ||||
class profile::swh::deploy::reverse_proxy { | class profile::swh::deploy::reverse_proxy { | ||||
include ::profile::hitch | include ::profile::hitch | ||||
include ::profile::varnish | include ::profile::varnish | ||||
$service_names = lookup('swh::deploy::reverse_proxy::services') | $service_names = lookup('swh::deploy::reverse_proxy::services') | ||||
$varnish_http_port = lookup('varnish::http_port') | $varnish_http_port = lookup('varnish::http_port') | ||||
each($service_names) |$service_name| { | each($service_names) |$service_name| { | ||||
# Retrieve certificate name | # Retrieve certificate name | ||||
$cert_name = lookup("swh::deploy::${service_name}::vhost::letsencrypt_cert") | $cert_name = lookup("swh::deploy::${service_name}::vhost::letsencrypt_cert") | ||||
$backend_http_host = lookup("swh::deploy::${service_name}::reverse_proxy::backend_http_host") | $backend_http_host = lookup("swh::deploy::${service_name}::reverse_proxy::backend_http_host") | ||||
$backend_http_port = lookup("swh::deploy::${service_name}::reverse_proxy::backend_http_port") | $backend_http_port = lookup("swh::deploy::${service_name}::reverse_proxy::backend_http_port") | ||||
$websocket_support = lookup({ | $websocket_support = lookup({ | ||||
"name" => "swh::deploy::${service_name}::reverse_proxy::websocket_support", | 'name' => "swh::deploy::${service_name}::reverse_proxy::websocket_support", | ||||
"default_value" => false, | 'default_value' => false, | ||||
}) | }) | ||||
# Retrieve the list of vhosts | # Retrieve the list of vhosts | ||||
$vhosts = lookup('letsencrypt::certificates')[$cert_name]['domains'] | $vhosts = lookup('letsencrypt::certificates')[$cert_name]['domains'] | ||||
if $swh_hostname['fqdn'] in $vhosts { | if $swh_hostname['fqdn'] in $vhosts { | ||||
$vhost_name = $swh_hostname['fqdn'] | $vhost_name = $swh_hostname['fqdn'] | ||||
} else { | } else { | ||||
$vhost_name = $vhosts[0] | $vhost_name = $vhosts[0] | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |