Bug: PostgreSQL restore executes multiple times for large backups
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 37.4k
- Forks
- 3k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 73
Description
To Reproduce
Description
When restoring a large PostgreSQL backup from S3-compatible storage via the UI, the restore command (pg_restore) is unexpectedly executed multiple times concurrently. Each execution downloads and processes the backup file simultaneously(I see the download activity from network monitor).
Steps to Reproduce
- Create a PostgreSQL database with a large dataset
- Configure S3-compatible backup destination
- Create a backup (resulting in a large .sql.gz file)
- Attempt to restore the backup via the UI
Current vs. Expected behavior
Expected Behavior
The restore command should execute exactly once and complete successfully.
Actual Behavior
The restore command is executed multiple times. Logs show repeated entries:
Starting restore...
Backup path: :s3:bucket-name/database/2026-01-03T01:00:00.231Z.sql.gz
Executing command: CONTAINER_ID=$(docker ps -q ...) && rclone cat ... | gunzip | docker exec -i $CONTAINER_ID sh -c "pg_restore ..."
Starting restore...
Backup path: :s3:bucket-name/database/2026-01-03T01:00:00.231Z.sql.gz
Executing command: CONTAINER_ID=$(docker ps -q ...) && rclone cat ... | gunzip | docker exec -i $CONTAINER_ID sh -c "pg_restore ..."
(repeats multiple times)
Multiple pg_restore processes run concurrently, each streaming the backup from S3.
Provide environment information
Dokploy version: v0.26.2
Database type: PostgreSQL
Backup destination: S3-compatible storage (Cloudflare R2)
Backup file size: Large (2 GB)
Which area(s) are affected? (Select all that apply)
Databases
Are you deploying the applications where Dokploy is installed or on a remote server?
Same server where Dokploy is installed
Additional context
No response
Will you send a PR to fix it?
Maybe, need help
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the UI restore flow and the code that logs “Starting restore...” and invokes pg_restore through rclone and Docker. Reproduce with a large PostgreSQL backup from S3-compatible storage, then verify that one restore request launches exactly one command and completes without concurrent downloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, postgresql, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100