admin管理员组

文章数量:1122846

I recently updated ddev from v1.21.0 to v1.23.5.

My configuration contains several services, but uses NOT the web container itself, because there is not "default" service. I us ddev-router to route the traffic to the specific ports of each container, depending pn the fqdns.

After the update and fixing some issues, ALL traffic is routed to web and no service is addressed properly anymore.

These are parts of my config (this is an older project, so please do not complain about the php version):

config.yaml

name: kla-api
type: php
docroot: public
php_version: "7.4"
webserver_type: apache-fpm
xdebug_enabled: true
additional_hostnames: []
additional_fqdns:
    - kla-backend.ddev.site
    - kla-frontend.ddev.site
    - kla-mail-service.ddev.site
    - kla-file-service.ddev.site
    - kla-preview-service.ddev.site
    - kla-configuration-service.ddev.site
    - kla-api.ddev.site
    - dba
database:
    type: mariadb
    version: "10.4"
use_dns_when_possible: true
composer_version: "2"
web_environment: []
nodejs_version: "16"
corepack_enable: false

docker-compose.api-service.yaml (as a sample)

services:
  kla-api.ddev.site:
    container_name: "kla-api"
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: ${DDEV_APPROOT}
      com.ddev.app-type: php
    build:
      args:
        BASE_IMAGE: ddev/ddev-webserver:v1.23.5
        DDEV_PHP_VERSION: "7.4"
        gid: "20"
        uid: "1025"
        username: fwtag
      context: [xxx]/kla-api/.ddev/.webimageBuild
      dockerfile: Dockerfile
    external_links:
      - ddev-router:kla-api.ddev.site
    cap_add:
      - SYS_PTRACE
    healthcheck:
      interval: 1s
      retries: 120
      start_period: 2m0s
      timeout: 2m0s
    networks:
      ddev_default: null
      default: null
    expose:
      - 8040
      - 8041
    environment:
      PHP_IDE_CONFIG: serverName=kla-api.ddev.site
      VIRTUAL_HOST: kla-api.ddev.site
      DDEV_PRIMARY_URL: 
      HTTP_EXPOSE: 80:80,8040:8040
      HTTPS_EXPOSE: 443:80,8041:8040
      DDEV_WEBSERVER_TYPE: apache-fpm
      DDEV_XDEBUG_ENABLED: "true"
      DDEV_DOCROOT: public
      DOCROOT: public
      DDEV_PHP_VERSION: "7.4"
      SSH_AUTH_SOCK: /home/.ssh-agent/socket
      USER: fwtag
    links:
      - db:db
    restart: "no"
    user: "1025:20"
    volumes:
      - bind:
          create_host_path: true
        read_only: true
        source: [xxx]/kla-api/.ddev
        target: /mnt/ddev_config
        type: bind
      - source: [xxx]/kla-api
        target: /var/www/html
        type: bind
      - source: ddev-global-cache
        target: /mnt/ddev-global-cache
        type: volume
        volume: { }
      - source: ddev-ssh-agent_socket_dir
        target: /home/.ssh-agent
        type: volume
        volume: { }
    working_dir: /var/www/html

Each docker-compose of each service looks more or less the same.

The ddev (re)start is performed from within kla-api (this is the config shown above), where the ddev config can be found.

Each request to any other service is routed to web resp. kla-api.

What did change here or what am I doing wrong?

--- Edit ---

Currently, I suspect the trafik router config as cause for my troubles. In /traefik/config/kla-api.yaml I find these parts regarding the kla-preview-service:

...
  routers:
    kla-api-kla-preview-service-80-http:
      entrypoints:
        - http-80
      rule: HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-kla-preview-service-80"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
    kla-api-kla-preview-service-8052-http:
      entrypoints:
        - http-8052
      rule: HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-kla-preview-service-8052"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
...
    kla-api-web-80-http:
      entrypoints:
        - http-80
      rule: HostRegexp(`^kla-api\.ddev\.site$`)|| HostRegexp(`^dba$`)|| HostRegexp(`^kla-backend\.ddev\.site$`)|| HostRegexp(`^kla-configuration-service\.ddev\.site$`)|| HostRegexp(`^kla-file-service\.ddev\.site$`)|| HostRegexp(`^kla-frontend\.ddev\.site$`)|| HostRegexp(`^kla-mail-service\.ddev\.site$`)|| HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-web-80"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
    kla-api-web-8025-http:
      entrypoints:
        - http-8025
      rule: HostRegexp(`^kla-api\.ddev\.site$`)|| HostRegexp(`^dba$`)|| HostRegexp(`^kla-backend\.ddev\.site$`)|| HostRegexp(`^kla-configuration-service\.ddev\.site$`)|| HostRegexp(`^kla-file-service\.ddev\.site$`)|| HostRegexp(`^kla-frontend\.ddev\.site$`)|| HostRegexp(`^kla-mail-service\.ddev\.site$`)|| HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-web-8025"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"

