Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: GitLab MR Preview with docker-compose fails (depends on unknown service) #2005

Closed
A-D-E-A opened this issue Apr 16, 2024 · 2 comments · Fixed by #2205
Closed

[Bug]: GitLab MR Preview with docker-compose fails (depends on unknown service) #2005

A-D-E-A opened this issue Apr 16, 2024 · 2 comments · Fixed by #2205
Assignees

Comments

@A-D-E-A
Copy link

A-D-E-A commented Apr 16, 2024

Description

When I create a merge request to get a preview app, it fails and tells me that my service is unknown.

I think the issue is that coolify renames the services in its custom docker-compose.yaml and does not rename the fields in "depends_on" or "links". I was not able to reproduce this error when copying the commands shown in the debug logs.

Minimal Reproduction (if possible, example repository)

Use the following docker-compose file:

services:
  myapp:  # My web app
    # ...
    depends_on: # Works with "links" too
      - cache
  cache:  # My redis service
    image: redis:latest

And, after configuring the preview apps in coolify and the needed webhook in GitLab, create a merge request.

Exception or Error

[2024-Apr-16 13:49:55.170892] Oops something is not okay, are you okay? 😢

[2024-Apr-16 13:49:55.183408] time="2024-04-16T13:49:55Z" level=warning msg="/artifacts/jc404ck/compose.yaml: `version` is obsolete"
service "myapp-pr-4" depends on unknown service "cache"

Version

v4.0.0-beta.258

@andrasbacsai andrasbacsai self-assigned this May 4, 2024
@rdamborsky
Copy link

rdamborsky commented May 13, 2024

I run into the same issue when running preview deployments. On the main deployment flow the process works fine.

service "backend-pr-117" depends on undefined service "database": invalid compose project

(reduced) docker-compose content from coolify UI:

services:
  backend:
    depends_on:
      - database
    labels:
      - coolify.version=4.0.0-beta.278
      - coolify.name=backend-f2sg4o0-172530544062
      - coolify.pullRequestId=0
    container_name: backend-f2sg4o0-172530544062
  database:
    image: 'mariadb:11.3'
    labels:
      - coolify.version=4.0.0-beta.278
      - coolify.name=database-f2sg4o0-172530544894
      - coolify.pullRequestId=0
    container_name: database-f2sg4o0-172530544894

@rdamborsky
Copy link

rdamborsky commented May 13, 2024

I dug into source code of coolify and found that the job creates a docker-compose-pr-xyz.yml file.

Logging into server I found the file and the generated docker-compose file for the PR looks like the following (based on my previous comment):

services:
    backend-pr-117:
        depends_on:
            - database
        labels:
            - coolify.version=4.0.0-beta.278
            - coolify.name=backend-f2sg4o0-pr-117
            - coolify.pullRequestId=117
        container_name: backend-f2sg4o0-pr-117
    database-pr-117:
        image: 'mariadb:11.3'
        labels:
            - coolify.version=4.0.0-beta.278
            - coolify.name=database-f2sg4o0-pr-117
            - coolify.pullRequestId=117
        container_name: database-f2sg4o0-pr-117

So the service name is getting updated correctly, but the depends_on is still using the unmodified name.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants