EVerest / everest-demo

EVerest demo: Dockerized demo with software in the loop simulation
Apache License 2.0
11 stars 13 forks source link

Software In Loop Simulation Script Not Found #47

Closed louisg1337 closed 1 month ago

louisg1337 commented 1 month ago

After the newest changes to everest-demo/main last night (found here), running the demo-iso15118-2-ac-plus-ocpp.sh command now returns this error:

Starting software in the loop simulation

sh: can't open '/workspace/build/run-scripts/run-sil-ocpp201-pnc.sh': No such file or directory
shankari commented 1 month ago

This is almost certainly due to the changes in https://github.com/EVerest/everest-demo/pull/39 since I bumped up the .env version last night to incorporate them.

It looks like when @couryrr-afs was making the changes in https://github.com/EVerest/everest-demo/pull/39/commits/4fb6194267d178e42005e7aadb6dede9dfc797be, he forgot this particular docker-compose file

@drmrd @wjmp for visibility

@louisg1337 instead of waiting for the whole sprint planning cycle, can you just create a new PR to fix this in the same way as the others?

shankari commented 1 month ago

Made the obvious changes to replace /workspace/ with /ext/source/

diff --git a/demo-iso15118-2-ac-plus-ocpp.sh b/demo-iso15118-2-ac-plus-ocpp.sh
index d704df3..9dd5f92 100755
--- a/demo-iso15118-2-ac-plus-ocpp.sh
+++ b/demo-iso15118-2-ac-plus-ocpp.sh
@@ -342,7 +342,7 @@ pushd everest-demo || exit 1
 docker compose --project-name everest-ac-demo --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait
 docker cp config-sil-ocpp201-pnc.yaml  everest-ac-demo-manager-1:/ext/source/config/config-sil-ocpp201-pnc.yaml
 if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
-  docker cp manager/cached_certs_correct_name_emaid.tar.gz everest-ac-demo-manager-1:/workspace/
+  docker cp manager/cached_certs_correct_name_emaid.tar.gz everest-ac-demo-manager-1:/ext/source/
   docker exec everest-ac-demo-manager-1 /bin/bash -c "tar xf cached_certs_correct_name_emaid.tar.gz"

   echo "Configured everest certs, validating that the chain is set up correctly"
@@ -355,19 +355,19 @@ else
   if [[ "$DEMO_VERSION" =~ sp1 ]]; then
     echo "Copying device DB, configured to SecurityProfile: 1"
     docker cp manager/device_model_storage_maeve_sp1.db \
-      everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db
+      everest-ac-demo-manager-1:/ext/source/dist/share/everest/modules/OCPP201/device_model_storage.db
   elif [[ "$DEMO_VERSION" =~ sp2 ]]; then
     echo "Copying device DB, configured to SecurityProfile: 2"
     docker cp manager/device_model_storage_maeve_sp2.db \
-      everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db
+      everest-ac-demo-manager-1:/ext/source/dist/share/everest/modules/OCPP201/device_model_storage.db
   elif [[ "$DEMO_VERSION" =~ sp3 ]]; then
     echo "Copying device DB, configured to SecurityProfile: 3"
     docker cp manager/device_model_storage_maeve_sp3.db \
-      everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db
+      everest-ac-demo-manager-1:/ext/source/dist/share/everest/modules/OCPP201/device_model_storage.db
   fi
 fi

 if [[ "$DEMO_VERSION" =~ v2.0.1 ]]; then
   echo "Starting software in the loop simulation"
-  docker exec everest-ac-demo-manager-1 sh /workspace/build/run-scripts/run-sil-ocpp201-pnc.sh
+  docker exec everest-ac-demo-manager-1 sh /ext/source/build/run-scripts/run-sil-ocpp201-pnc.sh
 fi
shankari commented 1 month ago

Issue #1: The patches are not working

When I run the script, I get