...
  services:
    kla-api-kla-preview-service-80:
      loadbalancer:
        servers:
          - url: http://ddev-kla-api-kla-preview-service:80
        
    kla-api-kla-preview-service-8052:
      loadbalancer:
        servers:
          - url: http://ddev-kla-api-kla-preview-service:8052
...

The docker-compose.preview-service.yamlcontains the following parts:

...
    expose:
      - 8052
      - 8053
...
    environment:
      HTTP_EXPOSE: 80:80,8052:8052
      HTTPS_EXPOSE: 443:80,8053:8052
...

Is my config actually wrong? I am a bit overwhelmed reagrding the config changes in this quite old project ...

I recently updated ddev from v1.21.0 to v1.23.5.

My configuration contains several services, but uses NOT the web container itself, because there is not "default" service. I us ddev-router to route the traffic to the specific ports of each container, depending pn the fqdns.

After the update and fixing some issues, ALL traffic is routed to web and no service is addressed properly anymore.

These are parts of my config (this is an older project, so please do not complain about the php version):

config.yaml

name: kla-api
type: php
docroot: public
php_version: "7.4"
webserver_type: apache-fpm
xdebug_enabled: true
additional_hostnames: []
additional_fqdns:
    - kla-backend.ddev.site
    - kla-frontend.ddev.site
    - kla-mail-service.ddev.site
    - kla-file-service.ddev.site
    - kla-preview-service.ddev.site
    - kla-configuration-service.ddev.site
    - kla-api.ddev.site
    - dba
database:
    type: mariadb
    version: "10.4"
use_dns_when_possible: true
composer_version: "2"
web_environment: []
nodejs_version: "16"
corepack_enable: false

docker-compose.api-service.yaml (as a sample)

services:
  kla-api.ddev.site:
    container_name: "kla-api"
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: ${DDEV_APPROOT}
      com.ddev.app-type: php
    build:
      args:
        BASE_IMAGE: ddev/ddev-webserver:v1.23.5
        DDEV_PHP_VERSION: "7.4"
        gid: "20"
        uid: "1025"
        username: fwtag
      context: [xxx]/kla-api/.ddev/.webimageBuild
      dockerfile: Dockerfile
    external_links:
      - ddev-router:kla-api.ddev.site
    cap_add:
      - SYS_PTRACE
    healthcheck:
      interval: 1s
      retries: 120
      start_period: 2m0s
      timeout: 2m0s
    networks:
      ddev_default: null
      default: null
    expose:
      - 8040
      - 8041
    environment:
      PHP_IDE_CONFIG: serverName=kla-api.ddev.site
      VIRTUAL_HOST: kla-api.ddev.site
      DDEV_PRIMARY_URL: https://kla-api.ddev.site
      HTTP_EXPOSE: 80:80,8040:8040
      HTTPS_EXPOSE: 443:80,8041:8040
      DDEV_WEBSERVER_TYPE: apache-fpm
      DDEV_XDEBUG_ENABLED: "true"
      DDEV_DOCROOT: public
      DOCROOT: public
      DDEV_PHP_VERSION: "7.4"
      SSH_AUTH_SOCK: /home/.ssh-agent/socket
      USER: fwtag
    links:
      - db:db
    restart: "no"
    user: "1025:20"
    volumes:
      - bind:
          create_host_path: true
        read_only: true
        source: [xxx]/kla-api/.ddev
        target: /mnt/ddev_config
        type: bind
      - source: [xxx]/kla-api
        target: /var/www/html
        type: bind
      - source: ddev-global-cache
        target: /mnt/ddev-global-cache
        type: volume
        volume: { }
      - source: ddev-ssh-agent_socket_dir
        target: /home/.ssh-agent
        type: volume
        volume: { }
    working_dir: /var/www/html

Each docker-compose of each service looks more or less the same.

The ddev (re)start is performed from within kla-api (this is the config shown above), where the ddev config can be found.

Each request to any other service is routed to web resp. kla-api.

