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

Problem with backups #3050

Open
TomHeim29 opened this issue Feb 6, 2025 · 4 comments
Open

Problem with backups #3050

TomHeim29 opened this issue Feb 6, 2025 · 4 comments
Labels

Comments

@TomHeim29
Copy link

Checklist

  • [ x ] I've searched the project's issues.
  • [ x ] I've searched the project's discussions.

❓ Question

Hi !

I followed https://docs.pwpush.com/docs/database-backup/#automate-the-backup-optional to set up backups. But i can't recover pushes created earlier.

I tried to create a push then export sql database et inject it bacdk into another instance. Can't access to the push created anymore. Do you know if I am following the correct way to backup my pwpush instance ?

@TomHeim29
Copy link
Author

When restoring ive go a lot of errors, is it normal ?

ERROR: relation "index_urls_on_url_token" already exists
ERROR: relation "index_urls_on_user_id" already exists
ERROR: relation "index_users_on_authentication_token" already exists
ERROR: relation "index_users_on_confirmation_token" already exists
ERROR: relation "index_users_on_email" already exists
ERROR: relation "index_users_on_reset_password_token" already exists
ERROR: relation "index_users_on_unlock_token" already exists
ERROR: relation "index_views_on_file_push_id" already exists
ERROR: relation "index_views_on_kind" already exists
ERROR: relation "index_views_on_password_id" already exists
ERROR: relation "index_views_on_successful" already exists
ERROR: relation "index_views_on_url_id" already exists
ERROR: constraint "fk_rails_318a5533ed" for relation "solid_queue_recurring_executions" already exists
ERROR: constraint "fk_rails_39bbc7a631" for relation "solid_queue_failed_executions" already exists
ERROR: constraint "fk_rails_4cd34e2228" for relation "solid_queue_blocked_executions" already exists
ERROR: constraint "fk_rails_81fcbd66af" for relation "solid_queue_ready_executions" already exists
ERROR: constraint "fk_rails_993965df05" for relation "active_storage_variant_records" already exists
ERROR: constraint "fk_rails_9cfe4d4944" for relation "solid_queue_claimed_executions" already exists
ERROR: constraint "fk_rails_c3b3935057" for relation "active_storage_attachments" already exists
ERROR: constraint "fk_rails_c4316f352d" for relation "solid_queue_scheduled_executions" already exists

Now i can find the pushes created on other instances, its good but i have all theses errors because of things already existing on main instance

@TomHeim29
Copy link
Author

I tried with a ph_dump et pg_restore, it works better, i clean database every time I retrieve a backup !

@pglombardo
Copy link
Owner

Hi @TomHeim29,

ERROR: relation "index_views_on_url_id" already exists
ERROR: constraint "fk_rails_318a5533ed" for relation "solid_queue_recurring_executions" already exists

Yeah these seem like warnings when you are importing into a DB with pre-existing data. pg_restore should be done into a clean/empty DB. I think if these errors come up, the records aren't imported.

I tried to create a push then export sql database et inject it bacdk into another instance. Can't access to the push created anymore. Do you know if I am following the correct way to backup my pwpush instance ?

This is likely because of the above but could also be because of expiration...

What are you trying to do? Sync multiple instances/databases?

@TomHeim29
Copy link
Author

TomHeim29 commented Feb 6, 2025

juste instance a db into another instance, it finaly worked with that :
backup :

sudo sh -c 'docker exec postgres pg_dump -Fc -U user db > backup.dump'

restore backup :

sudo cat backup.dump | sudo docker exec -i postgres pg_restore --clean --if-exists -U user -d db

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

No branches or pull requests

2 participants