dokploy icon indicating copy to clipboard operation
dokploy copied to clipboard

Add "Preview Deployments" on Docker Compose apps

Open s1nyx opened this issue 6 months ago • 9 comments

What problem will this feature address?

At the moment I don't have the possibility to deploy my monorepo app on each PR I make using a Docker Compose app on Dokploy since there is no Preview Deployments on Docker Compose apps.

Describe the solution you'd like

I guess one way of solving this issue is to add the feature "Preview Deployments" on Docker compose. If you have a better solution, please let us know.

Describe alternatives you've considered

I was thinking maybe I could split my frontend and my backend into multiple Dockerfile apps on Dokploy. However, from my understanding, I can't get the generated FQDN from my backend preview deployment to add it as an ENV variable in my frontend preview deployment.

Additional context

No response

Will you send a PR to implement it?

Maybe, need help

s1nyx avatar Jun 11 '25 05:06 s1nyx

I guess there might be a better approach than a Docker Compose but still require some work to add this to Dokploy.

I feel like this other proposition could work:

We assume the user has created for example : 2 applications (a frontend and a REST API), he deployed them separately using a Dockerfile for each.

  1. The user goes into the environment variable associated to the Preview Deployment of his app "myapp-frontend"
  2. He creates a variable that his frontend needs so he can use it to call the backend app. It could be something like this : API_URL=https://${{service.myapp-backend.fqdn}}.
  3. Since it's a monorepo, there will be 1 PR who will deploy the frontend and the backend so Dokploy knows that the Preview Deployment created for the two apps are link to the same PR. Dokploy will easily be able to replace the ${{service.myapp-backend.fqdn}} from the env variable API_URL with the FQDN generated from the Backend Preview Deployment associated to the PR.

s1nyx avatar Jun 11 '25 06:06 s1nyx

Another way of doing it, probably is better from a UX standpoint:

Let's imagine a user wants their service, my-app-frontend, to know the public URL of my-app-backend.

  1. The user navigates to the settings page for the my-app-frontend service.
  2. They click on a new tab: "Service Links" (or "Dependencies").
  3. In this tab, they click a button labeled "Add Service Link" or "Create Dependency".
  4. A modal or form appears with the following fields:
    • Target service: A dropdown list of all other services available in the project (e.g., my-app-backend, my-database). The user selects my-app-backend.
    • Service attribute: A dropdown list of properties from the target service to expose. - Public URL (FQDN) - Internal Hostname - Internal Port The user selects Public URL (FQDN).
    • Inject as environment variable: A text input field for the name of the environment variable that will be created in the my-app-frontend service. The user types API_URL.
  5. The user clicks "Save".

So, how it works behind the Scenes ?

Upon saving, this UI action does not introduce a new, complex system. It simply acts as a user-friendly generator for the environment variable configuration.

After the user completes the form, Dokploy would add the following entry to the environment variables of the my-app-frontend service:

VITE_API_URL=${{service.my-app-backend.fqdn}}

The user never has to see or type this syntax. The UI handles the creation and ensures it is always correct.

s1nyx avatar Jun 11 '25 07:06 s1nyx

++

Chris-C3A avatar Jun 15 '25 20:06 Chris-C3A

Commenting to say that this would also be incredibly helpful for our devops setup

AminDhouib avatar Aug 25 '25 00:08 AminDhouib

/bounty $50

Update: It looks like that didn't work! The feature is still very much needed, though :)

sadfun avatar Aug 27 '25 21:08 sadfun

Big issue here, it would be really helpful for our application :) Thanks for your time considering this @Siumauricio ❤️

ErwanCoubret avatar Aug 28 '25 17:08 ErwanCoubret

Commenting to say that we also need this feature. 🥲

bbreunig avatar Nov 16 '25 18:11 bbreunig

wanted to say we also need this feature <3

fcakyon avatar Nov 28 '25 08:11 fcakyon

We would switch from Coolify to Dokploy should this be implemented - we are running some large deployments and it would be awesome to get Dokploy's features / improvements

krzkz94 avatar Nov 28 '25 12:11 krzkz94