mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 16:03:06 +01:00
Simplify. Emphasis on the 'simp'.
This commit is contained in:
parent
99c42f9247
commit
521c1f9a82
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DB_FILENAME="/home/mastodon/db-backup-$(date '+%Y-%m-%d').sql"
|
||||
|
||||
if ! pg_dump -U mastodon mastodon_production -p 5432 -f "$DB_FILENAME"; then
|
||||
echo "Error creating backup of mastodon_production database"
|
||||
exit 1
|
||||
else
|
||||
echo "Backup of mastodon_production database completed"
|
||||
fi
|
||||
|
||||
find /home/mastodon \
|
||||
-maxdepth 1 \
|
||||
-type f \
|
||||
\( -name "*.sql" -and -not -wholename "$DB_FILENAME" \) \
|
||||
-delete
|
||||
|
||||
exit 0
|
33
bin/mastodon-to-minio
Executable file
33
bin/mastodon-to-minio
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DB_FILENAME="/home/mastodon/db-backup-$(date '+%Y-%m-%d').sql"
|
||||
|
||||
if ! pg_dump -U mastodon -Fc mastodon_production -p 5432 -f "$DB_FILENAME"; then
|
||||
echo "Error creating backup of mastodon_production database"
|
||||
exit 1
|
||||
else
|
||||
echo "Backup of mastodon_production database completed"
|
||||
fi
|
||||
|
||||
find /home/mastodon \
|
||||
-maxdepth 1 \
|
||||
-type f \
|
||||
\( -name "*.sql" -and -not -wholename "$DB_FILENAME" \) \
|
||||
-delete
|
||||
|
||||
if ! rclone copy --transfers=4 /home/mastodon/live/public/system minio:mastodata; then
|
||||
echo "Error rcloning /home/mastodon/live/public/system to MinIO instance"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! rclone copy "/home/mastodon/${DB_FILENAME}" minio:mastodata; then
|
||||
echo "Error rcloning /home/mastodon/${DB_FILENAME} to MinIO instance"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! rclone copy /home/mastodon/live/.env.production minio:mastodata; then
|
||||
echo "Error rcloning /home/mastodon/live/.env.production to MinIO instance"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
6
justfile
6
justfile
@ -85,7 +85,11 @@ archivebox-setup:
|
||||
cd {{archivebox_data}} && archivebox setup
|
||||
|
||||
mastodon-aux-setup:
|
||||
sudo apt install -y rclone
|
||||
sudo cp -v "${PWD}/bin/mastodon-to-minio" /usr/local/bin/
|
||||
sudo chmod +x /usr/local/bin/mastodon-to-minio
|
||||
sudo cp -v "${PWD}/systemd/system/mastodon-to-minio.service" /etc/systemd/system/
|
||||
sudo cp -v "${PWD}/systemd/system/mastodon-to-minio.timer" /etc/systemd/system/
|
||||
sudo systemctl enable --now mastodon-to-minio.timer
|
||||
|
||||
thelounge-install:
|
||||
curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d \" | wget -qi -
|
||||
|
@ -1,14 +0,0 @@
|
||||
[Unit]
|
||||
Description=mastodon-db-backup
|
||||
Wants=postgresql.service
|
||||
AssertFileIsExecutable=/usr/local/bin/mastodon-db-backup
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=mastodon
|
||||
Group=mastodon
|
||||
WorkingDirectory=/home/mastodon
|
||||
ExecStart=/usr/local/bin/mastodon-db-backup
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,9 +0,0 @@
|
||||
[Unit]
|
||||
Description=mastodon-db-backup
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 21:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -1,13 +1,14 @@
|
||||
[Unit]
|
||||
Description=mastodon-to-minio
|
||||
Wants=network.target
|
||||
Wants=postgresql.service
|
||||
AssertFileIsExecutable=/usr/local/bin/mastodon-to-minio
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=mastodon
|
||||
Group=mastodon
|
||||
WorkingDirectory=/home/mastodon
|
||||
ExecStart=rclone copy --progress --transfers=8 /home/mastodon/ minio:mastodata
|
||||
ExecStart=/usr/local/bin/mastodon-to-minio
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -2,7 +2,7 @@
|
||||
Description=mastodon-to-minio
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 22:00:00
|
||||
OnCalendar=*-*-* 21:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
|
Loading…
Reference in New Issue
Block a user