Just had a bit of a struggle doing a backup and test restore onto a new server (so I could try the upgrade to 4.0). The internet is full of people suggesting quick one-liners to backup docker containers yet none of them seemed to work.
First attempt was the manual dump and restore. Having copied docker-compose and aleph.env to the new server, I started up the stack, and then did
something like
cat ../backups/latest/postgres-data/dump_2023-05-24-21-05.sql | docker-compose exec -T postgres psql -U aleph -d aleph
# Copy other files back into place
docker cp ../backups/latest/archive-data/ aleph_ingest-file_1:/data/
docker cp ../backups/latest/redis-data/ aleph_redis_1:/data/
Nothing showed immediately, so I restarted the stack. Still no data. I then tried
docker-compose run --rm shell aleph upgrade
docker-compose run --rm shell aleph reindex-full
As those have rescued me in the past. But they just produced errors, which I’d never seen before.
So I moved onto the second method of exporting the docker volumes to a tar file, and then reimporting them. The general method was eg.
docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
# and then to restore
docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"
These also created an empty data set, and errors when reindexing and upgrading.
So then I moved onto the brute force sysadmin method. I stopped aleph on both sides, and then just rsynced the /var/lib/docker/volumes/aleph* directories over. When I started it up on the target computer, all was good.
So my question is first of all, how are others managing their backup / restore process. I can’t believe, with the profusion of docker everywhere, that its so hard to backup, and using the last solution seems a little indelicate. Am I missing a step? Is the brute force rsync method OK for production use? I’d love to hear other peoples thoughts.