Preview Compose deletes the compose's .env

Aperta
#5,968 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker-compose, git, typescript
Ambito
backend, devops

Direzione di ricerca

Read compose.fetchSourceType, cloneCompose, and the Git providers’ outputPathOverride handling, then trace the preview dialog and loadServices refresh path. Check how getBuildComposeCommand writes .env and how startCompose uses the checkout. The reported failure is resolved when preview and refresh leave the deployed checkout, .env, and deployed commit intact.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage🔍
To Reproduce
  1. Create a Docker Compose service from a GitHub repo, with "Create Env File" on and a compose file whose variables are required (${WEB_ORIGIN:?...}).
  2. Deploy it. The .env is now next to the compose file in /etc/dokploy/compose/<appName>/code/.
  3. Open General → Preview Compose.
  4. Look at that folder again: the .env is gone, and git reflog in code/ shows a fresh clone.
  5. Run a docker compose command for the project from that folder. Ours is a server schedule: docker compose -p <appName> -f deploy/dokploy/compose.yaml --profile ops run --rm ops <command>. It fails with:
error while interpolating services.worker.environment.WEB_ORIGIN: required variable WEB_ORIGIN is missing a value
Current vs. Expected behavior

I expected the preview to leave the deployed compose as it was. Instead it re-clones the repo and the .env from the last deploy is gone. The running containers are fine, but anything that runs docker compose in that folder fails until the next deploy. Two nightly schedules of ours failed the night after I opened the preview.

Provide environment information
Operating System:
  OS: Debian GNU/Linux 13 (trixie)
  Arch: x86_64
Dokploy version: v0.31.0
VPS Provider: OVH
What applications/services are you tying to deploy?
  Docker Compose from GitHub (Node API, worker, Postgres, nginx), plus server schedules that run `docker compose ... run` on it
Docker 29.9.3, Docker Compose v5.6.1
Which area(s) are affected? (Select all that apply)

Docker Compose

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

The dialog calls compose.fetchSourceType when it opens. That runs cloneCompose, and the git providers start with rm -rf on the code path. The .env is only written in getBuildComposeCommand, so only a deploy brings it back. The refresh button next to the service picker (loadServices with type: "fetch") does the same.

From reading startCompose, it runs docker compose up -d in that same folder without --env-file, so I'd expect Start to break the same way after a preview. I haven't tried that one.

I think the preview and loadServices should clone into a temporary folder, read the compose from there and remove it, so code/ only changes on a deploy. The git providers already take an outputPathOverride. Writing the .env back after the clone would hide the error, but code/ would still be left on the latest commit of the branch instead of the deployed one, and a Start after that would bring up a compose that was never deployed.

Will you send a PR to fix it?

Yes

Lingua principale
TypeScript
Stelle
38.8k
Fork
3.2k
Merge medio
1g 10h
PR unite (30g)
110

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Dokploy/dokploy

Tutte le issue di Dokploy/dokploy

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.