Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Upgrade to the latest everest #78

Closed
shankari opened this issue Oct 15, 2024 · 44 comments
Closed

⬆️ Upgrade to the latest everest #78

shankari opened this issue Oct 15, 2024 · 44 comments
Assignees

Comments

@shankari
Copy link
Collaborator

  • right now, we are using some funky image with hacked code from AFS + 5 patches
  • roll forward to end of september release as the base for the image
  • test managed charging scenarios with SIL
  • see if we need any other patches (hopefully small)
@shankari shankari added this to the CharIN demo prep milestone Oct 15, 2024
@shankari
Copy link
Collaborator Author

@the-bay-kay decided to continue tracking the roll forward in #74 since she was going to make the simulator improvements after the roll forward. Since that is issue is super long now, I am using this to track my testing and cleanup (if needed) of the roll forward. ETA tomorrow.

@shankari
Copy link
Collaborator Author

I am first rolling forward the demo script with the patch changes from the previous (June) repo before switching to the new September repo. I will not plan on rolling over the changes related to OCPP (since they will soon be obsolete), but I will plan on getting the payment mode changes in so that they can be reused.

While doing that, the manager/support_payment_in_jsevmanager.patch patch failed.
Digging into that, it looks like JsEvManager was removed.
Ah, from #74 (comment)

Compare this to the march release , where we had more granular control over the charging phases, and included payment details. JsCarSimulator was refractored into JsEvManager in april during PR EVerest/everest-core#549

Since this is not running off the charine2e image, it is based on the march release EVEREST_VERSION=2024.3.0
So I need to fix that patch to work against the JsCarSimulator instead before moving forward.

@shankari
Copy link
Collaborator Author

