Dokploy / Dokploy/dokploy

Ability to customize postgres backup command

Open
#3,191 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
37.4k
Forks
3k
Avg merge
1d 3h
Merged PRs (30d)
73

Description

What problem will this feature address?

Issue: pg_restore fails when restoring TimescaleDB backups

Restoring a backup of a TimescaleDB-enabled PostgreSQL database may fail if the backup includes the timescaledb extension.
By default, pg_dump dumps the extension definition, which causes the restore to:

  1. DROP the existing timescaledb extension, and
  2. Attempt to CREATE it again during restore.

This fails because TimescaleDB cannot be recreated from a dump. It must already be installed on the target server. As a result, pg_restore may throw errors like:

  • ERROR: extension "timescaledb" already exists
  • ERROR: could not access file "timescaledb": No such file or directory
  • ERROR: extension "timescaledb" must be installed by the package manager

This causes the restore to fail or produce a partially restored database.


Root Cause

Current backup command is hardcoded and its not using --data-only or exclude extension

docker exec -i $CONTAINER_ID bash -c "set -o pipefail; pg_dump -Fc --no-acl --no-owner -h localhost -U ${databaseUser} --no-password '${database}' | gzip"`; }

Describe the solution you'd like

Make the backup command customizable so users can pass additional flags to pg_dump. or allowing the user to override full command pg_dump -Fc --no-acl --no-owner -h localhost -U ${databaseUser} --no-password '${database}' is good too

Describe alternatives you've considered

Well, currently I use the schedules from the main UI, but that’s more of a workaround since the process runs outside the service.

Additional context

No response

Will you send a PR to implement it?

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named; start by searching the repository for the hardcoded pg_dump command and trace the backup entry point used by scheduled backups. Done means users can provide additional pg_dump flags or override the command, with TimescaleDB backups restoring successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql, typescript
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.