5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2025-03-14 20:08:19 +00:00

Merge branch 'rails' into production.panel.sutty.nl

This commit is contained in:
f 2025-01-16 13:46:36 -03:00
commit a5750b91f3
No known key found for this signature in database
4 changed files with 29 additions and 14 deletions

View file

@ -1,15 +1,4 @@
#!/bin/sh #!/bin/sh
set -e set -e
# Volcar y eliminar todos los access logs de dos días atrás `realpath $0 | xargs dirname`/rotate_table access_logs
date="`dateadd today -1d`"
file="/srv/_storage/${date}.psql.gz"
test -n "${date}"
test ! -f "${file}"
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "${file}"
begin;
copy (select * from access_logs where created_at < '${date}') to stdout;
delete from access_logs where created_at < '${date}';
commit;
SQL

4
bin/csp_reports Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
set -e
`realpath $0 | xargs dirname`/rotate_table csp_reports

17
bin/rotate_table Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e
test -n "$1"
# Volcar y eliminar todos los access logs de dos días atrás
date="`dateadd today -1d`"
file="/srv/_storage/$1-${date}.psql.gz"
test -n "${date}"
test ! -s "${file}"
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "${file}"
begin;
copy (select * from $1 where created_at < '${date}') to stdout;
delete from $1 where created_at < '${date}';
commit;
SQL

View file

@ -15,8 +15,13 @@ check program fediblocks
if status != 0 then alert if status != 0 then alert
check program access_logs check program access_logs
with path "/srv/bin/access_logs" as uid "rails" and gid "www-data" with path "/srv/bin/access_logs" as uid "app" and gid "www-data"
every "0 0 * * *" every "0 3 * * *"
if status != 0 then alert
check program csp_reports
with path "/srv/bin/csp_reports" as uid "rails" and gid "www-data"
every "0 7 * * *"
if status != 0 then alert if status != 0 then alert
check program stats check program stats