What did change here or what am I doing wrong?

--- Edit ---

Currently, I suspect the trafik router config as cause for my troubles. In /traefik/config/kla-api.yaml I find these parts regarding the kla-preview-service:

...
  routers:
    kla-api-kla-preview-service-80-http:
      entrypoints:
        - http-80
      rule: HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-kla-preview-service-80"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
    kla-api-kla-preview-service-8052-http:
      entrypoints:
        - http-8052
      rule: HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-kla-preview-service-8052"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
...
    kla-api-web-80-http:
      entrypoints:
        - http-80
      rule: HostRegexp(`^kla-api\.ddev\.site$`)|| HostRegexp(`^dba$`)|| HostRegexp(`^kla-backend\.ddev\.site$`)|| HostRegexp(`^kla-configuration-service\.ddev\.site$`)|| HostRegexp(`^kla-file-service\.ddev\.site$`)|| HostRegexp(`^kla-frontend\.ddev\.site$`)|| HostRegexp(`^kla-mail-service\.ddev\.site$`)|| HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-web-80"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"
    kla-api-web-8025-http:
      entrypoints:
        - http-8025
      rule: HostRegexp(`^kla-api\.ddev\.site$`)|| HostRegexp(`^dba$`)|| HostRegexp(`^kla-backend\.ddev\.site$`)|| HostRegexp(`^kla-configuration-service\.ddev\.site$`)|| HostRegexp(`^kla-file-service\.ddev\.site$`)|| HostRegexp(`^kla-frontend\.ddev\.site$`)|| HostRegexp(`^kla-mail-service\.ddev\.site$`)|| HostRegexp(`^kla-preview-service\.ddev\.site$`)
      
      service: "kla-api-web-8025"
      ruleSyntax: v3
      tls: false
      # middlewares:
      #   - "kla-api-redirectHttps"

...
  services:
    kla-api-kla-preview-service-80:
      loadbalancer:
        servers:
          - url: http://ddev-kla-api-kla-preview-service:80
        
    kla-api-kla-preview-service-8052:
      loadbalancer:
        servers:
          - url: http://ddev-kla-api-kla-preview-service:8052
...

The docker-compose.preview-service.yamlcontains the following parts:

...
    expose:
      - 8052
      - 8053
...
    environment:
      HTTP_EXPOSE: 80:80,8052:8052
      HTTPS_EXPOSE: 443:80,8053:8052
...

Is my config actually wrong? I am a bit overwhelmed reagrding the config changes in this quite old project ...

Share Improve this question edited Nov 23, 2024 at 8:46 fwtag asked Nov 22, 2024 at 19:24 fwtagfwtag 215 bronze badges 7
  • Hi @fwtag, I'm quite sure you shouldn't be using service names like kla-api.ddev.site in your docker-compose.api-service.yaml. Instead, name the service kla-api. Please recheck the docs for how you're doing some of these things. It looks very complicated. ddev.readthedocs.io/en/stable/users/extend/custom-compose-files/… – rfay Commented Nov 22, 2024 at 19:37
  • I'm not sure what you're doing here, or why you're building alternate images, but you might consider using web_extra_daemons if you're running alternate daemons. – rfay Commented Nov 22, 2024 at 19:38
  • @rfay Yes, it might be complicated, the project setup is quite old and I don't remember, why we did it like that. It could be that it has to do with XDebug. But however, has there been any change regarding the routing? I do not understand why it does not work anymore without having changed anything on my side. – fwtag Commented Nov 22, 2024 at 20:05
  • @rfay Found this one: ddev.readthedocs.io/en/stable/users/extend/traefik-router Obviously the router seems to be changed from 1.21. to 1.23. I think I need to get into it first. – fwtag Commented Nov 22, 2024 at 20:12
  • The nginx-proxy router is actually being removed in upcoming v1.24.0 (in the next couple of weeks). The traefik router has been default for a year or two. If you were doing sophisticated things with the nginx-proxy router... those might be different. – rfay Commented Nov 23, 2024 at 0:26
 |  Show 2 more comments

1 Answer 1

Reset to default 1

Since I could not really find a solution for this, but, however, obviously my whole setup was way to complicated end over-engineered, I ended up in refactor the project to use the second docroot approach which works well (enough). Find more on this in the /.ddev/apache/ folder of your project

Hence this issue is not solved, but might closed for now.

本文标签: After update to ddev v1235all traffic is routed to web containerStack Overflow