Migrate hubot proxies to openresty

This commit is contained in:
Râu Cao 2023-07-26 16:21:03 +02:00
parent 027d0ed570
commit bb2f41fdb3
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
6 changed files with 21 additions and 32 deletions

View File

@ -48,6 +48,8 @@
"kosmos-akkounts::nginx", "kosmos-akkounts::nginx",
"kosmos-akkounts::nginx_api", "kosmos-akkounts::nginx_api",
"kosmos-bitcoin::nginx_lndhub", "kosmos-bitcoin::nginx_lndhub",
"kosmos-hubot::nginx_botka_irc-libera-chat",
"kosmos-hubot::nginx_hal8000_xmpp",
"kosmos-ipfs::nginx_public_gateway", "kosmos-ipfs::nginx_public_gateway",
"kosmos-mastodon::nginx", "kosmos-mastodon::nginx",
"remotestorage_discourse::nginx", "remotestorage_discourse::nginx",

View File

@ -25,9 +25,6 @@ default_run_list = %w(
kosmos_garage::firewall_rpc kosmos_garage::firewall_rpc
kosmos_garage::nginx_web kosmos_garage::nginx_web
kosmos-ejabberd::nginx kosmos-ejabberd::nginx
kosmos-hubot::nginx_botka_irc-libera-chat
kosmos-hubot::nginx_hal8000_xmpp
) )
production_run_list = %w( production_run_list = %w(
@ -42,6 +39,8 @@ production_run_list = %w(
kosmos-akkounts::nginx kosmos-akkounts::nginx
kosmos-akkounts::nginx_api kosmos-akkounts::nginx_api
kosmos-bitcoin::nginx_lndhub kosmos-bitcoin::nginx_lndhub
kosmos-hubot::nginx_botka_irc-libera-chat
kosmos-hubot::nginx_hal8000_xmpp
kosmos-ipfs::nginx_public_gateway kosmos-ipfs::nginx_public_gateway
kosmos-mastodon::nginx kosmos-mastodon::nginx
remotestorage_discourse::nginx remotestorage_discourse::nginx

View File

@ -9,6 +9,7 @@ version '0.2.0'
depends 'kosmos-base' depends 'kosmos-base'
depends 'kosmos-nodejs' depends 'kosmos-nodejs'
depends 'kosmos-ipfs' depends 'kosmos-ipfs'
depends 'kosmos_openresty'
depends 'firewall' depends 'firewall'
depends 'git' depends 'git'
depends 'redisio' depends 'redisio'

View File

@ -1,24 +1,17 @@
include_recipe "kosmos-base::letsencrypt"
include_recipe "kosmos-nginx"
domain = "irc-libera-chat.botka.kosmos.chat" domain = "irc-libera-chat.botka.kosmos.chat"
nginx_certbot_site domain
upstream_host = search(:node, "role:hubot").first["knife_zero"]["host"] upstream_host = search(:node, "role:hubot").first["knife_zero"]["host"]
template "#{node['nginx']['dir']}/sites-available/#{domain}" do tls_cert_for domain do
source 'nginx_conf_hubot.erb' auth "gandi_dns"
owner node["nginx"]["user"] action :create
mode 0640 end
openresty_site domain do
template 'nginx_conf_hubot.erb'
variables express_port: node['botka_irc-libera-chat']['http_port'], variables express_port: node['botka_irc-libera-chat']['http_port'],
server_name: domain, server_name: domain,
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

@ -1,24 +1,18 @@
include_recipe "kosmos-base::letsencrypt"
include_recipe "kosmos-nginx"
app_name = "hal8000_xmpp" app_name = "hal8000_xmpp"
domain = node[app_name]['domain']
nginx_certbot_site node[app_name]['domain']
upstream_host = search(:node, "role:hubot").first["knife_zero"]["host"] upstream_host = search(:node, "role:hubot").first["knife_zero"]["host"]
template "#{node['nginx']['dir']}/sites-available/#{node[app_name]['domain']}" do tls_cert_for domain do
source 'nginx_conf_hubot.erb' auth "gandi_dns"
owner node["nginx"]["user"] action :create
mode 0640 end
openresty_site domain do
template 'nginx_conf_hubot.erb'
variables express_port: node[app_name]['http_port'], variables express_port: node[app_name]['http_port'],
server_name: node[app_name]['domain'], server_name: node[app_name]['domain'],
ssl_cert: "/etc/letsencrypt/live/#{node[app_name]['domain']}/fullchain.pem", ssl_cert: "/etc/letsencrypt/live/#{node[app_name]['domain']}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{node[app_name]['domain']}/privkey.pem", ssl_key: "/etc/letsencrypt/live/#{node[app_name]['domain']}/privkey.pem",
upstream_host: upstream_host upstream_host: upstream_host
notifies :reload, 'service[nginx]', :delayed
end
nginx_site node[app_name]['domain'] do
action :enable
end end

View File

@ -6,7 +6,7 @@ upstream _express_<%= @server_name.gsub(".", "_") %> {
} }
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 %>;