mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
Script to periodically renew certs (run with cronjob)
This commit is contained in:
parent
54ff80ecd2
commit
ed44cc5a17
1 changed files with 10 additions and 1 deletions
11
Rakefile
11
Rakefile
|
@ -383,7 +383,7 @@ end
|
||||||
|
|
||||||
desc 'regenerate_ssl_certs'
|
desc 'regenerate_ssl_certs'
|
||||||
task :regenerate_ssl_certs => [:environment] do
|
task :regenerate_ssl_certs => [:environment] do
|
||||||
sites = DB[%{select id from sites where ((domain is not null or domain != '') and is_banned != 't' and is_deleted != 't' and plan_type is not null and plan_type != 'free') or parent_site_id is not null}].all
|
sites = DB[%{select id from sites where (domain is not null or domain != '') and is_banned != 't' and is_deleted != 't'}].all
|
||||||
|
|
||||||
seconds = 2
|
seconds = 2
|
||||||
|
|
||||||
|
@ -394,3 +394,12 @@ task :regenerate_ssl_certs => [:environment] do
|
||||||
|
|
||||||
puts "#{sites.length.to_s} records are primed"
|
puts "#{sites.length.to_s} records are primed"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'renew_ssl_certs'
|
||||||
|
task :renew_ssl_certs => [:environment] do
|
||||||
|
delay = 0
|
||||||
|
DB[%{select id from sites where (domain is not null or domain != '') and is_banned != 't' and is_deleted != 't' and (cert_updated_at is null or cert_updated_at < ?)}, 60.days.ago].all.each do |site|
|
||||||
|
LetsEncryptWorker.perform_in delay.seconds, site[:id]
|
||||||
|
delay += 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue