coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
32.52k stars 1.7k forks source link

[Bug]: Custom Labels do not work in Docker compose #1737

Closed AndreasFaust closed 5 days ago

AndreasFaust commented 7 months ago

Description

I tried to apply these traefic middlewares (www-redirect, basic authentication) via custom labels to a service: https://coolify.io/docs/traefik/redirects https://coolify.io/docs/traefik/basic-auth

I wrote the labels into the docker compose file and, as the "deployable compose" preview shows, they are applied (to the beginning of the labels section. But they do not have an effect. Am I doing something wrong?

Minimal Reproduction (if possible, example repository)

Bildschirmfoto 2024-02-12 um 10 26 02

The example shows only authentication. I tried to copy the router name used at other labels, but this changes after every re-deploy.

Exception or Error

No response

Version

beta.213

djoohl commented 7 months ago

I'm having the same problem, pushing this.

andrasbacsai commented 7 months ago

I will add a fix in the next version (today).

pksorensen commented 2 months ago

I am working on the same thing and the two docs that are in the pr just goes to intro side.

I have tried everything , also copy pasting all labels my self

version: '3.8'
services:
  traefik-forward-auth:
    image: 'thomseddon/traefik-forward-auth:2'
    environment:
      - DEFAULT_PROVIDER=oidc
      - 'PROVIDERS_OIDC_ISSUER_URL=${AUTZ_OPENID_ISSUER}'
      - 'PROVIDERS_OIDC_CLIENT_ID=${AUTZ_OPENID_CLIENT_ID}'
      - 'PROVIDERS_OIDC_CLIENT_SECRET=${AUTZ_OPENID_CLIENT_SECRET}'
      - 'SECRET=${AUTZ_OPENID_CLIENT_SECRET}'
      - LOG_LEVEL=debug
    labels:
      - 'traefik.http.middlewares.traefik-forward-auth.forwardauth.address=http://traefik-forward-auth:4181'
      - traefik.http.middlewares.traefik-forward-auth.forwardauth.authResponseHeaders=X-Forwarded-User
      - traefik.http.services.traefik-forward-auth.loadbalancer.server.port=4181
  opendevin-app:
    image: 'ghcr.io/opendevin/opendevin:0.8'
    environment:
      - 'SANDBOX_USER_ID=${SANDBOX_USER_ID}'
      - WORKSPACE_MOUNT_PATH=/data/opendevin
    volumes:
      - '/data/opendevin:/opt/workspace_base'
      - '/var/run/docker.sock:/var/run/docker.sock'
    ports:
      - '3000:3000'
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    labels:
      - traefik.http.routers.https-0-x84so8c-opendevin-app.middlewares=traefik-forward-auth
      - coolify.managed=true
      - coolify.serviceId=7
      - coolify.type=service
      - coolify.name=opendevin-app-x84so8c
      - coolify.service.subId=17
      - coolify.service.subType=application
      - traefik.enable=true
      - traefik.http.middlewares.gzip.compress=true
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
      - traefik.http.routers.http-0-x84so8c-opendevin-app.entryPoints=http
      - traefik.http.routers.http-0-x84so8c-opendevin-app.middlewares=redirect-to-https
      - 'traefik.http.routers.http-0-x84so8c-opendevin-app.rule=Host(`opendevin.kjeldager.io`) && PathPrefix(`/`)'
      - traefik.http.routers.http-0-x84so8c-opendevin-app.service=http-0-x84so8c-opendevin-app
      - traefik.http.routers.https-0-x84so8c-opendevin-app.entryPoints=https
      - traefik.http.routers.https-0-x84so8c-opendevin-app.middlewares=gzip
      - 'traefik.http.routers.https-0-x84so8c-opendevin-app.rule=Host(`opendevin.kjeldager.io`) && PathPrefix(`/`)'
      - traefik.http.routers.https-0-x84so8c-opendevin-app.service=https-0-x84so8c-opendevin-app
      - traefik.http.routers.https-0-x84so8c-opendevin-app.tls.certresolver=letsencrypt
      - traefik.http.routers.https-0-x84so8c-opendevin-app.tls=true
      - traefik.http.services.http-0-x84so8c-opendevin-app.loadbalancer.server.port=3000
      - traefik.http.services.https-0-x84so8c-opendevin-app.loadbalancer.server.port=3000
      - 'caddy_0.encode=zstd gzip'
      - 'caddy_0.handle_path.0_reverse_proxy={{upstreams 3000}}'
      - 'caddy_0.handle_path=/*'
      - caddy_0.header=-Server
      - 'caddy_0.try_files={path} /index.html /index.php'
      - 'caddy_0=https://opendevin.kjeldager.io'
      - caddy_ingress_network=x84so8c

I basically need to add one label - traefik.http.routers.https-0-x84so8c-opendevin-app.middlewares=traefik-forward-auth and it do not seem to have an effect and also saw it changed the routername back to container name which i first tried as some point. Unsure how to proceed. did you get it working @djoohl @AndreasFaust

mirsella commented 3 weeks ago

hey, I have tried to edit the coolify.managed labels so that a crontab ran container is not deleted on cleanup, but without success. both labels are shown on the "docker compose content" page, one line to true and one to false.

edit: of course the read only label is checked.

thanks

dancodes commented 3 weeks ago

I'm looking for a way to implement IPAllowList on one of my docker-compose resources, but I'm not able to add custom labels to it. Other resources work fine

jperelli commented 2 weeks ago

I need to mitigate ddos with