Skip to content
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

Add to readme instructions on restoring DB #801

Open
ghost opened this issue Dec 19, 2024 · 1 comment
Open

Add to readme instructions on restoring DB #801

ghost opened this issue Dec 19, 2024 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 19, 2024

Restores backup taken by pg_dump

Run in first terminal window (with or without -d, as you prefer, just make sure it's running):

COMPRESS_ENABLED=1 docker compose -f docker-compose.dev.yml up

Run in second terminal window:

docker compose -f docker-compose.dev.yml exec web psql -h postgres -U postgres

In Postgres shell:

create database temp;
(If it already exists that's fine, carry on)
\connect temp
drop database postgres;
create database postgres;
\q

Back on command line:

docker compose -f docker-compose.dev.yml exec web pg_restore -v -h postgres -U postgres -d postgres /usr/src/app/filename.dump 

At the end, a whole range of "role ?? does not exist" errors are fine.

@jarofgreen
Copy link
Contributor

After running up, wait till services fully up and all DB migrations run.

If you see ERROR: database "postgres" is being accessed by other users errors that could be it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant