Migrate lndhub proxy to openresty

This commit is contained in:
Râu Cao 2023-07-26 15:00:55 +02:00
parent 1bad2939de
commit ad59913555
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
5 changed files with 13 additions and 18 deletions

View File

@ -47,6 +47,7 @@
"kosmos_website::default", "kosmos_website::default",
"kosmos-akkounts::nginx", "kosmos-akkounts::nginx",
"kosmos-akkounts::nginx_api", "kosmos-akkounts::nginx_api",
"kosmos-bitcoin::nginx_lndhub",
"kosmos_encfs", "kosmos_encfs",
"kosmos_encfs::default", "kosmos_encfs::default",
"kosmos-ejabberd::firewall", "kosmos-ejabberd::firewall",

View File

@ -25,7 +25,6 @@ default_run_list = %w(
kosmos_garage::firewall_rpc kosmos_garage::firewall_rpc
kosmos_garage::nginx_web kosmos_garage::nginx_web
kosmos-bitcoin::nginx_lndhub
kosmos-ejabberd::nginx kosmos-ejabberd::nginx
kosmos-hubot::nginx_botka_irc-libera-chat kosmos-hubot::nginx_botka_irc-libera-chat
kosmos-hubot::nginx_hal8000_xmpp kosmos-hubot::nginx_hal8000_xmpp
@ -45,6 +44,7 @@ production_run_list = %w(
kosmos_website::default kosmos_website::default
kosmos-akkounts::nginx kosmos-akkounts::nginx
kosmos-akkounts::nginx_api kosmos-akkounts::nginx_api
kosmos-bitcoin::nginx_lndhub
) )
env_run_lists( env_run_lists(

View File

@ -14,6 +14,7 @@ depends 'git'
depends 'golang' depends 'golang'
depends 'kosmos-nginx' depends 'kosmos-nginx'
depends 'kosmos-nodejs' depends 'kosmos-nodejs'
depends 'kosmos_openresty'
depends 'kosmos_postgresql' depends 'kosmos_postgresql'
depends 'postgresql' depends 'postgresql'
depends 'redisio' depends 'redisio'

View File

@ -3,27 +3,20 @@
# Recipe:: nginx_lndhub # Recipe:: nginx_lndhub
# #
include_recipe "kosmos-base::letsencrypt"
include_recipe "kosmos-nginx"
domain = node['lndhub-go']['domain'] domain = node['lndhub-go']['domain']
nginx_certbot_site domain
upstream_host = search(:node, "role:lndhub").first["knife_zero"]["host"] upstream_host = search(:node, "role:lndhub").first["knife_zero"]["host"]
template "#{node['nginx']['dir']}/sites-available/#{domain}" do tls_cert_for domain do
source 'nginx_conf_lndhub.erb' auth "gandi_dns"
owner node["nginx"]["user"] action :create
mode 0640 end
variables port: node['lndhub-go']['port'],
server_name: domain, openresty_site domain do
template 'nginx_conf_lndhub.erb'
variables server_name: domain,
port: node['lndhub-go']['port'],
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem", ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem", ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem",
upstream_host: upstream_host upstream_host: upstream_host
notifies :reload, 'service[nginx]', :delayed
end
nginx_site domain do
action :enable
end end

View File

@ -6,7 +6,7 @@ upstream _lndhub {
} }
server { server {
listen 443 ssl http2; listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name <%= @server_name %>; server_name <%= @server_name %>;