Docker with Treafik => 500 Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fabb
    Junior Member
    • Jan 2023
    • 3

    Docker with Treafik => 500 Error

    Hi All,

    I'm trying to setup a working environment using Docker and I'm able to access the webpage but directly get a Jquery 500 Error on top of the page. I think this has something todo with Websocket but I'm not sure. Has anyone running this with Docker and what about this example ?

    Code:
    ---
    version: '3.8'
    
    services:
    
    mysql:
    image: mysql:8
    container_name: mysql
    command: --default-authentication-plugin=mysql_native_password
    environment:
    MYSQL_ROOT_PASSWORD: root_password
    MYSQL_DATABASE: espocrm
    MYSQL_USER: espocrm
    MYSQL_PASSWORD: database_password
    volumes:
    - mysql:/var/lib/mysql
    restart: always
    
    espocrm:
    image: espocrm/espocrm
    container_name: espocrm
    environment:
    ESPOCRM_DATABASE_HOST: mysql
    ESPOCRM_DATABASE_USER: espocrm
    ESPOCRM_DATABASE_PASSWORD: database_password
    ESPOCRM_ADMIN_USERNAME: admin
    ESPOCRM_ADMIN_PASSWORD: password
    ESPOCRM_SITE_URL: "https://${DOMAIN}"
    volumes:
    - espocrm:/var/www/html
    restart: always
    labels:
    - traefik.enable=true
    - traefik.docker.network=traefik_public
    - traefik.http.routers.espocrm-app.rule=Host(`${DOMAIN}`)
    - traefik.http.routers.espocrm-app.entrypoints=https
    - traefik.http.routers.espocrm-app.tls=true
    - traefik.http.routers.espocrm-app.tls.certresolver=letsencrypt
    
    espocrm-daemon:
    image: espocrm/espocrm
    container_name: espocrm-daemon
    volumes:
    - espocrm:/var/www/html
    restart: always
    entrypoint: docker-daemon.sh
    
    espocrm-websocket:
    image: espocrm/espocrm
    container_name: espocrm-websocket
    environment:
    ESPOCRM_CONFIG_USE_WEB_SOCKET: "true"
    ESPOCRM_CONFIG_WEB_SOCKET_URL: "wss://${DOMAIN}/ws"
    ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN: "tcp://*:7777"
    ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN: "tcp://espocrm-websocket:7777"
    volumes:
    - espocrm:/var/www/html
    restart: always
    entrypoint: docker-websocket.sh
    labels:
    - traefik.enable=true
    - traefik.docker.network=traefik_public
    - traefik.http.routers.espocrm-ws.rule=Host(`${DOMAIN}`) && PathPrefix(`/ws`)
    - traefik.http.routers.espocrm-ws.entrypoints=https
    - traefik.http.routers.espocrm-ws.tls=true
    - traefik.http.routers.espocrm-ws.tls.certresolver=letsencrypt
    - traefik.http.routers.espocrm-ws.service=espocrm-ws-service
    - traefik.http.services.espocrm-ws-service.loadbalancer.server.port=8080
    
    volumes:
    mysql:
    espocrm:
    
    networks:
    default:
    name: traefik_public
    external: true​
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi Fabb,

    Please use the following instruction: https://github.com/espocrm/documenta...ker/traefik.md.

    Comment

    • Fabb
      Junior Member
      • Jan 2023
      • 3

      #3
      Thanks a lot lazovic

      It seems there it not that much wrong with my docker-compose file but what seems be an issue is the following:

      websocket on network "traefik" and "internal"
      app on network "traefik" and "internal"
      mysql on network "internal"
      daemon on network "internal"

      In this case the websocket cannot connect to the mysql server. When I put all containers in the same network it's all fine.

      I like to keep some traffic on an internal network only and only have the webcontainers in the traefik network but routing seems to go wrong then.

      Comment

      • Fabb
        Junior Member
        • Jan 2023
        • 3

        #4
        OK I got iy fixed by re-adding - traefik.docker.network= to the labels.

        Comment

        Working...