For now this is 240 r/m (4r/s), for Claude, Sogou and Meta user agents. The values are pretty conservative, I initially had tighter limits. Let's see how it goes, this is running on Fornax and Draco and right now we're not hitting the limits.
36 lines
839 B
Ruby
36 lines
839 B
Ruby
#
|
|
# 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
|