Add nginx proxy hosts for Garage Web access
The respective bucket needs to be configured with a domain alias. When a new alias is added to the `s3_web_domains` config, a new nginx site can then be deployed to the `nginx_proxy` hosts.
This commit is contained in:
26
site-cookbooks/kosmos_garage/recipes/nginx_web.rb
Normal file
26
site-cookbooks/kosmos_garage/recipes/nginx_web.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_garage
|
||||
# Recipe:: nginx_web
|
||||
#
|
||||
|
||||
include_recipe "kosmos-nginx"
|
||||
|
||||
domains = node['garage']['s3_web_domains']
|
||||
|
||||
domains.each do |server_name|
|
||||
nginx_certbot_site server_name
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/#{server_name}" do
|
||||
source 'nginx_conf_web.erb'
|
||||
owner 'www-data'
|
||||
mode 0640
|
||||
variables server_name: server_name,
|
||||
ssl_cert: "/etc/letsencrypt/live/#{server_name}/fullchain.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
|
||||
Reference in New Issue
Block a user