coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: can't specify a port to bind the domain to for PR deployments

Open ton77v opened this issue 8 months ago • 2 comments

Error Message and Logs

In my docker-compose there's a service:

  mailhog:
    image: registry.gitlab.com/opencity-labs/mailhog:latest-arm
    container_name: mailhog
    hostname: mailhog

I set the domain for it like so:

https://mailhog.MY_DOMAIN:8025

Works fine with the regular deployments, but for PR deployments with

{{pr_id}}.{{domain}}
  • works fine for all the services, except mailhog

I can see that when I visit the URL, http traffic is routed to the SMTP port e.g.: 2025/03/26 10:10:28 [SMTP 172.27.0.2:45744] [PROTO: ESTABLISH] Got unknown command for ESTABLISH state: 'ACCEPT:' 2025/03/26 10:10:28 [SMTP 172.27.0.2:45744] Sent 26 bytes: '500 Unrecognised command\r\n'

Steps to Reproduce

See above. If anyone has a workaround in mind, please advice

Example Repository URL

No response

Coolify Version

v4.0.0-beta.399

Are you using Coolify Cloud?

Yes (Coolify Cloud)

Operating System and Version (self-hosted)

No response

Additional Information

No response

ton77v avatar Mar 26 '25 10:03 ton77v

@ton77v

can you post an example of the labels of a pr container, just to check what is being added. if it is not specifying port then yes, it would go to 1025 as it finds first lowest one.

i can't think of a workaround other than changing the app to not use 1025, but say 9025, anything higher than8025 would be fine, i assume u can alter the config

djsisson avatar Mar 26 '25 11:03 djsisson

@ton77v

can you post an example of the labels of a pr container, just to check what is being added. if it is not specifying port then yes, it would go to 1025 as it finds first lowest one.

Here it is, unlike the main one, the -prX compose has nothing about ports here:

        labels:
            - coolify.managed=true
            - coolify.version=4.0.0-beta.399
            - coolify.applicationId=17556
            - coolify.type=application
            - coolify.name=mailhog-dc0k8g048c8s4kwsgs4ogc0k-pr-3
            - coolify.resourceName=XXX
            - coolify.projectName=XXX
            - coolify.serviceName=XXX
            - coolify.environmentName=production
            - coolify.pullRequestId=3
            - traefik.enable=true
            - traefik.http.middlewares.gzip.compress=true
            - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
            - traefik.http.routers.http-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.entryPoints=http
            - traefik.http.routers.http-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.middlewares=redirect-to-https
            - 'traefik.http.routers.http-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.rule=Host(`3.mailhog.MY_DOMAIN`) && PathPrefix(`/`)'
            - traefik.http.routers.https-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.entryPoints=https
            - traefik.http.routers.https-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.middlewares=gzip
            - 'traefik.http.routers.https-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.rule=Host(`3.mailhog.MY_DOMAIN`) && PathPrefix(`/`)'
            - traefik.http.routers.https-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.tls.certresolver=letsencrypt
            - traefik.http.routers.https-0-dc0k8g048c8s4kwsgs4ogc0k-3-mailhog.tls=true
            - 'caddy_0.encode=zstd gzip'
            - 'caddy_0.handle_path.0_reverse_proxy={{upstreams}}'
            - 'caddy_0.handle_path=/*'
            - caddy_0.header=-Server
            - 'caddy_0.try_files={path} /index.html /index.php'
            - 'caddy_0=https://3.mailhog.MY_DOMAIN'
            - caddy_ingress_network=dc0k8g048c8s4kwsgs4ogc0k-3

i can't think of a workaround other than changing the app to not use 1025, but say 9025, anything higher than8025 would be fine, i assume u can alter the config

yeah thanks will do smth like this 👍

ton77v avatar Mar 27 '25 03:03 ton77v