I am trying to run Odoo on a bare metal microk8s cluster and expose it to our LAN users using metallb and nginx ingress (by nginx inc.). Please note that no SSL termination is done in the nginx ingress so all traffic is on port 80. However the chat funtion (Discuss app) is not working correctly. No instant notification is received when logged in users try to message each other. Initially, the first time the user logs into Odoo, the notifications for previously sent and unread messages are displayed. But after that no notifications are received for new messages unless they log out and log in again.
Troubleshooting done so far:
- Is the websocket connection failing?
So far the websocket connection upgrade is successful. I can see the connection upgrade header on the request, and the server is responding correctly.
- Is the browser blocking the Odoo Javascript files responsible for processing the websocket messages from server because I am serving it on plain http (insecure)? Or mayebe Odoo doesnt like to be served insecurely over http?
Using the browser's debugging tools, I inspected if all of Odoo's assets are loaded and so far nothing is getting blocked.
I also installed and ran another Odoo instance and serve it over http (behind nginx reverse proxy of course), and the chat message worked fine. Please note that the Odoo instance and the reverse proxy are running on different linux baremetal machines not virtualized.
- Maybe nginx ingress controller (by nginx, inc.) just does not work with websockets?
I ran a sample chat app from websockets.org in the cluster using the nginx controller and the instant messaging and notifications worked fine.
- Maybe our LAN firewall is messing things up? Well, if firewall is messing up my setup #2 would have not worked, right? right?
I have also tried exposing the Odoo instance directly NodePort and LoadBalancer, the same issue.
Here are the details of my setup:
- three (3) node microk8s cluster, baremetal
- installed metallb (https://microk8s.io/docs/addon-metallb)
- installed nginx ingress by nignx inc. (https://docs.nginx.com/nginx-ingress-controller/installation/installing-nic/installation-with-helm/)
- Odoo is served over port 80 no https!
Here are the manifest files pertaining to Odoo application deployment.
# odoo-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: odoo
spec:
selector:
matchLabels:
app: odoo
replicas: 1
template:
metadata:
labels:
app: odoo
spec:
containers:
- name: odoo
image: odoo:16.0
imagePullPolicy: IfNotPresent
env:
- name: DB_USER
value: DB_USER_VALUE
- name: DB_PASSWORD
value: DB_PASSWORD_VALUE
- name: DB_NAME
value: DB_NAME_VALUE
- name: DB_PORT
value: DB_PORT_VALUE
- name: DB_HOST
value: DB_HOST_VALUE
# odoo-http-service.yaml
apiVersion: v1
kind: Service
metadata:
name: odoo-http
spec:
selector:
app: odoo
ports:
- protocol: TCP
port: 8069
targetPort: 8069
# odoo-gevent-service.yaml
apiVersion: v1
kind: Service
metadata:
name: odoo-gevent
spec:
selector:
app: odoo
ports:
- protocol: TCP
port: 8072
targetPort: 8072
# nginx ingress
# I have checked and tested the resulting nginx config for this and it works on
# non-containerized deployments e.g. a bare metal nginx reverse proxy
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: odoo-ingress
namespace: odoo
annotations:
nginx.org/websocket-services: "odoo-svr-gevent"
nginx.org/max-fails: "3"
nginx.org/proxy-connect-timeout: "300000"
nginx.org/proxy-read-timeout: "300000"
nginx.org/proxy-send-timeout: "300000"
nginx.org/redirect-to-https: "false"
nginx.org/location-snippets: |
proxy_redirect off;
spec:
ingressClassName: nginx
rules:
- host: mydomain.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: odoo-svr-http
port:
number: 8069
- path: /websocket
pathType: Prefix
backend:
service:
name: odoo-svr-gevent
port:
number: 8072
# odoo.conf
[options]
admin_passwd = 1
proxy_mode = True
log_level = debug
limit_time_cpu = 1200
limit_time_real = 2400
workers = 3
max_cron_threads = 1
gevent_port = 8072
http_port = 8069
longpolling_port = False
The expected behavior is that users will receive instant notifications when they receive a chat message.