WebSocket issues on self-hosted site

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • pudgyb
    commented on 's reply
    This setup seems to work

    services:

    mysql:
    image: mysql:8
    container_name: mysql
    environment:
    MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    MYSQL_DATABASE: ${MYSQL_DATABASE}
    MYSQL_USER: ${MYSQL_USER}
    MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    volumes:
    - mysql:/var/lib/mysql
    restart: always

    espocrm:
    image: espocrm/espocrm
    container_name: espocrm
    environment:
    ESPOCRM_DATABASE_PLATFORM: Mysql
    ESPOCRM_DATABASE_HOST: mysql
    ESPOCRM_DATABASE_USER: ${MYSQL_USER}
    ESPOCRM_DATABASE_PASSWORD: ${MYSQL_PASSWORD}
    ESPOCRM_ADMIN_USERNAME: ${ESPOCRM_ADMIN_USERNAME}
    ESPOCRM_ADMIN_PASSWORD: ${ESPOCRM_ADMIN_PASSWORD}
    ESPOCRM_SITE_URL: "http://${IP_ADDRESS}"
    volumes:
    - espocrm:/var/www/html
    restart: always
    ports:
    - ${IP_ADDRESS}:8080:80

    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://${IP_ADDRESS}/wss"
    ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN: "tcp://*:7777"
    ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN: "tcp://espocrm-websocket:7777"
    ESPOCRM_CONFIG_WEB_SOCKET_SSL_ALLOW_SELF_SIGNED: "true"
    volumes:
    - espocrm:/var/www/html
    restart: always
    entrypoint: docker-websocket.sh
    ports:
    - ${IP_ADDRESS}:8081:8080

    volumes:
    mysql:
    espocrm:


    map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
    }

    server {
    listen 80;
    server_name 192.168.X.X;

    return 301 https://$host$request_uri;
    }

    server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name 192.168.X.X;

    ssl_certificate /etc/ssl/certs/server.crt;
    ssl_certificate_key /etc/ssl/private/server.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers 'EECDH+AESGCM:EECDH+AES:RSA+AESGCM:RSA+AES';
    ssl_prefer_server_ciphers on;

    location / {
    proxy_pass http://192.168.X.X:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /wss {
    proxy_pass http://192.168.X.X:8081;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_read_timeout 1h;
    }
    }

  • lazovic
    commented on 's reply
    We would be very grateful if you could share more detailed information about where and how exactly what was changed.

  • pudgyb
    replied
    I fixed it by changing the port mappings and targeting the correct port (it was not looking at /wss)

    Leave a comment:


  • emillod
    replied
    We're using EspoCRM with websocket through docker and traefik. In console i can see wss://crm.domain.com/ws?authToken=XXXXXXXXXX&userId=XXXXXXXXXXXX

    In your thread i see that you have localhost:8443?
    Are you able to post your configuration?

    Leave a comment:


  • pudgyb
    started a topic WebSocket issues on self-hosted site

    WebSocket issues on self-hosted site

    Hi all,

    I've tried using Docker to no success - both through the regular compose with Nginx, and with the Traefik file.
    The issue I keep getting, regardless of the method I use, is autobahn.js:341 WebSocket connection to 'wss://localhost:8443/?authToken=...' failed:

    Without wss, there are no console errors. I need to run it over a secure connection though

    ​The Traefik compose I used is almost verbatim what is provided on the website. I've only replaced the usernames, passwords and IP address with ${ENV} variables.

    Help would be appreciated, because I've spent 2 days on this now.
Working...