New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use docker compose v2 #4622
Conversation
What's the error its giving you with > 15_16 ? |
If you end up running the script as the regular user, which doesn't have write permissions on the local directory wherever we are piping to, you end up with a failure because you cannot write the output. You'd get around this by calling the script via Example Script
tl;dr, running script via sudo works. running script (as regular user) so that each command inside the script elevates to sudo will fail to write the sql file |
people usually use sudo docker compose exec -T postgres pg_dumpall -c -U lemmy | sudo tee 15_16_dump.sql > /dev/null |
scripts/postgres_15_to_16_upgrade.sh
Outdated
echo "Waiting..." | ||
sleep 20s | ||
|
||
echo "Exporting the Database to 15_16.dump.sql ..." | ||
sudo docker-compose exec -T postgres pg_dumpall -c -U lemmy > 15_16_dump.sql | ||
sudo docker compose exec -T postgres pg_dumpall -c -U lemmy > 15_16_dump.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case use the sudo tee
method above.
scripts/postgres_15_to_16_upgrade.sh
Outdated
echo "Waiting..." | ||
sleep 20s | ||
|
||
echo "Importing the database...." | ||
cat 15_16_dump.sql | sudo docker-compose exec -T postgres psql -U lemmy | ||
cat 15_16_dump.sql | sudo docker compose exec -T postgres psql -U lemmy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might also need to be sudo cat
then now.
I made the fixes above, so this is ready. |
I'll test in the next day or so to confirm it works on lemmy-ansible deploys |
With Ubuntu 22.04 and Debian 12 when using v1 commands this happens:
(Ref: https://askubuntu.com/questions/1508129/docker-compose-giving-containerconfig-errors-after-update-today)
This means your containers end up in a broken state. Updating all commands to be v2 compatible ensures they still work
Edit: Draft. Just realised there are more problems with it than I thought. (you can't
> 15_to_16
for example)