Add "Preview Deployments" on Docker Compose apps
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
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.
- The user goes into the environment variable associated to the Preview Deployment of his app "myapp-frontend"
- 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}}. - 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 variableAPI_URLwith the FQDN generated from the Backend Preview Deployment associated to the PR.
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.
- The user navigates to the settings page for the my-app-frontend service.
- They click on a new tab: "Service Links" (or "Dependencies").
- In this tab, they click a button labeled "Add Service Link" or "Create Dependency".
- 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.
- 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.
++
Commenting to say that this would also be incredibly helpful for our devops setup
/bounty $50
Update: It looks like that didn't work! The feature is still very much needed, though :)
Big issue here, it would be really helpful for our application :) Thanks for your time considering this @Siumauricio ❤️
Commenting to say that we also need this feature. 🥲
wanted to say we also need this feature <3
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