Why getting 404 error code with phpmyadmin and traefik v2?

52 Views Asked by At

I'm trying to set up an environment with Docker Swarm Culster, Traefik and Portainer.

At least Traefik and Portainer are ok, the problem is with my PMA and Maria DB stack.

My pma-db.yml :

version: '3.1'

services:
  db:
    image: mariadb:10.6
    environment:
      MYSQL_ROOT_PASSWORD: ********
    networks:
      - backend
    volumes:
      - db-data:/db
    deploy:
      placement:
        constraints:
          - node.labels.db.db-data == true

  phpmyadmin:
    image: phpmyadmin
    environment:
      - PMA_ARBITRARY=1
      - PMA_ABSOLUTE_URI=https://pma.example.com
    networks:
      - backend
      - traefik-public
    ports:
      - 8081:80
    labels:
        - traefik.enable=true
        - traefik.docker.network=traefik-public
        - traefik.constraint-label=traefik-public
        - traefik.http.routers.pma_phpmyadmin-http.rule=Host(`${DOMAIN?Variable not set}`)
        - traefik.http.routers.pma_phpmyadmin-http.entrypoints=http
        - traefik.http.routers.pma_phpmyadmin-http.middlewares=https-redirect
        - traefik.http.routers.pma_phpmyadmin-https.rule=Host(`${DOMAIN?Variable not set}`)
        - traefik.http.routers.pma_phpmyadmin-https.entrypoints=https
        - traefik.http.routers.pma_phpmyadmin-https.tls=true
        - traefik.http.routers.pma_phpmyadmin-https.tls.certresolver=le
        - traefik.http.services.pma_phpmyadmin.loadbalancer.server.port=8081

networks:
  traefik-public:
    external: true
  backend:
    external: false

volumes:
  db-data:

When i set up the stack, i can't access to pma, there is an error 404 not found. I tried many things but still not working.

Pls can you help me understanding why this is not working ?

Thanks a lot

(Sorry for my bad english too)

I've tried -traefik.port=80 instead of traefik.http.services.pma_phpmyadmin.loadbalancer.server.port=8081, but i'm using docker swarm and -trafiek.port doesn't work in swarm environment ?

I've tried to remove ports section and still not working

1

There are 1 best solutions below

1
Maxime Serret On

I've tried to add traefik.http.routers.pma_phpmyadmin-https.service=pma_phpmyadmin and it still not working.

I tried again with ur following example, -> example.com/phpmyadmin and use PathPrefix, but still not working.

For checking if my http.routers was functional, i've tried to see it with the traefik dashboard, and traefik not seeing my service, i also trried to deploy a stack that i've found on the docker swarm rocks docs, with grafana / prometheus and swarm ready panels, and it's good, the certificate is generated and all working.

I don't understand why it's not working only with phpmyadmin, and i need to do it for my job ...