2024-02-07 10:21:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Do not stop in the middle of this upgrade, wait until you see the message: Upgrade complete."
|
|
|
|
|
|
|
|
echo "Stopping lemmy and all services..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose stop
|
2024-02-07 10:21:02 +00:00
|
|
|
|
|
|
|
echo "Make sure postgres is started..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose up -d postgres
|
2024-02-07 10:21:02 +00:00
|
|
|
echo "Waiting..."
|
|
|
|
sleep 20s
|
|
|
|
|
|
|
|
echo "Exporting the Database to 15_16.dump.sql ..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose exec -T postgres pg_dumpall -c -U lemmy | sudo tee 15_16_dump.sql > /dev/null
|
2024-02-07 10:21:02 +00:00
|
|
|
echo "Done."
|
|
|
|
|
|
|
|
echo "Stopping postgres..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose stop postgres
|
2024-02-07 10:21:02 +00:00
|
|
|
echo "Waiting..."
|
|
|
|
sleep 20s
|
|
|
|
|
|
|
|
echo "Removing the old postgres folder"
|
|
|
|
sudo rm -rf volumes/postgres
|
|
|
|
|
2024-05-07 09:41:40 +00:00
|
|
|
echo "Updating docker compose to use postgres version 16."
|
2024-06-07 16:39:23 +00:00
|
|
|
sudo sed -i "s/image: .*postgres:.*/image: docker.io\/postgres:16-alpine/" ./docker-compose.yml
|
2024-02-07 10:21:02 +00:00
|
|
|
|
|
|
|
echo "Starting up new postgres..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose up -d postgres
|
2024-02-07 10:21:02 +00:00
|
|
|
echo "Waiting..."
|
|
|
|
sleep 20s
|
|
|
|
|
|
|
|
echo "Importing the database...."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo cat 15_16_dump.sql | sudo docker compose exec -T postgres psql -U lemmy
|
2024-02-07 10:21:02 +00:00
|
|
|
echo "Done."
|
|
|
|
|
|
|
|
echo "Starting up lemmy..."
|
2024-05-07 09:41:40 +00:00
|
|
|
sudo docker compose up -d
|
2024-02-07 10:21:02 +00:00
|
|
|
|
|
|
|
echo "A copy of your old database is at 15_16.dump.sql . You can delete this file if the upgrade went smoothly."
|
|
|
|
echo "Upgrade complete."
|