Actually, the JsCarSimulator already supported the payment method, so we didn't really need the change.
However, trying to plug the car in stuck at "PrepareCharging"
Adding a bunch of additional logs to figure out what is going on, I first figured out that:

  1. If we are not compiling, we need to edit build/dist/libexec/everest/modules/JsCarSimulator/index.js, not modules/simulation/JsCarSimulator/index.js
  2. the iso_start_v2g_session is apparently not getting registered at all, because I have a syntax error in it, which is not getting triggered,
  if (mod.uses_list.ev.length > 0) registerCmd(mod, 'iso_start_v2g_session', 2, (mod, c) => {
    evlog.info('SHANKARI: Invoked v2g session start' + c.args[0] + c.args[1]);

although when I copy-pasted the offending log to the previous command

  registerCmd(mod, 'iso_wait_slac_matched', 0, (mod, c) => {                                                              
    evlog.info('SHANKARI: Invoked iso_wait_slac_matched with slac_state " + mod.slac_state);

I did get an error when starting

/ext/source/build/dist/libexec/everest/modules/JsCarSimulator/index.js:463
    evlog.info('SHANKARI: Invoked iso_wait_slac_matched with slac_state " + mod.slac_state);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.18.2

As we can see from the code, this must be because mod.uses_list.ev.length is zero. I also notice that, in a successful session from march, #35 (comment)

I should expect to see HLC enabled, and I am not. Let's check the config that I'm trying to copy over with the old config...

2024-03-29 19:48:28.327823 [INFO] evse_manager_1:  :: Max AC hardware capabilities: 32A/3ph
2024-03-29 19:48:28.419715 [INFO] evse_manager_1:  :: AC HLC mode enabled.

2024-03-29 19:49:28.197119 [INFO] car_simulator_1  :: {
  cmd: 'iso_wait_slac_matched',
  args: [],
  exec: [Function (anonymous)]
}

2024-03-29 19:49:31.201259 [INFO] car_simulator_1  :: {
  cmd: 'iso_start_v2g_session',
  args: [ 'contract', 'ac_three_phase_core' ],
  exec: [Function (anonymous)]
}

@shankari
Copy link
Collaborator Author

Argh, no! evlog.info('SHANKARI: Invoked v2g session start' + c.args[0] + c.args[1]); is in fact valid.

2024-11-11 07:31:33.293053 [INFO] car_simulator_1  :: SHANKARI: mod.uses_list.ev = [{"call":{}}] of length 1
2024-11-11 07:31:33.293078 [INFO] car_simulator_1  :: SHANKARI_REGISTER: Found more than one ev, registering... 1
2024-11-11 07:31:33.293102 [INFO] car_simulator_1  :: SHANKARI: Finished registering start_v2g_session

@shankari
Copy link
Collaborator Author

shankari commented Nov 11, 2024

Ok, so there were actually a couple of errors:

  1. I was launching /ext/source/build/run-scripts/run-sil-ocpp201.sh instead of /ext/source/build/run-scripts/run-sil-ocpp201-pnc.sh
  2. the non-PnC version has a config with hlc turned off
  3. because there was no hlc, we didn't try to start the ISO session!

The challenge here, of course, was that there was no error reported here. Something around "Looking for HLC, not found", would be helpful!

After starting the correct script, the SP3 charge session started.
Tomorrow, I will check SP1 and then clean up the demo script some more before rolling forward.

@shankari
Copy link
Collaborator Author

SP1 fails because, although we are using an unencrypted connection between the station and the CSMS, we are still trying to use an encrypted connection between the station and the car, which apparently fails. Does SP1 imply TLS between station and car? It seems like that is a separate flag.

If we are in SP1, we don't copy certs around, but that should be OK because the self-signed certs are used by both the car and manager modules in EVerest. So I am still not sure why this fails.

2024-11-11 08:03:04.244681 [DEBG] iso15118_car    Everest::Everest::provide_cmd(std::string, std::string, JsonCommand)::<lambda(Everest::json)> :: Incoming iso15118_car:PyEvJosev->ev:ISO15118_ev->start_charging(EnergyTransferMode,PaymentOption) for <handler>
2024-11-11 08:03:04.245015 [DEBG] iso15118_car    Everest::Everest::provide_cmd(std::string, std::string, JsonCommand)::<lambda(Everest::json)> :: RETVAL: true
2024-11-11 08:03:04.245374 [DEBG] iso15118_car    void Everest::MQTTAbstractionImpl::publish(const std::string&, const std::string&, QOS) :: publishing to everest/iso15118_car/ev/cmd
2024-11-11 08:03:04.246043 [DEBG] iso15118_car    void Everest::MQTTAbstractionImpl::on_mqtt_message(std::shared_ptr<Everest::Message>) :: topic everest/iso15118_car/ev/cmd starts with everest/
2024-11-11 08:03:04.285009 [INFO] car_simulator_1  :: { cmd: 'iso_wait_pwr_ready', args: [], exec: [Function (anonymous)] }
2024-11-11 08:03:07.049808 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: EXI Codec version: 1.55
2024-11-11 08:03:07.050050 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Starting 15118 version: 0.25.2
2024-11-11 08:03:07.050289 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Communication session handler started
2024-11-11 08:03:07.051540 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Remaining SDP requests: 50
2024-11-11 08:03:07.153425 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Sending SDPRequest: [Security: TLS, Protocol: TCP]

2024-11-11 08:03:07.153724 [INFO] iso15118_charge  :: Received packet from [fe80::42:c0ff:fea8:6003]:34929 with security 0x00 and protocol 0x00

2024-11-11 08:03:07.153786 [INFO] iso15118_charge  :: SDP requested TLS, announcing TLS

2024-11-11 08:03:07.153929 [INFO] iso15118_charge  :: sendto([fe80::42:c0ff:fea8:6003]:34929) succeeded

2024-11-11 08:03:07.154006 [INFO] iso15118_charge  :: Received packet from [fe80::42:c0ff:fea8:6003]:34929 with security 0x00 and protocol 0x00

2024-11-11 08:03:07.154077 [INFO] iso15118_charge  :: SDP requested TLS, announcing TLS

2024-11-11 08:03:07.154114 [INFO] iso15118_charge  :: sendto([fe80::42:c0ff:fea8:6003]:34929) succeeded
2024-11-11 08:03:07.154202 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Received datagram from UDP server at address ('fe80::42:c0ff:fea8:6003', 15118, 0, 165)
2024-11-11 08:03:07.154484 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Received datagram from UDP server at address ('fe80::42:c0ff:fea8:6003', 15118, 0, 165)
2024-11-11 08:03:07.154779 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: SDPResponse received: [ IP address: fe80::42:c0ff:fea8:6003, Port: 64109 , Security: TLS , Transport: TCP ]
2024-11-11 08:03:07.154913 [DEBG] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: Starting TLS client, trying to connect to fe80::42:c0ff:fea8:6003 at port 64109 ...

2024-11-11 08:03:07.158575 [INFO] iso15118_charge  :: Incoming connection on eth0 from [a00:dbba:0:0:fe80::]:56250

2024-11-11 08:03:07.158843 [INFO] iso15118_charge  :: Started new TLS connection thread
2024-11-11 08:03:07.161137 [INFO] evse_security:E  :: Requesting certificate file: [V2G] file:"/ext/source/build/dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem"
2024-11-11 08:03:07.205291 [INFO] evse_security:E  :: Requesting key/pair: V2G
2024-11-11 08:03:07.212482 [INFO] evse_security:E  :: TPM Key: false
2024-11-11 08:03:07.214356 [WARN] evse_security:E evse_security::GetKeyPairResult evse_security::EvseSecurity::get_key_pair_internal(evse_security::LeafCertificateType, evse_security::EncodingFormat) :: Could not find private key for the selected certificate: (Could not find private key for given certificate: /ext/source/build/dist/etc/everest/certs/client/cso/CPO_CERT_CHAIN.pem key path: /ext/source/build/dist/etc/everest/certs/client/cso)

2024-11-11 08:03:07.246226 [ERRO] iso15118_charge void dlog_func(dloglevel_t, const char*, int, const char*, const char*, ...) :: Failed to read key/pair!

2024-11-11 08:03:07.246330 [INFO] iso15118_charge  :: Closing TLS connection thread

2024-11-11 08:03:07.246397 [ERRO] iso15118_charge void dlog_func(dloglevel_t, const char*, int, const char*, const char*, ...) :: Last TLS error was: -0x0001 - ERROR - Generic error
2024-11-11 08:03:07.248693 [ERRO] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: ConnectionResetError when trying to connect to host fe80::42:c0ff:fea8:6003 and port 64109
Traceback (most recent call last):
  File "/ext/source/build/dist/libexec/everest/modules/PyEvJosev/../../3rd_party/josev/iso15118/evcc/comm_session_handler.py", line 420, in start_comm_session
    self.tcp_client = await TCPClient.create(
  File "/ext/source/build/dist/libexec/everest/modules/PyEvJosev/../../3rd_party/josev/iso15118/evcc/transport/tcp_client.py", line 62, in create
    raise exc
  File "/ext/source/build/dist/libexec/everest/modules/PyEvJosev/../../3rd_party/josev/iso15118/evcc/transport/tcp_client.py", line 53, in create
    self.reader, self.writer = await asyncio.open_connection(
  File "/usr/lib/python3.10/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1103, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1133, in _create_connection_transport
    await waiter
ConnectionResetError

@shankari
Copy link
Collaborator Author

Turning off TLS in the config

--- a/manager/config-sil-ocpp201-pnc.yaml
+++ b/manager/config-sil-ocpp201-pnc.yaml
@@ -14,7 +14,7 @@ active_modules:
     config_module:
       device: auto
       supported_ISO15118_2: true
-      tls_active: true
+      tls_active: false
       is_cert_install_needed: false
   evse_manager_1:
     module: EvseManager

We can SP1 to work. I believe this is the current state after rolling forward as well.
#74 (comment)

So I am not going to debug this now since there is a workaround, and we can just debug it in the Sept release.

Moving on to cleaning up the demo script a bit before rolling forward.

@shankari
Copy link
Collaborator Author

I checked the current demo script on the march release and it is broken for SP1 and SP2 (with ISO 15118-2) because of the cert/TLS issue. I am going to disable them temporarily while cleaning up the demo script, because there is no point in having a broken demo.

2024-11-11 15:57:06.007087 [WARN] evse_security:E evse_security::GetKeyPairResult evse_security::EvseSecurity::get_key_pair_internal(evse_security::LeafCertificateType, evse_security::EncodingFormat) :: Could not find private key for the selected certificate: (Could not find private key for given certificate: /ext/source/build/dist/etc/everest/certs/client/cso/CPO_CERT_CHAIN.pem key path: /ext/source/build/dist/etc/everest/certs/client/cso)

2024-11-11 15:57:06.042828 [ERRO] iso15118_charge void dlog_func(dloglevel_t, const char*, int, const char*, const char*, ...) :: Failed to read key/pair!

2024-11-11 15:57:06.042886 [INFO] iso15118_charge  :: Closing TLS connection thread

2024-11-11 15:57:06.042905 [ERRO] iso15118_charge void dlog_func(dloglevel_t, const char*, int, const char*, const char*, ...) :: Last TLS error was: -0x0001 - ERROR - Generic error
2024-11-11 15:57:06.045178 [ERRO] iso15118_car    pybind11_init_everestpy(pybind11::module_&)::<lambda(const std::string&)> :: ConnectionResetError when trying to connect to host fe80::42:c0ff:fea8:c003 and port 64109

SP1 and SP2 do work without ISO, but it literally says ISO in the demo name. We should not be promising things we can't deliver.

@shankari shankari changed the title Test managed charging after rolling forward to the sept release ⬆️ Upgrade to the latest everything Nov 11, 2024
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 12, 2024
Several of the options in the demo do not actually work

For example:
- Citrine fails to build (even on main)
- SP1 (and SP2) won't work with TLS
EVerest#78 (comment)

Fixes:
- Error out before Citrine build with a message indicating
  that it is not supported
- Patch the config for SP1 and SP2 to disable TLS

Testing done:

- Citrine

```
Cloning citrineos CSMS from https://github.com/citrineos/citrineos-core.git into /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms and starting it
Cloning into 'citrineos-csms'...
remote: Enumerating objects: 16467, done.
remote: Counting objects: 100% (303/303), done.
remote: Compressing objects: 100% (221/221), done.
remote: Total 16467 (delta 139), reused 161 (delta 70), pack-reused 16164 (from 1)
Receiving objects: 100% (16467/16467), 5.07 MiB | 969.00 KiB/s, done.
Resolving deltas: 100% (10346/10346), done.
/var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd
Copying certs into /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms/Server/data/certificates
Validating that the certificates are set up correctly
Server/data/certificates/certChain.pem: OK
Chain:
depth=0: CN=host.docker.internal, O=EVerest, C=DE, DC=CPO (untrusted)
depth=1: CN=CPOSubCA2, O=EVerest, C=DE, DC=V2G (untrusted)
depth=2: CN=CPOSubCA1, O=EVerest, C=DE, DC=V2G (untrusted)
depth=3: CN=V2GRootCA, O=EVerest, C=DE, DC=V2G
No patches to apply
Build and run
CitrineOS does not currently build due to issues with npm dependencies. It is disabled until we roll forward. Apologies for the inconvenience!

```

- Maeve

```
                                             Successfully copied 84.5kB to everest-ac-demo-manager-1:/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
                                             Successfully copied 3.07kB to everest-ac-demo-manager-1:/tmp/
/ext/source /workspace
patching file config/config-sil-ocpp201-pnc.yaml
```

And then charging with EIM was successful

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

Now that we have cleared the decks with #82, we are ready to roll everything forward. I will base my changes and testing on https://github.com/the-bay-kay/everest-demo/tree/rollforward-demo

Onward and upward!

@shankari
Copy link
Collaborator Author

While rolling the everest release forward to the one from September, we also need to roll the build-kit image forward.

The everest september release was tagged with a commit from Oct 25

October 25, 2024
Last sha: 9193226f386cb0cfc6cbf7f98809648e18ce8792

There does not appear to be a build-kit release on the same day (this is something we need to bring up).
I assume that we need to use a semvered (e.g. 1.x.x1) package instead of one with a random tag renovate-configure`

Looking at the options, we see:
Screenshot 2024-11-12 at 10 04 00 AM

which is clearly too old

more recently, we have
Screenshot 2024-11-12 at 10 05 27 AM
Screenshot 2024-11-12 at 10 06 00 AM
Screenshot 2024-11-12 at 10 06 41 AM

All of them seem to have been generated on the same day (oct 30), 1.4.2 is marked as latest and has the most downloads, so let's use it.
https://github.com/EVerest/everest-ci/releases/tag/v1.4.2

Note that the build-kit release is after the everest release, if this is an issue, we can roll back to the last stable release, which appears to be 1.3.3

@shankari
Copy link
Collaborator Author

Pulled the release and built it manually to figure out how to change the Dockerfile

  • docker pull ghcr.io/everest/build-kit-alpine:v1.4.2
  • docker run -it <image> /bin/bash
Note that trying to run the image directly kept running into issues with the format?!
$ docker run -it --entrypoint /bin/bash ghcr.io/everest/[email protected]
docker: invalid reference format.
See 'docker run --help'.
$ docker run -it ghcr.io/everest/[email protected] -d
docker: invalid reference format.
See 'docker run --help'.
$ docker run -it ghcr.io/everest/[email protected]
docker: invalid reference format.
See 'docker run --help'.
$ docker run ghcr.io/everest/[email protected] -d
docker: invalid reference format.
See 'docker run --help'.
$ docker run ghcr.io/everest/[email protected]
docker: invalid reference format.
See 'docker run --help'.
  • Performed all the build steps in the Dockerfile
  • Now checking the custom overrides to see what has changed and whether it is significant.
  • dist/share/everest/modules/OCPP/config-docker.json: this has some changes, but I don't think we need to use it since we don't support 1.6 any more
  • dist/share/everest/modules/OCPP201/config.json: this is not created any more so does not need to be copied over. We do need to figure out what the changes were here and where they have moved to now.
# ls dist/share/everest/modules/OCPP201/
component_config         core_migrations          device_model_migrations  logging.ini

@shankari
Copy link
Collaborator Author

The final step is to upload the test script so that we can run it.
Running the automated test script fails because everest.framework

/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
===================================================== test session starts =====================================================
platform linux -- Python 3.10.15, pytest-8.3.3, pluggy-1.5.0
rootdir: /ext/source/tests
configfile: pytest.ini
plugins: asyncio-0.24.0
asyncio: mode=strict, default_loop_scope=None
collected 0 items / 1 error                                                                                                   

=========================================================== ERRORS ============================================================
________________________________________ ERROR collecting core_tests/startup_tests.py _________________________________________
ImportError while importing test module '/ext/source/tests/core_tests/startup_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
core_tests/startup_tests.py:12: in <module>
    from everest.testing.core_utils.fixtures import *
/usr/lib/python3.10/site-packages/everest/testing/core_utils/fixtures.py:12: in <module>
    from ._configuration.everest_environment_setup import \
/usr/lib/python3.10/site-packages/everest/testing/core_utils/_configuration/everest_environment_setup.py:14: in <module>
    from everest.testing.core_utils.everest_core import EverestCore, Requirement
/usr/lib/python3.10/site-packages/everest/testing/core_utils/everest_core.py:19: in <module>
    from everest.framework import RuntimeSession
E   ModuleNotFoundError: No module named 'everest.framework'
=================================================== short test summary info ===================================================
ERROR core_tests/startup_tests.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================== 1 error in 0.18s =======================================================

I double checked the docs, and the instructions are the same as the run_test.sh

cd ${SOURCE_DIR}/tests
pytest --everest-prefix ${INSTALL_PREFIX} core_tests/*.py framework_tests/*.py

Same error.

Searched to see where the framework is so that we can put it into the PYTHONPATH - could not find it

33b7d4f75906:/ext/source# find . -name \*framework.py\*
33b7d4f75906:/ext/source# find /usr/lib/python3.10/ -name \*framework.py\*
/usr/lib/python3.10/site-packages/pygments/lexers/robotframework.py
/usr/lib/python3.10/ctypes/macholib/framework.py

I do notice that the framework is used in the pyjosev code
https://github.com/EVerest/everest-core/blob/5e967358322fabd34e66a34f2919588df3ebb33f/modules/PyEvJosev/utilities.py#L6
or
https://github.com/EVerest/everest-core/blob/5e967358322fabd34e66a34f2919588df3ebb33f/modules/PyEvJosev/module.py#L8

and pyjosev does run, so we should be able to figure out where it is running from. But this is not required for the interactive demo, so let's ask a question in the zulip chat and move on.

@shankari
Copy link
Collaborator Author

@shankari
Copy link
Collaborator Author

For the record, the list of existing PYTHONPATH references is

./third-party/bazel/edm-wrapper.sh:export PYTHONPATH=$TARGET_PATH
./build/_deps/everest-framework-build/src/manager:PYTHONPATH
./build/_deps/everest-framework-build/src/CMakeFiles/manager.dir/manager.cpp.o:PYTHONPATH
 [ a bunch of files in the venv directory ]
./build/dist/bin/manager:PYTHONPATH

This makes me think that maybe the issue is that I have to activate a virtual environment, but it is not clear which one, and why it wasn't activated during build or while following the outlined instructions.

@shankari
Copy link
Collaborator Author

Returning to #78 (comment) and

dist/share/everest/modules/OCPP201/config.json: this is not created any more so does not need to be copied over. We do need to figure out what the changes were here and where they have moved to now.

Per @the-bay-kay and @catarial we should just edit the config directory, and that will be use to generate the device model when the manager is launched.

Verifying this by checking that the device model DB does not exist

# ls /ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
ls: /ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db: No such file or directory

Starting up the manager requires an MQTT server, so we install and run one on the manager

# apk install mosquitto
# mosquitto &
[1] 12562
33b7d4f75906:/ext/source# 1731460630: mosquitto version 2.0.15 starting
1731460630: Using default config.
1731460630: Starting in local only mode. Connections will only be possible from clients running on this machine.
1731460630: Create a configuration file which defines a listener to allow remote access.
1731460630: For more details see https://mosquitto.org/documentation/authentication-methods/
1731460630: Opening ipv4 listen socket on port 1883.
1731460630: Opening ipv6 listen socket on port 1883.
1731460630: mosquitto version 2.0.15 running

This now starts up everything

# /ext/source/build/run-scripts/run-sil-ocpp201.sh
...
2024-11-13 01:17:40.305161 [INFO] manager          ::   ________      __                _   
2024-11-13 01:17:40.305253 [INFO] manager          ::  |  ____\ \    / /               | |
2024-11-13 01:17:40.305391 [INFO] manager          ::  | |__   \ \  / /__ _ __ ___  ___| |_
2024-11-13 01:17:40.305419 [INFO] manager          ::  |  __|   \ \/ / _ \ '__/ _ \/ __| __|
2024-11-13 01:17:40.306071 [INFO] manager          ::  | |____   \  /  __/ | |  __/\__ \ |_
2024-11-13 01:17:40.306278 [INFO] manager          ::  |______|   \/ \___|_|  \___||___/\__|
2024-11-13 01:17:40.306317 [INFO] manager          :: 
2024-11-13 01:17:40.306389 [INFO] manager          :: everest-framework 0.17.2 @v0.17.2
2024-11-13 01:17:40.306421 [INFO] manager          :: everest-core 2024.9.0 @2024.9.0
2024-11-13 01:17:40.306507 [INFO] manager          :: 
2024-11-13 01:17:40.306539 [INFO] manager          :: Using MQTT broker localhost:1883
2024-11-13 01:17:40.357532 [INFO] everest_ctrl     :: Launching controller service on port 8849
2024-11-13 01:17:40.405279 [INFO] manager          :: Loading config file at: /ext/source/config/config-sil-ocpp201.yaml
2024-11-13 01:17:41.074668 [INFO] manager          :: Config loading completed in 725ms
...
2024-11-13 01:17:45.411420 [INFO] error_history:E  :: Resetting database
1731460665: New connection from ::1:50510 on port 1883.
1731460665: New connection from ::1:50518 on port 1883.
...
2024-11-13 01:17:51.333637 [INFO] manager          :: 🚙🚙🚙 All modules are initialized. EVerest up and running [11033ms] 🚙🚙🚙

2024-11-13 01:17:51.352417 [INFO] iso15118_charge  :: TCP server on eth0 is listening on port [fe80::42:acff:fe11:2%122]:61341

2024-11-13 01:17:51.353179 [INFO] iso15118_charge  :: TLS server on eth0 is listening on port [fe80::42:acff:fe11:2%122]:64109

2024-11-13 01:17:51.496545 [INFO] ocpp:OCPP201     :: Established connection to database: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"
2024-11-13 01:17:51.506374 [INFO] ocpp:OCPP201     :: Target version: 1, current version: 0

2024-11-13 01:17:51.511952 [INFO] iso15118_charge  :: SDP socket setup succeeded
2024-11-13 01:17:51.512929 [INFO] ocpp:OCPP201     :: Migration files to apply:
2024-11-13 01:17:51.513047 [INFO] ocpp:OCPP201     :: Migration file [up] version 1, path: /ext/source/build/dist/share/everest/modules/OCPP201/device_model_migrations/1_up-initial.sql
2024-11-13 01:17:51.527992 [INFO] ocpp:OCPP201     :: Successfully closed database: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"
2024-11-13 01:17:51.528198 [INFO] ocpp:OCPP201     :: Established connection to database: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"
2024-11-13 01:17:51.607005 [INFO] ocpp:OCPP201     :: Successfully closed database: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"
2024-11-13 01:17:51.607144 [INFO] ocpp:OCPP201     :: Database file "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db" is already closed
2024-11-13 01:17:51.607354 [INFO] ocpp:OCPP201     :: Established connection to database: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"
2024-11-13 01:17:51.607441 [INFO] ocpp:OCPP201     :: Established connection to device model database successfully: "/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db"

2024-11-13 01:17:51.629857 [INFO] ocpp:OCPP201     :: Successfully retrieved Device Model from DeviceModelStorage

And after killing the entry, we do see the database

# ls /ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db

So we can change the config (if required) in the demo scripts and create the database that way.

@shankari
Copy link
Collaborator Author

shankari commented Nov 13, 2024

Error while building in the CI/CD

#0 building with "builder-dde454bd-d070-48d9-92a0-7b09810cb1df" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 849B done
#1 WARN: FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/x86_64" (line 1)
#1 DONE 0.0s

#2 [internal] load metadata for ghcr.io/everest/build-kit-alpine:1.4.2
#2 ERROR: ghcr.io/everest/build-kit-alpine:1.4.2: not found
------
 > [internal] load metadata for ghcr.io/everest/build-kit-alpine:1.4.2:
------

 1 warning found (use docker --debug to expand):
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/x86_64" (line 1)
Dockerfile:1
--------------------
   1 | >>> FROM --platform=linux/x86_64 ghcr.io/everest/build-kit-alpine:1.4.2
   2 |     
   3 |     ARG EVEREST_VERSION=2024.9.0
--------------------
ERROR: failed to solve: ghcr.io/everest/build-kit-alpine:1.4.2: failed to resolve source metadata for ghcr.io/everest/build-kit-alpine:1.4.2: ghcr.io/everest/build-kit-alpine:1.4.2: not found
Reference
Check build summary support
Error: buildx failed with: ERROR: failed to solve: ghcr.io/everest/build-kit-alpine:1.4.2: failed to resolve source metadata for ghcr.io/everest/build-kit-alpine:1.4.2: ghcr.io/everest/build-kit-alpine:1.4.2: not found

But the 1.4.2 version is clearly present
https://github.com/EVerest/everest-ci/pkgs/container/build-kit-alpine/297600528?tag=v1.4.2

I wonder if it is the x86 versus arm that is the problem.

Bingo! Screenshot 2024-11-12 at 5 45 53 PM

Note also that while using this image, we get the error

---------------------------------------------
WARNING
This docker image is depreacted.
Please use the debian based build-kit 'ghcr.io/everest/everest-ci/build-kit-base' instead.
Fore more information see https://github.com/EVerest/everest-ci/pull/22
---------------------------------------------

@shankari
Copy link
Collaborator Author

Ok, so I can confirm that I get the same error while trying to build locally even when I am on an x86 mac

 > [manager internal] load metadata for ghcr.io/everest/build-kit-alpine:1.4.2:
------
failed to solve: ghcr.io/everest/build-kit-alpine:1.4.2: failed to resolve source metadata for ghcr.io/everest/build-kit-alpine:1.4.2: ghcr.io/everest/build-kit-alpine:1.4.2: not found

Removing the --platform=linux/x86_64 still fails, but removing the version number and using "latest" (=> [manager 1/4] FROM ghcr.io/everest/build-kit-alpine:latest@sha256:273c75b2986435daa5b49cd8eea736e0a75b2d0f03955a815a 0.2s) allows it to work.

But the SHA of the latest is the same as the SHA for 1.4.2
Screenshot 2024-11-12 at 6 01 34 PM

I guess it pulls the "unknown" image above.

Inspecting the image, we get

$ docker inspect e4a2478d4d54
    {
        "Id": "sha256:e4a2478d4d545b461ab2242bc9988e2ed539d67905196a11dbc348dd8c387a6b",
        "RepoTags": [
            "ghcr.io/everest/build-kit-alpine:v1.4.2"
        ],
        "RepoDigests": [
            "ghcr.io/everest/build-kit-alpine@sha256:273c75b2986435daa5b49cd8eea736e0a75b2d0f03955a815a6cd9ee9258a91d"
        ],
....
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 1443479769,

But I am still able to run it on my x86

$ docker run -it e4a2478d4d54 /bin/bash
---------------------------------------------
WARNING
This docker image is depreacted.
Please use the debian based build-kit 'ghcr.io/everest/everest-ci/build-kit-base' instead.
Fore more information see https://github.com/EVerest/everest-ci/pull/22
---------------------------------------------

d352e4885032:/workspace# 

Ah, it looks like amd64 and x86_64 are compatible (jeez, it has been a really long time since I had to look at processor architectures and instruction sets!) - I now have to use wikipedia and don't know this stuff cold
https://en.wikipedia.org/wiki/X86-64 ( x64, x86_64, AMD64, and Intel 64)

So:

  • It looks like the architecture used to be called x86_64
  • was added in b0dfa4d to reduce the size of the image
  • then the architecture name changed to arm64 (but it is still compatible)

So we can just remove the image architecture. But this doesn't solve our arm problems (at least not yet).

@shankari
Copy link
Collaborator Author

build-kit-base has the same version https://github.com/orgs/EVerest/packages/container/everest-ci%2Fbuild-kit-base/297603441?tag=v1.4.2 and significantly more downloads (it looks like most people have switched over). Let's switch over as well now and fall back to the alpine version if we run into issues.

shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 13, 2024
Since the architecture name has now changed to `amd64`
instead of `x64_64`.

This partially reverts
EVerest@b0dfa4d

Additional details at:
EVerest#78 (comment)

Testing done:
- Before this change `docker compose -f docker-compose.build.yml build` errors out
- After this change `docker compose -f docker-compose.build.yml build` does not error out at the same step

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

Fixed this, but then running out of disk space while building...

ERROR: failed to solve: rpc error: code = Unknown desc = write /ext/source/build/modules/CMakeFiles/YetiDriver.dir/__/generated/modules/YetiDriver/ld-ev.cpp.o: no space left on device
Reference
Check build summary support
Error: buildx failed with: ERROR: failed to solve: rpc error: code = Unknown desc = write /ext/source/build/modules/CMakeFiles/YetiDriver.dir/__/generated/modules/YetiDriver/ld-ev.cpp.o: no space left on device

This is going to be super complicated to fix since we can't really control the everest build or the space available on the github action workers, so I am going to just build locally and push.

shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 13, 2024
Since the architecture name has now changed to `amd64`
instead of `x64_64`.

This partially reverts
EVerest@b0dfa4d

Additional details at:
EVerest#78 (comment)

Testing done:
- Before this change `docker compose -f docker-compose.build.yml build` errors out
- After this change `docker compose -f docker-compose.build.yml build` does not error out at the same step

Signed-off-by: Shankari <[email protected]>
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 13, 2024
Since the architecture name has now changed to `amd64`
instead of `x64_64`.

This partially reverts
EVerest@b0dfa4d

Additional details at:
EVerest#78 (comment)

Testing done:
- Before this change `docker compose -f docker-compose.build.yml build` errors out
- After this change `docker compose -f docker-compose.build.yml build` does not error out at the same step

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

shankari commented Nov 13, 2024

Building locally, we get an SSL error
145.7 DIR /ext/source/build/_deps/libwebsockets-build CMP /ext/cache/cpm/libwebsockets/3866e4bc96015c77bf61889acd9dd6f4642df6fe/libwebsockets/cmake
145.9 -- CPM: everest-framework: adding package [email protected] (v3.11.2 to /ext/cache/cpm/nlohmann_json/b3708972f6694fe462e4112e47aa04f10d2390b4/nlohmann_json)
256.1 [ 11%] Creating directories for 'nlohmann_json-populate'
256.1 [ 22%] Performing download step (git clone) for 'nlohmann_json-populate'
256.1 Cloning into 'nlohmann_json'...
256.1 error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
256.1 error: 1073 bytes of body are still expected
256.1 fetch-pack: unexpected disconnect while reading sideband packet
256.1 fatal: early EOF
256.1 fatal: fetch-pack: invalid index-pack output
256.1 Cloning into 'nlohmann_json'...
256.1 error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
256.1 error: 1629 bytes of body are still expected
256.1 fetch-pack: unexpected disconnect while reading sideband packet
256.1 fatal: early EOF
256.1 fatal: fetch-pack: invalid index-pack output
256.1 Cloning into 'nlohmann_json'...
256.1 error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
256.1 error: 408 bytes of body are still expected
256.1 fetch-pack: unexpected disconnect while reading sideband packet
256.1 fatal: early EOF
256.1 fatal: fetch-pack: invalid index-pack output
256.1 -- Had to git clone more than once: 3 times.
256.1 CMake Error at /ext/source/build/_deps/nlohmann_json-subbuild/nlohmann_json-populate-prefix/tmp/nlohmann_json-populate-gitclone.cmake:39 (message):
256.1   Failed to clone repository: 'https://github.com/nlohmann/json'
256.1 
256.1 
256.1 make[2]: *** [CMakeFiles/nlohmann_json-populate.dir/build.make:102: nlohmann_json-populate-prefix/src/nlohmann_json-populate-stamp/nlohmann_json-populate-download] Error 1
256.1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/nlohmann_json-populate.dir/all] Error 2
256.1 make: *** [Makefile:91: all] Error 2
256.1 
256.1 CMake Error at /usr/share/cmake/Modules/FetchContent.cmake:1604 (message):
256.1   Build step for nlohmann_json failed: 2
256.1 Call Stack (most recent call first):
256.1   /usr/share/cmake/Modules/FetchContent.cmake:1744:EVAL:2 (__FetchContent_directPopulate)
256.1   /usr/share/cmake/Modules/FetchContent.cmake:1744 (cmake_language)
256.1   /usr/lib/cmake/everest-cmake/3rd_party/CPM.cmake:885 (FetchContent_Populate)
256.1   /usr/lib/cmake/everest-cmake/3rd_party/CPM.cmake:685 (cpm_fetch_package)
256.1   build/_deps/everest-framework-build/dependencies.cmake:30 (CPMAddPackage)
256.1   /usr/lib/cmake/everest-cmake/edm.cmake:31 (include)
256.1   /ext/cache/cpm/everest-framework/d01be681d203f70289900147e87a8f4c43ff47f0/everest-framework/CMakeLists.txt:58 (evc_setup_edm)
256.1 
256.1 
256.1 -- Configuring incomplete, errors occurred!
256.1 See also "/ext/source/build/CMakeFiles/CMakeOutput.log".
256.1 See also "/ext/source/build/CMakeFiles/CMakeError.log".
------
failed to solve: process "/bin/sh -c git clone https://github.com/EVerest/everest-core.git         && cd everest-core         && git checkout ${EVEREST_VERSION}         && cd ..         && mkdir -p /ext/scripts         && mv install.sh /ext/scripts/install.sh         && mv everest-core /ext/source         && /entrypoint.sh run-script install" did not complete successfully: exit code: 1

I then tried to run the image and ran into a similar issue - it looks like there are issues with SSL periodically.
In this case, I was able to restart the build. Committing it so we can start testing; will try to use ethernet to build multi-platform tomorrow.

Failed while building in running container too with an SSL error
[100%] Installing everestpy from distribution
Processing /ext/cache/cpm/everest-framework/d01be681d203f70289900147e87a8f4c43ff47f0/everest-framework/everestpy
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      ERROR: Could not find a version that satisfies the requirement setuptools>=42 (from versions: none)
      ERROR: No matching distribution found for setuptools>=42
      
      [notice] A new release of pip is available: 23.0.1 -> 24.3.1
      [notice] To update, run: python3.10 -m pip install --upgrade pip
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

@shankari
Copy link
Collaborator Author

Using the committed image, the basic AC charging demo works.
DC ISO 15118-2 fails with

manager-1      | 2024-11-13 07:22:15.911271 [ERRO] ev_manager:EvMa bool module::main::car_simulatorImpl::run_simulation_loop() :: Invalid number of arguments for: iso_start_v2g_session

And I haven't even tried the OCPP integration.
But now that the basic AC demo is working, let's push the changes, then switch to the recommended base image and then get the rest of it working one-by-one.

shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 13, 2024
Several of the options in the demo do not actually work

For example:
- Citrine fails to build (even on main)
- SP1 (and SP2) won't work with TLS
EVerest#78 (comment)

Fixes:
- Error out before Citrine build with a message indicating
  that it is not supported
- Patch the config for SP1 and SP2 to disable TLS

Testing done:

- Citrine

```
Cloning citrineos CSMS from https://github.com/citrineos/citrineos-core.git into /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms and starting it
Cloning into 'citrineos-csms'...
remote: Enumerating objects: 16467, done.
remote: Counting objects: 100% (303/303), done.
remote: Compressing objects: 100% (221/221), done.
remote: Total 16467 (delta 139), reused 161 (delta 70), pack-reused 16164 (from 1)
Receiving objects: 100% (16467/16467), 5.07 MiB | 969.00 KiB/s, done.
Resolving deltas: 100% (10346/10346), done.
/var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd
Copying certs into /var/folders/y5/cx3cfzrd2q116myv9ly86sw1rnlmdj/T/tmp.I8ClXLLd/citrineos-csms/Server/data/certificates
Validating that the certificates are set up correctly
Server/data/certificates/certChain.pem: OK
Chain:
depth=0: CN=host.docker.internal, O=EVerest, C=DE, DC=CPO (untrusted)
depth=1: CN=CPOSubCA2, O=EVerest, C=DE, DC=V2G (untrusted)
depth=2: CN=CPOSubCA1, O=EVerest, C=DE, DC=V2G (untrusted)
depth=3: CN=V2GRootCA, O=EVerest, C=DE, DC=V2G
No patches to apply
Build and run
CitrineOS does not currently build due to issues with npm dependencies. It is disabled until we roll forward. Apologies for the inconvenience!

```

- Maeve

```
                                             Successfully copied 84.5kB to everest-ac-demo-manager-1:/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
                                             Successfully copied 3.07kB to everest-ac-demo-manager-1:/tmp/
/ext/source /workspace
patching file config/config-sil-ocpp201-pnc.yaml
```

And then charging with EIM was successful

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

There is no option to turn off https in the go module (issue 27332 in https://github.com/golang/go).
I can figure out how to add it to the CI, but for now, I plan to just save the image after turning off the containerd store and restoring it to make progress.

@shankari
Copy link
Collaborator Author

build is still too large to fit in Github actions, so I will need to build and push. Even more argument for just saving + load to make progress.


#2 [internal] load metadata for ghcr.io/everest/everest-ci/build-kit-base:v1.4.2
#2 DONE 0.9s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [internal] load build context
#4 DONE 0.0s

#5 [1/3] FROM ghcr.io/everest/everest-ci/build-kit-base:v1.4.2@sha256:8b2caf2baafb843244680b1de5ebaf745d09d81e20079e99e9707d5a3165b2ee
#5 resolve ghcr.io/everest/everest-ci/build-kit-base:v1.4.2@sha256:8b2caf2baafb843244680b1de5ebaf745d09d81e20079e99e9707d5a3165b2ee done
#5 DONE 0.0s


#10 loading layer 7b98422d8569 4.79kB / 4.79kB 20.6s done
#10 loading layer c43cb7699bfd 108.07MB / 127.77MB 20.6s done
#10 loading layer 3d1f8d91b65a 388B / 388B 12.1s done
#10 loading layer 325a5bb3367f 131.07kB / 11.11MB 12.1s done
#10 loading layer 81202e26e552 32.77kB / 1.50MB 11.8s done
#10 loading layer 7695c6b1d2b7 24.67kB / 24.67kB 11.8s done
#10 loading layer d21295d7d6fd 448B / 448B 11.8s done
#10 loading layer 16313a1b9b23 158B / 158B 11.8s done
#10 loading layer 45d619634592 99B / 99B 11.8s done
#10 ERROR: write /ext/build/_deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/profile.cpp.gcno: no space left on device

#9 exporting to docker image format
#9 sending tarball 58.0s done
#9 ERROR: rpc error: code = Unknown desc = write /ext/build/_deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/profile.cpp.gcno: no space left on device
------
 > exporting to docker image format:
------
------
 > importing to docker:
------
ERROR: failed to solve: rpc error: code = Unknown desc = write /ext/build/_deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/profile.cpp.gcno: no space left on device
Reference
Check build summary support
Error: buildx failed with: ERROR: failed to solve: rpc error: code = Unknown desc = write /ext/build/_deps/libocpp-build/lib/CMakeFiles/ocpp.dir/ocpp/v16/profile.cpp.gcno: no space left on device

@shankari
Copy link
Collaborator Author

Switched back to the old container store, and I don't see any images. So it must have been building every time. I am not sure how it was building until yesterday and is not building today - unless it is some issue with netskope. But regardless, I cannot build now, and I can't figure out how to get the netskope root CA to install in the container.

@shankari
Copy link
Collaborator Author

Ok so now I have a couple of options:

  • install the root CA in the maeve container - this will work for now, but is not a long-term solution
  • change the script so that it uses a pre-built image, but this will be complex to restructure
    • image can be built using either the CI or a personal linux machine and pushed
  • we can just remove the go mod download. it looks like that is a performance optimization; go get will also pull the modules if needed. And at least go get does support --insecure (https://stackoverflow.com/questions/66356034/what-is-the-difference-between-go-get-command-and-go-mod-download-command). That may be the way to go for now.

Let's pull and edit the Dockerfile and then try to build locally.

@shankari
Copy link
Collaborator Author

shankari commented Nov 14, 2024

Trying to use the --insecure flag, we get

 > [manager builder 7/8] RUN go get --insecure ./...:                                                                          
0.168 go: -insecure flag is no longer supported; use GOINSECURE instead                                                        

Trying to use GOINSECURE does not work

/src # GOINSECURE=proxy.golang.org
/src # export GOINSECURE=proxy.golang.org
/src # go get https://proxy.golang.org/cloud.google.com/go/@v/v0.111.0.mod
go: cloud.google.com/[email protected]: Get "https://proxy.golang.org/cloud.google.com/go/@v/v0.111.0.mod": tls: failed to verify certificate: x509: certificate signed by unknown authority

I poke around by launching the base image and then trying to run commands directly in it

$ docker run -it golang:1.20-alpine /bin/sh

Just to clarify, the issue is that the alpine image only has a single root CA, which is the one from netskope. The problem is that netskope doesn't seem to support the letsencrypt root CA

So

echo | openssl s_client -showcerts -servername k8s.io -connect k8s.io:443 2>/dev/null | openssl x509 -inform pem -noout 
-text
/src # echo | openssl s_client -showcerts -servername k8s.io -connect k8s.io:443 2>/dev/null | openssl x509 -inform pem -noout 
-text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            80:ba:10:02:09:78:44:07:96:6a:7e:f2:c6:d1:2c:75
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = US, ST = Colorado, L = Golden, O = National Renewable Energy Laboratory, OU = Information Technology Services, CN = netskope.nrel.gov
        Validity
            Not Before: Oct 15 06:15:04 2024 GMT
            Not After : Nov 14 06:15:04 2025 GMT
        Subject: CN = k8s.io

So we can access non letencrypt locations

# curl https://github.com | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0






<!DOCTYPE html>
<html
  lang="en"
100  5471    0  5471    0     0  16539      0 --:--:-- --:--:-- --:--:-- 16578

or

/src # curl https://google.com | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   220  100   220    0   <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
 <TITLE>301 Moved</TITLE></HEAD><BODY>
 <H1>301 Moved</H1>
0The document has moved
 <A HREF="https://www.google.com/">here</A>.
 </BODY></HTML>
  663      0 --:--:-- --:--:-- --:--:--   664

or

/src # curl https://alpinelinux.org | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8907  100<!DOCTYPE html> 0      0      0 --:--:-- --:--:-- --:--:--     0
 <html lang="en">
     <head>
8        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9        <meta name="viewport" content="width=device-width, initial-scale=1.0">
0        <meta name="description" content="Alpine Linux">
7        <title>index | Alpine Linux</title>
 
         <link rel="stylesheet" href="/css/pure-min.css" />
         <link rel="stylesheet" href="/css/grids-responsive-min.css" />
 0     0  15853      0 --:--:-- --:--:-- --:--:-- 15848

but anything with letsencrypt fails

/src # curl https://letencrypt.com
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

If we can install the letsencrypt root CA and chain into the image, we should be fine.

@shankari
Copy link
Collaborator Author

ok, so I got the letsencrypt root cert and installed it, and it was apparently already there.
The installed root certs are being ignored.

/src # update-ca-certificates
WARNING: Skipping duplicate certificate in file ca-cert-ISRG_Root_X1.pem

@shankari
Copy link
Collaborator Author

Tried to switch to a debian build instead of alpine. same error

 => [manager builder 4/8] RUN if [ "amd64" = "arm64" ]; then         TARGETARCH=aarch64 ;         fi;     wget -O /usr/  10.1s
 => [manager builder 5/8] COPY ./go.mod ./go.sum ./                                                                       0.0s
 => ERROR [manager builder 6/8] RUN go mod download                                                                       2.2s
------                                                                                                                         
 > [manager builder 6/8] RUN go mod download:                                                                                  
2.169 go: cloud.google.com/[email protected]: Get "https://proxy.golang.org/cloud.google.com/go/@v/v0.111.0.mod": tls: failed to verify certificate: x509: certificate signed by unknown authority                                                                  
------
failed to solve: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1

I tried both bookworm and bullseye. No luck.

@shankari
Copy link
Collaborator Author

In the argument for not including the insecure flag, the golang commenters say:

If you can't set up a verifiable TLS cert chain, you should be using a non-HTTPS URL, to make it clear that this is not a secure connection.

But the automatic redirect to TLS defeats that

/src # go get http://proxy.golang.org/cloud.google.com/go/@v/v0.111.0.mod
go: cloud.google.com/[email protected]: Get "https://proxy.golang.org/cloud.google.com/go/@v/v0.111.0.mod": tls: failed to verify certificate: x509: certificate signed by unknown authority

@shankari
Copy link
Collaborator Author

shankari commented Nov 14, 2024

Tried to build with docker-compose and push, but the push is running into issues.

#34 DONE 0.1s
#35 [gateway] exporting to image
#35 exporting layers
#35 exporting layers 0.4s done
#35 writing image sha256:b080665af6f94968233aec8ec952b0c6c424576e2a271c42b5e9479e6fced0d7 done
#35 naming to docker.io/library/maeve-csms-gateway done
#35 DONE 0.4s

maeve-csms-gateway   latest      b080665af6f9   1 second ago     26.7MB
maeve-csms-manager   latest      f26bc6871258   12 seconds ago   39.5MB

maeve-csms-gateway                                latest      b080665af6f9   1 second ago     26.7MB
ghcr.io/everest/everest-demo/maeve-csms-gateway   0.0.16      b080665af6f9   1 second ago     26.7MB
maeve-csms-manager                                latest      f26bc6871258   12 seconds ago   39.5MB
ghcr.io/everest/everest-demo/maeve-csms-manager   0.0.16      f26bc6871258   12 seconds ago   39.5MB
moby/buildkit                                     latest      c6936aa67ee2   2 weeks ago      203MB

The push refers to repository [ghcr.io/everest/everest-demo/maeve-csms-gateway]

8fa10c0194df: Waiting
03af25190641: Waiting
denied: permission_denied: The requested installation does not exist.
Error: Process completed with exit code 1.

This seems to be because we don't have a package listed
Screenshot 2024-11-14 at 9 58 27 AM

Switching to the build-and-push action at least initially since it looks like it creates it properly.
Will have to hardcode for now though.

@shankari
Copy link
Collaborator Author

shankari commented Nov 14, 2024

Switching worked, we now have the new images but they are still not pushing

 > exporting to image:
------
ERROR: failed to solve: failed to push ghcr.io/everest/everest-demo/gateway:0.0.16: unexpected status from POST request to https://ghcr.io/v2/everest/everest-demo/gateway/blobs/uploads/: 403 Forbidden

docker/build-push-action#463

Apparently, this is an intermittent error. Trying again after a bit....

@shankari
Copy link
Collaborator Author

Ah no it is because we are testing this in US-JOET. Let's temporarily switch to the US-JOET namespace...
Doh!

@shankari
Copy link
Collaborator Author

And now the push works

  Process "buildx dial-stdio" was killed with signal SIGKILL
  Beginning upload of artifact content to blob storage
  Uploaded bytes 61599
  Finished uploading artifact content to blob storage!
  SHA256 hash of uploaded artifact is ded295fe8492880639e6e460842fe581db9b7cafc6274971fac35967d851a384
  Finalizing artifact upload
  Artifact successfully finalized (2189482814)
  Artifact download URL: https://github.com/US-JOET/everest-demo/actions/runs/11843846643/artifacts/2189482814
  Writing summary

It would have likely worked with the old version where we used docker-compose as well, but let's take the win and move on for now.
#78 (comment)

@shankari
Copy link
Collaborator Author

During cleanup, we could also build from docker-compose and then push using https://github.com/akhilerm/tag-push-action

shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 14, 2024
* 👷Initial workflow to checkout and build the CSMS

This can definitely be polished, but it works now so can unblock 
EVerest#78

Changes:
- Add a new workflow
- Configure it with a hardcoded set of images to build for maeve
- Apply compile-time patches
- Build and push, similar to the original `cicd` workflow

----- full list of changes -----

* Build on pull requests to upgrade branches as well

* Handle the two directories correctly

Need to explicitly `cd` into `everest-demo`
And apply patches from there

* Fix repo format

* Fix checked out directory format

* Again change directory properly before building

* Now that build works, re-tag and push

* Fix invalid workflow format

* Really fix the format

* read the env properly (from within the demo)

* Login before pushing

* Switch to the build-push-action so that push to packages works

EVerest#78 (comment)

* Actually push the values

* Give more permissions to the token

To be consistent with
https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions

* Change the permission to "admin"

So that we can really really push?!

* Temporarily switch to US-JOET so we can verify that it works

* Split the maeve patches into compile time and runtime

And apply only the compile time patch while building the image
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 14, 2024
* 👷Initial workflow to checkout and build the CSMS

This can definitely be polished, but it works now so can unblock
EVerest#78

Changes:
- Add a new workflow
- Configure it with a hardcoded set of images to build for maeve
- Apply compile-time patches
- Build and push, similar to the original `cicd` workflow

----- full list of changes -----

* Build on pull requests to upgrade branches as well

* Handle the two directories correctly

Need to explicitly `cd` into `everest-demo`
And apply patches from there

* Fix repo format

* Fix checked out directory format

* Again change directory properly before building

* Now that build works, re-tag and push

* Fix invalid workflow format

* Really fix the format

* read the env properly (from within the demo)

* Login before pushing

* Switch to the build-push-action so that push to packages works

EVerest#78 (comment)

* Actually push the values

* Give more permissions to the token

To be consistent with
https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions

* Change the permission to "admin"

So that we can really really push?!

* Temporarily switch to US-JOET so we can verify that it works

* Split the maeve patches into compile time and runtime

And apply only the compile time patch while building the image

Signed-off-by: Shankari <[email protected]>
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 14, 2024
Since it is not working anyway due to lack of disk space
EVerest#78 (comment)

Signed-off-by: Shankari <[email protected]>
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 14, 2024
Since it is not working anyway due to lack of disk space
EVerest#78 (comment)

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

At long last, the build werks ❗❗❗

Now to go ahead and run

$ bash demo-iso15118-2-ocpp-201.sh -r $(pwd) -1 -m

 ✔ Network maeve-csms                Created                                                                              0.1s 
 ✔ Container maeve-csms-mqtt-1       Healthy                                                                              0.2s 
 ✔ Container maeve-csms-firestore-1  Healthy                                                                              0.2s 
 ✔ Container maeve-csms-manager-1    Healthy                                                                              0.2s 
 ✔ Container maeve-csms-gateway-1    Healthy                                                                              0.1s 


 ✔ Network everest-ac-demo_default          Created                                                                       0.0s 
 ✔ Container everest-ac-demo-mqtt-server-1  Healthy                                                                       0.1s 
 ✔ Container everest-ac-demo-nodered-1      Healthy                                                                       0.2s 
 ✔ Container everest-ac-demo-manager-1      Healthy                                                                       0.1s 


2024-11-14 21:28:46.844762 [INFO] manager          ::   ________      __                _   
2024-11-14 21:28:46.845188 [INFO] manager          ::  |  ____\ \    / /               | |
2024-11-14 21:28:46.845257 [INFO] manager          ::  | |__   \ \  / /__ _ __ ___  ___| |_
2024-11-14 21:28:46.845568 [INFO] manager          ::  |  __|   \ \/ / _ \ '__/ _ \/ __| __|
2024-11-14 21:28:46.845723 [INFO] manager          ::  | |____   \  /  __/ | |  __/\__ \ |_
2024-11-14 21:28:46.845788 [INFO] manager          ::  |______|   \/ \___|_|  \___||___/\__|
2024-11-14 21:28:46.845820 [INFO] manager          :: 
2024-11-14 21:28:46.845968 [INFO] manager          :: everest-framework 0.17.2 @v0.17.2
2024-11-14 21:28:46.846116 [INFO] manager          :: everest-core 2024.9.0 @2024.9.0
2024-11-14 21:28:46.846261 [INFO] manager          :: 
2024-11-14 21:28:46.846467 [INFO] manager          :: Using MQTT broker mqtt-server:1883
2024-11-14 21:28:47.298496 [INFO] everest_ctrl     :: Launching controller service on port 8849
2024-11-14 21:28:47.358023 [INFO] manager          :: Loading config file at: /ext/source/config/config-sil-ocpp201-pnc.yaml

Runs!! But then immediately crashes with

/ext/cache/cpm/everest-framework/d01be681d203f70289900147e87a8f4c43ff47f0/everest-framework/lib/config.cpp(262): Throw in function void Everest::Config::load_and_validate_manifest(const std::string&, const Everest::json&)
Dynamic exception type: boost::wrapexcept<Everest::EverestConfigError>
std::exception::what: Failed to load and parse manifest file /ext/dist/libexec/everest/modules/JsCarSimulator/manifest.yaml: File 'manifest.(yaml|json)' does not exist
[boost::log::v2_mt_posix::current_scope_info_tag*] = Everest::Config::Config(std::shared_ptr<Everest::RuntimeSettings>, bool)

Time to start tweaking the config - fortunately, @the-bay-kay has gone through this and figured it out (mostly!)

@shankari
Copy link
Collaborator Author

After changing a bunch of config, EVerest started up and was able to finish a charge session with -1

  • /ext/source/config/config-sil-ocpp201-pnc.yaml
  • /ext/dist/share/everest/modules/OCPP201/component_config/standardized/InternalCtrlr.json
  • /ext/dist/share/everest/modules/OCPP201/component_config/custom
  • the node-red UI
Screenshot 2024-11-14 at 2 17 37 PM

Now applying those changes and then I will merge the current open PR #83
Note that these are similar to the changes that @the-bay-kay already made, but cleaned up a bit; for example, instead of adding a connector to the config, we just remove the existing connector from the component_config so that they are compatible. Note that the uMWC has only one port.

@shankari
Copy link
Collaborator Author

Incorporated changes (with copious patches) into the current demo. This is the stock charging profile, without any departure time. Committed as b613ba6

@shankari
Copy link
Collaborator Author

Renamed the US-JOET images to

sdesk-35737s:everest-demo kshankar$ docker tag ghcr.io/us-joet/everest-demo/manager:0.0.16 ghcr.io/everest/everest-demo/maeve-manager:0.0.17-localbuild
sdesk-35737s:everest-demo kshankar$ docker tag ghcr.io/us-joet/everest-demo/gateway:0.0.16 ghcr.io/everest/everest-demo/maeve-gateway:0.0.17-localbuild

And changed the tag to 0.0.17-localbuild
SP1 works without any changes!!

Almost done with cleanup and about ready to merge.

shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 15, 2024
Now that the device model DB is overridden on startup,
we cannot configure the CSMS URL by copying over the database
any more (b613ba6,
EVerest#78 (comment)).

Instead we have to edit the `InternalCtrlr.json` file before the server starts up so that it is configured properly in the device model DB that is created at startup. We do this by using `sed` to replace `localhost` with the correct CSMS URL.

But the CSMS URL is different based on the the profile (SP1,
SP2, SP3) and the CSMS (Maeve vs CitrineOS).

So we make the following changes:
- remove all the DB override files since they are not
  relevant any more
- instead, define the SP and CSMS specific enviroment
  variables in the CSMS-specific apply-patches file
    - we may want to change this to a separate file later if
      there are other environment variables we want to
      specify
    - specifying this in CSMS-specific files means that we
      can easily support other CSMSes without modifying the
      demo file
- change the demo script to run separate sed commands that
  modify the `InternalCtrlr.json` with the correct URL for the service profile and CSMS

Signed-off-by: Shankari <[email protected]>
shankari added a commit to US-JOET/everest-demo that referenced this issue Nov 15, 2024
This is a partial fix for
EVerest#78

There is still much cleanup to be done, but I want to pivot
to the MIDAS integration right now

Signed-off-by: Shankari <[email protected]>
@shankari
Copy link
Collaborator Author

Now that I have merged #83
this is largely done so I am closing this.

I am now going to pivot to #79, so I will close this.

But for the record, other "nice to have" changes would be to:

@shankari
Copy link
Collaborator Author

@Abby-Wheelis, you should be able to test the AC, ISO 15118-2 DC and the ISO 15118 + OCPP 201 demos now.
@catarial needs to wait until #63 is done

@shankari shankari changed the title ⬆️ Upgrade to the latest everything ⬆️ Upgrade to the latest everest Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant