Dokploy / Dokploy/dokploy

Bug: PostgreSQL restore executes multiple times for large backups

Open
#3,388 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pr-open
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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.