Râu Cao 4b14297f83
WIP Migrate Gitea proxy to openresty
TODO: Make nginx_ssh stream resource work with openresty cookbook
2023-07-26 14:15:46 +02:00

28 lines
660 B
Ruby

#
# Cookbook:: kosmos_gitea
# Recipe:: nginx
#
domain = node["gitea"]["domain"]
begin
upstream_ip_address = search(:node, "role:gitea").first["knife_zero"]["host"]
rescue
Chef::Log.warn('No server with "gitea" role. Stopping here.')
return
end
tls_cert_for domain do
auth "gandi_dns"
action :create
end
openresty_site domain do
template "nginx_conf_web.erb"
variables server_name: domain,
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem",
upstream_host: upstream_ip_address,
upstream_port: node["gitea"]["port"]
end