# # 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 # Slow down requests from bots cookbook_file "#{node["openresty"]["dir"]}/conf.d/rate_limits.conf" do source "rate_limits.conf" owner "root" group "root" mode "0644" 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