containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/prestashop] Doesnt work with traefik

Open BettyNutz opened this issue 10 months ago • 4 comments

Name and Version

bitnami/prestashop

What architecture are you using?

amd64

What steps will reproduce the bug?

config and run traefik with docker compose and wildcard ssl certs. - works with all other containers (eg plausable) config and run bitnami prestshop - works with no ssl and no traefik add traefik labels to ps compose get 404 when adding url to firefox or Gateway Timeout when accessing (https://phpmyadmin.example.com/)

What is the expected behavior?

Presatshop runs website with tls letsencrypt certs behind traefik reverse proxy

What do you see instead?

get 404 or bad gateway when accessing ps url as main domain (not subdomain (which also does not work)-

Note: i actually show tls

Additional information

Hope someone can help - ive been stuck on this for weeks now

BettyNutz avatar Apr 13 '24 00:04 BettyNutz

services:
  mariadb:
    container_name: mariadb
    image: docker.io/bitnami/mariadb:latest
    environment:
      - ALLOW_EMPTY_PASSWORD=no
      - MARIADB_ROOT_PASSWORD=AzfrZEby2PKyyH59P
      - MARIADB_DATABASE=prestashop_2024
      - MARIADB_USER=user1
      - MARIADB_PASSWORD=gyeGjEZ92obHWg#Y#d7
    volumes:
      - /home/user1/bitnami/mariadb:/bitnami/mariadb
    networks:
      - prestashop-net

  prestashop:
    container_name: prestashop
    image: docker.io/bitnami/prestashop:latest
    environment:
      - PRESTASHOP_HOST=example.com
      - PRESTASHOP_TIMEZONE=Asia/Singapore
      - PRESTASHOP_DATABASE_HOST=mariadb
      - PRESTASHOP_DATABASE_PORT_NUMBER=3306
      - PRESTASHOP_DATABASE_USER=user1
      - PRESTASHOP_DATABASE_NAME=prestashop_2024
      - PRESTASHOP_DATABASE_PASSWORD=gyeGjEZ92obHWg#Y#d7
      - PRESTASHOP_FIRST_NAME=Bob
      - PRESTASHOP_LAST_NAME=Davis
      - PS_DEV_MODE=0
      - PS_DEMO_MODE=0
      - PS_FOLDER_ADMIN=admin076vwy4oc6vwy324
      - [email protected]
      - [email protected]
      - PHP_UPLOAD_MAX_FILESIZE=0M
      - PHP_MEMORY_LIMIT=512M
      - ALLOW_EMPTY_PASSWORD=no
      - PRESTASHOP_SMTP_HOST=smtp.ipage.com
      - PRESTASHOP_SMTP_PORT=587
      - [email protected]
      - PRESTASHOP_SMTP_PASSWORD=rdwKO1Xzq83HbFJ2
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.prestashop.rule=Host(`example.com`)" #This sets prestashop as the main domain
      - "traefik.http.routers.prestashop.entrypoints=websecure"
      - "traefik.http.routers.prestashop.tls.certresolver=myresolver"
    volumes:
      - /home/user1/bitnami/prestashop:/bitnami/prestashop
    depends_on:
      - mariadb
    networks:
      - prestashop-net
      - web

  phpmyadmin:
    container_name: myphpadmin
    image: phpmyadmin/phpmyadmin
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.phpmyadmin.rule=Host(`phpmyadmin.example.com`)" #This sets phpmyadmin as a subdomain
      - "traefik.http.routers.phpmyadmin.entrypoints=websecure"
      - "traefik.http.routers.phpmyadmin.tls.certresolver=myresolver"
    networks:
      - prestashop-net
      - web

networks:
  prestashop-net:
    external: true
  web:
    external: true

volumes:
  mariadb_data:
    driver: local
  prestashop_data:
    driver: local

BettyNutz avatar Apr 13 '24 01:04 BettyNutz

Do you have a docker-compose that also sets traefik? So we can reproduce the issue and understand if the issue is in the Bitnami packaging of Prestashop

javsalgar avatar Apr 15 '24 08:04 javsalgar

services:
  traefik:
    image: "traefik:latest"
    container_name: "traefik"
    command:
      - "--api.dashboard=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
      - "[email protected]"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)"
      - "traefik.http.routers.traefik.entrypoints=websecure"
      - "traefik.http.routers.traefik.service=api@internal"
      - "traefik.http.routers.traefik.tls.certresolver=myresolver"
      - "traefik.http.routers.traefik.middlewares=traefik-auth"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=user:$$2y$$05$$6m8MvyzgJ4Kl7/3rL4X6VurX1huMas8a7oPB3xRfBjFbGCR8MUi7W" # UN: user PW: demo
    networks:
      - web
networks:
  web:
    external: true

This is my dns:

Type Name Content
A * 138.152.1.16
A example.com 138.152.1.16
CNAME traefik example.com
CNAME plausible example.com

Note: I have made the persistent bitnami dir and set UID GUID to 1001 before ps compose up

I really appreciate your help - thanks!

BettyNutz avatar Apr 15 '24 08:04 BettyNutz

any idea? i only have an issue with this PrestaShop all my other containers work without issue? Hope someone can help

BettyNutz avatar Apr 25 '24 02:04 BettyNutz

Hi @BettyNutz, sorry for my very late response

I'll share some doubts/concerns that I don't have very clear (Please bare with me about traefik, I have a vague idea bout that tool):

  • Default Prestashop ports are 8080 and 8443, Don't you need to configure it in Traefik?
  • Prestashop container with your configuration exposes HTTPS service on port 8443 with self signed certificates. You have to keep it in mind if you are using TLS between Traefik and Prestashop.
  • What errors are you seeing in traefik container?

fmulero avatar May 02 '24 08:05 fmulero

Hi @BettyNutz, sorry for my very late response

I'll share some doubts/concerns that I don't have very clear (Please bare with me about traefik, I have a vague idea bout that tool):

* Default Prestashop ports are 8080 and 8443, Don't you need to configure it in Traefik?

* Prestashop container with your configuration exposes HTTPS service on port 8443 with self signed certificates. You have to keep it in mind if you are using TLS between Traefik and Prestashop.

* What errors are you seeing in traefik container?

It is my understanding that you remove all port into from the prestashop compose file as the traefik labels you add deals with how it connects. Traefik with all my other containers works fine also. I have no errors in my traefik container.

I didnt know about :

'Default Prestashop ports are 8080 and 8443' -- Im going to look into this - thanks

BettyNutz avatar May 03 '24 01:05 BettyNutz

there was an environment detail missing in the myphpadmin compose. adding it allowed me to edit the ps_configuration in the db to change ssl entries to 1.

missing info for myphpadmin:

environment:
  - PMA_HOST=mariadb
  - PMA_PORT=3306

BettyNutz avatar May 03 '24 02:05 BettyNutz

Did you find where was the problem in Prestashop? In order to help other users, Could you share your findings?

fmulero avatar May 03 '24 06:05 fmulero