Successfully dockerized app but having problems with real-time functionality of the Phoenix Live Dashboard

Hello everyone, I hope you are well.I have developed a Phoenix application which performs CRUD operations on users. Following the prescribed documentation, Deploying with Releases — Phoenix v1.7.11, I have successfully compiled it into a release build file and subsequently dockerized it. Despite these efforts, I have encountered an issue with dockerizing the application, specifically related to the real-time functionality of the Phoenix Live Dashboard.

In an attempt to rectify this issue, I have incorporated the following configuration within my config/prod.exs file:

check_origin: [
http://localhost:4000”,
http://127.0.0.1:4000
],

This configuration facilitated successful connection to the Phoenix Live Socket, thus enabling navigation to the Phoenix Live Dashboard and visualization of metric graphs. However, the graphs remain devoid of data and do not update in real-time. I am currently uncertain about the additional steps required to resolve this issue.

In my docker run command, I have exposed the necessary ports and provided environmental variables such as database_url and secret_key_base . Below is the command utilized for docker build:

docker build -t phoenix/docker_rel:v1

And subsequently, the command used for running the container:

docker container run -d --publish 4000:4000 --env DATABASE_URL=database_url --env SECRET_KEY_BASE=secret_key_base --name docker phoenix/docker_rel:v1

I kindly request assistance in identifying the underlying issue and determining any additional configurations that may be required. Any insights or guidance provided would be greatly appreciated.

1 Like

Are you serving the dashboard behind a reverse proxy? If yes, then you need to allow headers that facilitate a websocket connection.

I could show an nginx example if I will find it.

1 Like