Migrate garage proxies to openresty

This commit is contained in:
Râu Cao 2023-07-26 16:42:48 +02:00
parent bb2f41fdb3
commit 53c35fda51
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
5 changed files with 20 additions and 21 deletions

View File

@ -27,7 +27,8 @@
"base", "base",
"kvm_host", "kvm_host",
"openresty_proxy", "openresty_proxy",
"openresty" "openresty",
"garage_gateway"
], ],
"recipes": [ "recipes": [
"kosmos-base", "kosmos-base",
@ -37,9 +38,13 @@
"kosmos_openresty", "kosmos_openresty",
"kosmos_openresty::default", "kosmos_openresty::default",
"kosmos_openresty::firewall", "kosmos_openresty::firewall",
"kosmos_garage",
"kosmos_garage::default",
"kosmos_garage::firewall_rpc",
"kosmos_assets::nginx_site", "kosmos_assets::nginx_site",
"kosmos_discourse::nginx", "kosmos_discourse::nginx",
"kosmos_drone::nginx", "kosmos_drone::nginx",
"kosmos_garage::nginx_web",
"kosmos_gitea::nginx", "kosmos_gitea::nginx",
"kosmos_rsk::nginx_testnet", "kosmos_rsk::nginx_testnet",
"kosmos_rsk::nginx_mainnet", "kosmos_rsk::nginx_mainnet",
@ -83,10 +88,10 @@
"openresty::commons_conf", "openresty::commons_conf",
"logrotate::default", "logrotate::default",
"openresty::luarocks", "openresty::luarocks",
"firewall::default",
"git::default", "git::default",
"git::package", "git::package",
"kosmos-base::letsencrypt", "kosmos-base::letsencrypt",
"firewall::default",
"fail2ban::default" "fail2ban::default"
], ],
"platform": "ubuntu", "platform": "ubuntu",

View File

@ -21,17 +21,16 @@ development_run_list = %w(
default_run_list = %w( default_run_list = %w(
role[openresty] role[openresty]
tor-full tor-full
kosmos_garage::default
kosmos_garage::firewall_rpc
kosmos_garage::nginx_web
kosmos-ejabberd::nginx kosmos-ejabberd::nginx
) )
production_run_list = %w( production_run_list = %w(
role[openresty] role[openresty]
role[garage_gateway]
kosmos_assets::nginx_site kosmos_assets::nginx_site
kosmos_discourse::nginx kosmos_discourse::nginx
kosmos_drone::nginx kosmos_drone::nginx
kosmos_garage::nginx_web
kosmos_gitea::nginx kosmos_gitea::nginx
kosmos_rsk::nginx_testnet kosmos_rsk::nginx_testnet
kosmos_rsk::nginx_mainnet kosmos_rsk::nginx_mainnet

View File

@ -9,3 +9,4 @@ issues_url 'https://gitea.kosmos.org/kosmos/chef/issues'
source_url 'https://gitea.kosmos.org/kosmos/chef' source_url 'https://gitea.kosmos.org/kosmos/chef'
depends 'firewall' depends 'firewall'
depends 'kosmos_openresty'

View File

@ -3,9 +3,7 @@
# Recipe:: nginx_web # Recipe:: nginx_web
# #
include_recipe "kosmos-nginx" file "/etc/openresty/conf.d/garage.conf" do
file "/etc/nginx/conf.d/garage.conf" do
content <<-EOF content <<-EOF
upstream garage_web { upstream garage_web {
server localhost:3902; server localhost:3902;
@ -19,19 +17,15 @@ end
domains = node['garage']['s3_web_domains'] domains = node['garage']['s3_web_domains']
domains.each do |server_name| domains.each do |server_name|
nginx_certbot_site server_name tls_cert_for server_name do
auth "gandi_dns"
action :create
end
template "#{node['nginx']['dir']}/sites-available/#{server_name}" do openresty_site server_name do
source 'nginx_conf_web.erb' template "nginx_conf_web.erb"
owner 'www-data'
mode 0640
variables server_name: server_name, variables server_name: server_name,
ssl_cert: "/etc/letsencrypt/live/#{server_name}/fullchain.pem", ssl_cert: "/etc/letsencrypt/live/#{server_name}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{server_name}/privkey.pem" ssl_key: "/etc/letsencrypt/live/#{server_name}/privkey.pem"
notifies :reload, 'service[nginx]', :delayed
end
nginx_site server_name do
action :enable
end end
end end

View File

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