You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preview deployments using Build Pack Docker Compose have broken networking when using the service names directly. The service names do work on the 'primary' app (non preview) but there are network resolution issues when using preview deployments
Simple Docker file:
services:
apache:
image: xyz
mysql:
image: xyz
When a preview build is issued the container name will be something like apache-p0g0ck8c44o4oo4w808so8w4-pr615 while the primary build will be apache-p0g0ck8c44o4oo4w808so8w4-2132333212
When you terminal the primary build you can ping apache from mysql and mysql from apache but when you terminal into a preview build there are name resolution errors between containers when you use the service names UNLESS you use the container_name set by coolify. Thus you are unable to use service names directly in preview builds for network resolution
Build logs for preview builds show there is confusion from docker when creating the services as it sees the primary services as orphans because the project-namep0g0ck8c44o4oo4w808so8w4 is the same as the project name on the master build which means they are sharing networks and thus that's why there are name resolution issues.
2024-Dec-31 22:51:01.726049
docker exec j0cg004woswgw8k88g0k48ok bash -c 'SOURCE_COMMIT=f346f96b0c1939750307ca719be252af533fdd11 COOLIFY_BRANCH=master docker compose --env-file /artifacts/j0cg004woswgw8k88g0k48ok/.env-pr-615 --project-name p0g0ck8c44o4oo4w808so8w4 --project-directory /artifacts/j0cg004woswgw8k88g0k48ok -f /artifacts/j0cg004woswgw8k88g0k48ok/coolify-compose.yml up -d'
2024-Dec-31 22:51:01.726049
time="2024-12-31T22:51:01Z" level=warning msg="Found orphan containers ([apache-p0g0ck8c44o4oo4w808so8w4-2132333212 mysql-p0g0ck8c44o4oo4w808so8w4-2132333212]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
2024-Dec-31 22:51:01.726049
Container apache-p0g0ck8c44o4oo4w808so8w4-pr-615 Running
2024-Dec-31 22:51:01.726049
Container mysql-p0g0ck8c44o4oo4w808so8w4-pr-615 Running
Steps to Reproduce
See above
Example Repository URL
No response
Coolify Version
v4.0.0-beta.380
Are you using Coolify Cloud?
Yes (Coolify Cloud)
Operating System and Version (self-hosted)
Ubuntu 24.04.1 LTS
Additional Information
I believe the issue in general is that all preview builds and the "master" build share the same project-name from docker-compose. Simply changing this to be unique should fix the issue.
The project-name for a preview build should be something like p0g0ck8c44o4oo4w808so8w4-pr615 so as to not conflict.
Again what you'll notice here is that $this->application->uuid is used for both primary deployment and any preview deployments and thus causes all sorts of networking issues.
I think project-name should be using $this->container_name, of course this will probably cause orphans on upgrade (not that its hard to clean that up)
Or project-name itself could be declared as a property which is dynamic based on the above lines of code (and probably set in the same area)
Im willing to issue a PR on this if it's understood.
The text was updated successfully, but these errors were encountered:
tm1000
added
🐛 Bug
Reported issues that need to be reproduced by the team.
🔍 Triage
Issues that need assessment and prioritization.
labels
Dec 31, 2024
After more investigation I've determined the bug is not where I thought it was.
I went through and turned off the primary app and restarted the server.
Then I manually built a preview deployment from a PR and everything built but the containers are not able to talk to each other on their base container names. EG apache cant talk to mysql but it CAN talk to mysql-p0g0ck8c44o4oo4w808so8w4-pr-615
This works correctly if I start the primary app back up (non preview)
Error Message and Logs
Preview deployments using Build Pack Docker Compose have broken networking when using the service names directly. The service names do work on the 'primary' app (non preview) but there are network resolution issues when using preview deployments
Simple Docker file:
When a preview build is issued the container name will be something like
apache-p0g0ck8c44o4oo4w808so8w4-pr615
while the primary build will beapache-p0g0ck8c44o4oo4w808so8w4-2132333212
When you terminal the primary build you can ping apache from mysql and mysql from apache but when you terminal into a preview build there are name resolution errors between containers when you use the service names UNLESS you use the container_name set by coolify. Thus you are unable to use service names directly in preview builds for network resolution
Build logs for preview builds show there is confusion from docker when creating the services as it sees the primary services as orphans because the project-name
p0g0ck8c44o4oo4w808so8w4
is the same as the project name on the master build which means they are sharing networks and thus that's why there are name resolution issues.Steps to Reproduce
See above
Example Repository URL
No response
Coolify Version
v4.0.0-beta.380
Are you using Coolify Cloud?
Yes (Coolify Cloud)
Operating System and Version (self-hosted)
Ubuntu 24.04.1 LTS
Additional Information
I believe the issue in general is that all preview builds and the "master" build share the same
project-name
from docker-compose. Simply changing this to be unique should fix the issue.The
project-name
for a preview build should be something likep0g0ck8c44o4oo4w808so8w4-pr615
so as to not conflict.Theres a few places this needs to be addressed:
coolify/app/Jobs/ApplicationDeploymentJob.php
Line 505 in 676f616
coolify/app/Jobs/ApplicationDeploymentJob.php
Line 564 in 676f616
coolify/app/Jobs/ApplicationDeploymentJob.php
Line 574 in 676f616
Again what you'll notice here is that
$this->application->uuid
is used for both primary deployment and any preview deployments and thus causes all sorts of networking issues.I think
project-name
should be using$this->container_name
, of course this will probably cause orphans on upgrade (not that its hard to clean that up)coolify/app/Jobs/ApplicationDeploymentJob.php
Lines 211 to 218 in 676f616
Or project-name itself could be declared as a property which is dynamic based on the above lines of code (and probably set in the same area)
Im willing to issue a PR on this if it's understood.
The text was updated successfully, but these errors were encountered: