Preview Compose deletes the compose's .env

Đang mở
#5,968 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
53/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker-compose, git, typescript
Lĩnh vực
backend, devops

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
38.8k
Fork
3.2k
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
110

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Dokploy/dokploy

Tất cả issue của Dokploy/dokploy

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.