Bon dia,
Tal com es parla en aquest fil, hem migrat la instància pròpia de fedi.cat a un altre domini, un altre servidor i hi hem instal·lat akkoma.
He creat un VPS a Scaleway amb les següents característiques:
- RAM: 4GB
- CPUs: 3
- Espai: 40 GB (Local)
- Ample de banda: 300 Mbps
Amb la @titi, vam instal·lar el servei d’akkoma utilitzant la versió OTP:
https://docs.akkoma.dev/stable/installation/otp_en/
Tal com suggereixen a la documentació, he utilitzat PGTune per a optimitzar la base de dades. Al fitxer /etc/postgresql/14/main/postgresql.conf
hi he canviat les següents línies:
# DB Version: 14
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 4 GB
# CPUs num: 3
# Connections num: 20
# Data Storage: ssd
max_connections = 20
shared_buffers = 1GB
effective_cache_size = 3GB
maintenance_work_mem = 256MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 26214kB
min_wal_size = 1GB
max_wal_size = 4GB
També seguint la documentació he canviat /etc/akkoma/config.exs
:
config :pleroma, Pleroma.Repo,
prepare: :named,
parameters: [
plan_cache_mode: "force_custom_plan"
]
I he reiniciat el servei d’akkoma.
EDIT: he configurat el backup amb aquest script de borg:
#!/bin/bash
sshfs anartist@XX.XXX.XXX.XX:/home/anartist/borgbackup /root/borgbackup/
export BORG_REPO=/root/borgbackup/bcnfedicat
export BORG_PASSPHRASE=''
info () { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
info "Stoping Akkoma service"
systemctl stop akkoma
info "Starting DB backup"
dbdate=`date +"%Y%m%d-%H%M%S"`
sudo -Hu postgres pg_dump -d akkoma --format=custom -f /tmp/akkoma_${dbdate}.pgdump
info "Starting Remote backup"
/usr/bin/borg create --verbose --stats ::backup_$(date +%Y%m%d) \
/tmp/akkoma_${dbdate}.pgdump \
/etc/akkoma/config.exs \
/tmp/setup_db.psql \
/var/lib/akkoma/uploads \
/var/lib/akkoma/static
backup_exit=$?
info "Restart Akkoma Service"
systemctl start akkoma
/usr/bin/borg prune --list --show-rc --keep-daily 7 --keep-weekly 4 --keep-monthly 6
prune_exit=$?
# use highest exit code as global exit code
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit))
if [ ${global_exit} -eq 0 ]; then
info "Backup and Prune finished successfully"
elif [ ${global_exit} -eq 1 ]; then
info "Backup and/or Prune finished with warnings"
else
info "Backup and/or Prune finished with errors"
fi
fusermount -u /root/borgbackup/
info "Eliminating old db"
ls /tmp/akkoma*.pgdump -trd | head -n -2 | xargs --no-run-if-empty rm
info "Backup Finished"
exit ${global_exit}