Author SHA1 Message Date
greg f5cd38c457 Merge pull request 'Rate limit requests from bots on Gitea' (#656) from chore/rate_limit_bot_on_gitea into master
Reviewed-on: #656
Reviewed-by: Râu Cao <raucao@kosmos.org>
2026-08-02 19:22:12 +00:00
greg c74d2f1025 Merge branch 'master' into chore/rate_limit_bot_on_gitea 2026-08-02 19:21:48 +00:00
greg bdb04e374f Merge pull request 'Update Gitea to 1.27.1' (#655) from chore/upgrade_gitea_to_1.27.1_fixed into master
Reviewed-on: #655
Reviewed-by: Râu Cao <raucao@kosmos.org>
2026-08-02 19:21:31 +00:00
greg 051c497054 Rate limit requests from bots on Gitea
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.
2026-08-01 16:33:35 +02:00
greg 64e1639c06 Update nodes git submodule 2026-08-01 13:35:08 +02:00
greg fae8f57298 Update Gitea to 1.27.1
The webhooks allowed list was moved to the security part of the config
file

This is running on gitea-2
2026-08-01 13:30:54 +02:00
raucao 8d0c6bc301 Update backup ignorelist 2026-07-24 19:16:41 +02:00
raucao 80766f2473 Update nodes 2026-07-24 19:16:41 +02:00
raucao d9a59e064e Merge pull request 'Make create_vm work on all OS versions in use' (#653) from bugfix/create_vm into master
Reviewed-on: #653
Reviewed-by: Greg <greg@kosmos.org>
2026-07-24 17:14:44 +00:00
raucao 16cb333991 Merge branch 'master' into bugfix/create_vm 2026-07-24 15:27:28 +02:00
raucao 7386de86d7 Make create_vm work on all OS versions in use
Makes it work with the same cloudinit code on Ubuntu 20.04 by mounting
it from a custom ISO as CD-ROM
2026-07-24 15:19:59 +02:00
raucao 5ff6046169 Add new Redis node 2026-07-24 15:19:43 +02:00
3 changed files with 36 additions and 0 deletions
@@ -0,0 +1,25 @@
# Increase if you have very long User-Agent strings
map_hash_bucket_size 256;
# Bot user agents
map $http_user_agent $bot_name {
default "";
~*ClaudeBot "claude";
~*Sogou "sogou";
~*meta-externalagent "meta-externalagent";
# add more as needed
}
# Decide the rate-limit key (per-IP for each bot in this example)
map $bot_name $bot_limit_key {
default "";
"claude" $binary_remote_addr;
"sogou" $binary_remote_addr;
"meta-externalagent" $binary_remote_addr;
}
# Shared memory zone only non-empty keys are counted
limit_req_zone $bot_limit_key zone=bots:20m rate=240r/m; # 4r/s per IP+bot
# Status code returned when the limit is exceeded
limit_req_status 429;
@@ -17,6 +17,14 @@ tls_cert_for domain do
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,
@@ -20,6 +20,9 @@ server {
proxy_intercept_errors on;
# Rate limit for bots. Defined in /etc/openresty/conf.d/rate_limits.conf
limit_req zone=bots burst=10; # allow a larger spike for asset bursts
location ~ ^/(avatars|repo-avatars)/.*$ {
proxy_buffers 1024 8k;
proxy_pass http://_gitea_web;