Skip to content

Fix Backup Permission Error on EC2s #1238

Open
@CarsonDavis

Description

@CarsonDavis

Description

Backups can be ran using sde_collections/management/commands/database_backup.py. There are instructions for using it in different environments at the top of the file.

However, although it works seamlessly on local, it is encountering a permission error on server environments, such as Staging and Production.

Here is the error for reference

[ec2-user@STAGING sde-indexing-helper]$ docker-compose -f production.yml run --rm django python manage.py database_backup
WARN[0000] volume "sde-indexing-helper_production_postgres_data" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume 
WARN[0000] volume "sde-indexing-helper_production_postgres_data_backups" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume 
WARN[0000] volume "sde-indexing-helper_production_traefik" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume 
WARN[0000] Found orphan containers ([sde_indexing_helper_local_redis]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Running 1/0
 ⠿ Container sde-indexing-helper-postgres-1  Running                                                                                                                                                                                                             0.0s
PostgreSQL is available
pg_dump: error: could not open output file "/app/backups/staging_backup_20250225.sql": Permission denied
Backup failed: Command '['pg_dump', '-h', 'sde-indexing-helper-staging-db.c3cr2yyh5zt0.us-east-1.rds.amazonaws.com', '-U', 'postgres', '-d', 'sde_staging', '--no-owner', '--no-privileges', '-f', '/app/backups/staging_backup_20250225.sql']' returned non-zero exit status 1.

Implementation Considerations

  • may need to be able to log onto the server in order to actually test the command

Deliverable

The backup code should be updated such that it no longer produces a permission error on severs.

Dependencies

depends on

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions