SAP / e-mobility-charging-stations-simulator

OCPP-J charging stations simulator
Apache License 2.0
136 stars 54 forks source link

[BUG] web-ui doesn't connect to simulator when running as container #1040

Closed Heitikol closed 3 weeks ago

Heitikol commented 4 months ago

Duplicate issue

Component

Web UI

Description

When starting the simulator via docker compose up, the web-ui can't connect to the simulator.

Version

1.3.3

Node.js version

v20.12.2

System

Win 10

Expected result

Running docker compose up results in the calibrated charging stations being accessible via the UI. We expect the same behaviour as when running the simulator via pnpm start and pnpm preview (i.e. not in a container)

Actual result

Running docker compose up results in the configured charging stations successfully being simulated, e.g. trying to connect to the provided supervision URL maintained in the config-file in the docker-folder. But when opening the UI via http://localhost:3030/ it throws an error:

Toast:

  1. Error: Error in WebSocket to UI server 'localhost'
  2. Info: WebSocket to UI server closed

Browser console:

  1. WebSocket connection to ws://localhost:8080/ failed'
  2. Error in WebSocket to UI server localhost

When running the simulator via pnpm start and pnpm preview the UI works as expected

Steps to reproduce

  1. clone repository
  2. create config.json and idtags.json in src/assets as copy of the template files config-template.json and idtags.json
  3. cd ui
  4. cd web
  5. run docker compose up -d --build --force-recreate
  6. open http://localhost:3030/ with a browser of choice
  7. notice that none of the configured stations are available

Attachments

grafik grafik

jerome-benoit commented 4 months ago

We do not have the bandwidth needed to maintain the UI on the docker image working. But PR are accepted ;)

Heitikol commented 4 months ago

Hi Jerome, thank you for your feedback. We'll think about integrating the UI and simulator in a docker image. If we do, we'll provide a PR Thank you

jerome-benoit commented 4 months ago

We'll think about integrating the UI and simulator in a docker image. If we do, we'll provide a PR

On a different docker image than the one running the simulator?

Since the Web UI is far from being secure, the recommended setup is to deploy the simulator alone with the UI server enabled and protected behind a WSS reverse proxy. And setup the UI locally to connect to the multiples simulators instance deployed to monitor them. The authentication less UI is then not exposed to the public.