CS Manager
Backend in charge of handling API calls, GQL, and ACL logic related to CS. General flow of request is received from Gateway or directly from service (i.e. portal). There will be ACL middleware checks and if user has proper access on said charge station and action, the action will be carried out.
Dependencies
-
CS manager is not a standalone service and depends on different tables and services.
-
ACL Service - Used for middleware of user privileges
-
CS Database - Holds information for
-
Kafka - Messaging service used for issuing out requests
-
Consul - DNS, Service finder of some sort.
-
Depending on the testing you are doing you will you need other services. Gateway, consul, etcd, etc.
Building & Running
npm install
npm start
- Chances are low this will work out of the box. The is a useless bullet look below.
- If you come across issues during install they may be related to node version. You can use
nvm
to get around this.nvm use 10
or to set as defaultnvm alias default 10
andnode -v
to confirm. - You need to have the replica set populated properly (I think). You need to follow the steps below to run the DB locally and run
npm test
to properly set up the replica set. - If you do not have
config/local.coffee
copyconfig/local.coffee.sample
and rename.
Setting up dependencies
To simulate the environment on its own you need to set up the dependencies in Docker or to build and run dependencies from source.
-
To run ACL Service in Docker: ./path/to/script.sh
-
To run Kafka in docker: ./path/to/script.sh
-
For the Database, you will need to create a local instance and copy over database to local with a replica set. If you have mongo running already in Docker stop it firstly. Getting Mongo with replica set ./trust/the/script.sh. Run
npm test
to properly set uprs0
. Staging data can be connected tostaging-master:30106
and you will need to copy over the collections you need to local. If collections are namedstaging-xxx
change todevelopment-xxx
. Best to ask which collections are actually needed for work you will be doing to not copy over unnecessary collections (e.g. user/express logs).