Replies: 1 comment 1 reply
-
Seems to be an ongoing issue: #3511 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an app that consists of three containers: django backend, mysql database, react frontend. I could deploy it using this docker compose file:
This works fine for the "normal deployment". However, I am mostly interested to use the "Preview deployment" functionality. When I manually deploy a pull request now, the docker compose file that is generated changes the container names (
db-pr-295
,frontend-pr-295
etc.). This breaks the connection to the database, and nginx config, as it relies on the original container names.What would be the recommended way to go forward here? What I could think of:
1. Use a separately deployed mysql; get rid of the nginx container
Pre Deployment Commands
function to create a new database, using the environment variable that coolify can generate for docker compose projects (SERVICE_USER_DB
andSERVICE_PASSWORD_DB
should work?)https://{{pr_id}}.coolify.project.com:9000/api, https://{{pr_id}}.coolify.project.com:9000/admin, https://{{pr_id}}.coolify.project.com:9000/api, https://{{pr_id}}.coolify.project.com:9000/admin
. ...)/api
,/admin
etc. get stripped from the path, so the route is wrong; I suppose it should be possible to configure this behavior?2. Use the
COOLIFY_BRANCH
env var to construct other containers nameIn django configuration code, and after starting the nginx container using
envsubst
, detect that we are not on the "main" branch, and in that case, construct the hostnames of other containers from theCOOLIFY_BRANCH
env var.That's quite hacky.
3. Some other way?
Is there another preferred way to do this?
For the sake of completeness, this is the nginx config:
Beta Was this translation helpful? Give feedback.
All reactions