thoughtworks / maeve-csms Goto Github PK
View Code? Open in Web Editor NEWMaEVe is an experimental EV Charge Station Management System (CSMS)
License: Apache License 2.0
MaEVe is an experimental EV Charge Station Management System (CSMS)
License: Apache License 2.0
I'm trying to test maeve-csms under Podman. While I was able to start all containers, I still fail to authenticate with occp-1.6 and I'm wondering if I do not misunderstood the login process.
Under podman/pod
Provisioning a charger-id with manager/api works
I may provision and verify that charging station was created
curl http://csms-host:9410/api/v0/cs/Tux-Basic -H 'content-type: application/json' -d '{"securityProfile":0, "base64SHA256Password":"c25vb3B5Cg=="}}'
curl http://csms-host:9410/api/v0/cs/Tux-Basic/auth
> {"base64SHA256Password":"c25vb3B5Cg==","securityProfile":0}
Then I try to log with ocpp-rpc client
I already use ocpp-rpc client with other server, also I known the protocol works. In fact checking here after wireshark image, we may see that the request/authen is clean. Even if the password encoding is probably wrong.
const { RPCClient } = require('ocpp-rpc');
const cli = new RPCClient({
endpoint: 'ws://csms-host:9310/ws', // the OCPP endpoint URL
identity: 'Tux-Basic',
password: 'c25vb3B5Cg==', // the OCPP identity
protocols: ['ocpp1.6'], // client understands ocpp1.6 subprotocol
strictMode: true, // enable strict validation of requests & responses
});
Question:
Here after my logs & startup script
Gateway log
2023/10/12 18:12:54 ERROR GET /ws/{id} duration=445.212µs http.scheme=ws http.method=GET http.url=/ws/Tux-Basic http.route=/ws/{id} csId=Tux-Basic ocpp.security_profile=0 auth.failure_reason="invalid password" http.status_code=401
Manager log
time=2023-10-12T18:12:16.140Z level=INFO msg="GET /api/v0/cs/Tux-B/auth" remote_addr=10.88.0.10:55506 status=404 bytes=23 duration=16.174µs
time=2023-10-12T18:12:54.321Z level=INFO msg="GET /api/v0/cs/Tux-Basic/auth" remote_addr=10.88.0.10:47434 status=200 bytes=60 duration=15.514µs
My Podman startup script
#!/bin/bash
# Script to start maeve-cms inside a podman 'pod'
# author: Fulup Ar Foll (iot.bzh)
# Licence: Apache-v2
if test -z "$ROOTDIR"; then
ROOTDIR=`dirname $0`
fi
echo "Container rootdir=$ROOTDIR"
if test -z "$PODIP"; then
PODIP=10.88.0.10
fi
echo "Container POD IP=$PODIP"
# restart from stratch
podman pod rm -f csms-pod
# rebuild local-image
for DOCKERFILE in $ROOTDIR/*/Dockerfile; do
podman build -f $DOCKERFILE
if test $? != 0; then
echo "Fail to rebuild $DOCKERFILE"
fi
done
#podman pod create --name=csms-pod --hostname=csms-host -p 9410:9410 -p 9411:9411 -v $ROOTDIR/config:/config:Z # unprivileged
podman pod create --name=csms-pod --hostname=csms-host --ip=$PODIP --network=podman -v $ROOTDIR/config:/config:Z # privileged
podman create --pod csms-pod --name=csms_debug --interactive -u 10000:10000 alpine
podman create --pod csms-pod --name=csms_mqtt -u 10000:10000 eclipse-mosquitto:2 "/usr/sbin/mosquitto" "-c" "/config/mosquitto/mosquitto.conf"
podman create --pod csms-pod --name=csms_lb --net csms --network-alias lb envoyproxy/envoy:v1.26-latest
podman create --pod csms-pod --name=csms_firestore google/cloud-sdk gcloud emulators firestore start --host-port=0.0.0.0:8080
podman create --pod csms-pod --name=csms_manager --requires=csms_mqtt -u 10000:10000 localhost/maeve-csms_manager serve -c /config/manager/config.toml
podman create --pod csms-pod --name=csms_gateway --requires=csms_mqtt,csms_manager localhost/maeve-csms_gateway serve --ws-addr :9310 --wss-addr :9311 --status-addr :9312 --tls-server-cert /config/certificates/csms.pem --tls-server-key /config/certificates/csms.key --tls-trust-cert /config/certificates/trust.pem --mqtt-addr mqtt://csms-host:1883 --manager-api-addr http://csms-host:9410
for CONTAINER in csms_debug csms_firestore csms_mqtt csms_manager csms_gateway; do
echo starting: $CONTAINER
podman start $CONTAINER
if test $? != 0; then
echo "fail to start container: $CONTAINER"
exit
fi
done
FYI,
I publish a small script to run a quick test in non-privileged mode using podman+ocpp-rpc.
Code is available from: https://github.com/tux-evse/ocpp-csms/tree/main
Is anyone else having issues with the Envoy load balancer present in the Docker Compose deployment? I am not able to talk to the manager service's API on port 9410 (or any of the other services the load balancer is acting as a reverse proxy for) through the load balancer. The manager's API is not the problem since I can curl the API from the host if I map the manager's API port to a local port, and I can curl the API port from within the load balancer container.
I've tried debugging Envoy to see what the issue is but even with it's log level set to debug
I'm not seeing anything obvious. Is there a reason why such a complex reverse proxy solution, or even a reverse proxy at all, is being used as part of the default Docker Compose config? I see the need for something like Envoy in a large-scale production deployment of MaEVe in Kubernetes for example, but not in a Docker Compose style deployment.
I would be please to get some explanation on how/when 'hubject.com' enter in the process and how we may use it to test plug&charge.
Looks like manager/config.toml already have an authorization token.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.