Setting up maeve Patching the CSMS to disable load balancer patching file docker-compose.yml Reversed (or previously applied) patch detected! Assume -R? [y] n Apply anyway? [n] n 4 out of 4 hunks ignored--saving rejects to docker-compose.yml.rej ... Patching the CSMS to enable local mo root patching file 'manager/handlers/ocpp201/authorize.go' 2 out of 2 hunks failed--saving rejects to 'manager/handlers/ocpp201/authorize.go.rej'

The commit that we have configured is the same https://github.com/EVerest/everest-demo/commit/6cad080c129f03f67726403329a41a9e1e645a42

- MAEVE_REPO="https://github.com/thoughtworks/maeve-csms.git"
- MAEVE_BRANCH="b990d0eddf2bf80be8d9524a7b08029fbb305c7d" # patch files are based on this commit
+ CSMS_REPO="https://github.com/thoughtworks/maeve-csms.git"
+ CSMS_BRANCH="b990d0eddf2bf80be8d9524a7b08029fbb305c7d" # patch files are based on this commit
+ CSMS="maeve"

The most likely explanation is that we are not resetting properly. Bingo! In https://github.com/EVerest/everest-demo/commit/6cad080c129f03f67726403329a41a9e1e645a42#diff-d342743ec0e9fbd3afe02d5923219c40cb69710d22ea81d57138678e42366110R94 we are resetting to the CSMS_BRANCH before cloning.

@louisg1337 for visibility

shankari commented 1 month ago

Issue #2: EVerest is not configured properly

                                             Successfully copied 6.66kB to everest-ac-demo-manager-1:/ext/source/config/config-sil-ocpp201-pnc.yaml
                                             Successfully copied 29.2kB to everest-ac-demo-manager-1:/ext/source/
tar: can't open 'cached_certs_correct_name_emaid.tar.gz': No such file or directory
Configured everest certs, validating that the chain is set up correctly
Could not open file or uri for loading certs of untrusted certificates from dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem
485B5394777F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:crypto/store/store_register.c:237:scheme=file
485B5394777F0000:error:80000002:system library:file_open:No such file or directory:providers/implementations/storemgmt/file_store.c:267:calling stat(dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem)
Copying device DB, configured to SecurityProfile: 3
                                             Successfully copied 84.5kB to everest-ac-demo-manager-1:/ext/source/dist/share/everest/modules/OCPP201/device_model_storage.db
Error response from daemon: Could not find the file /ext/source/dist/share/everest/modules/OCPP201 in container everest-ac-demo-manager-1

And it still connects to SP1.

2024-05-31 23:51:56.038721 [INFO] ocpp:OCPP201     :: All EVSE ready. Starting OCPP2.0.1 service
2024-05-31 23:51:56.168104 [INFO] ocpp:OCPP201     :: Connecting to plain websocket at uri: ws://localhost:9000/cp001 with security profile: 1
shankari commented 1 month ago

The new location is in /ext/source/build/dist, not just /ext/source/dist

# find / -name \*certs
/ext/source/build/dist/etc/everest/certs

# find / -name device_model_storage.db
/ext/source/build/_deps/libocpp-build/config/v201/device_model_storage.db
/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db

# ls -al /ext/source/build/dist/share/everest/modules/OCPP201/
total 132
drwxr-xr-x    1 root     root          4096 May 27 16:44 .
drwxr-xr-x    1 root     root          4096 May 27 16:44 ..
-rw-r--r--    1 root     root         25415 May 27 16:22 config.json
-rw-r--r--    1 root     root         81920 May 27 16:22 device_model_storage.db
-rw-r--r--    1 root     root          2517 May 27 16:22 init_core.sql
-rw-r--r--    1 root     root           749 May 27 16:22 logging.ini

/workspace # ls -al /workspace/dist/share/everest/modules/OCPP201/
total 116
drwxr-xr-x    1 root     root          4096 May 27 16:45 .
drwxr-xr-x    1 root     root          4096 May 27 16:45 ..
-rw-r--r--    1 root     root         25249 May 27 16:20 config.json
-rw-r--r--    1 root     root         81920 May 27 16:20 device_model_storage.db

Fixing the paths...