Skip to content

Hitachi-CTI-Call-For-Code-COVID-19-Team/delivery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delivery Tools for COVSAFE

Prerequisites

Before deploying this application, please create your IBM Cloud resource group environment. See here.

Also, our installation scripts require your APIKEY. See here.

Then, please clone our solution that consists of multiple repos in Hitachi CTI Call For Code COVID-19 Team. Here, we are under the assumption that you clone all repos within /path/to/COVSAFE.

In addition to above, please install python3, pipenv, node, and npm. Those are required for building and deploying our application.

Preparation

COVSAFE is sort of IoT application so that it requires sensors to gather data! You can take two ways:

  1. prepare sensors. Items below are supported as of now.
  1. use imaginary assets for an imaginary shopping mall

If you want to take the first option, please buy them and create configurations and logical assets for the real assets. please see the README for Asset and create asset and configuration files needed.

Instead of using the "read" assets and take the second option, if you want just to run our application with dummy data generated by a script (running on the IBM Cloud Functions periodically), you can skip to read the README for Asset and just run scripts shown below.

cd /path/to/COVSAFE/delivery

# do only when using c4c dummy generator
# generate assets for an imaginary shopping mall
cd ./data/tenants/c4c/tools
npm install && npm start
rm -rf node_modules package-lock.json

# create staff for an imaginary shopping mall
python3 create-assets-staff.py

How to deploy

  1. Do commands below and have a coffee break. It creates almost services that we use in IBM Cloud. Note that it's creating paid serivces, like Event Streams since it's not given in some regions at free.
export APIKEY=${YOUR_API_KEY}
cd /path/to/COVSAFE/delivery
cd scripts
pipenv install

# change some variables for your env, like resource group
# not frequent, but I got an error below sometimes when launching the Cloudant
# since IBM Cloud takes time for the Cloudant instance provisioning.
# just re-run the same command when getting the error after a while.
# "Error response from server. Status code: 400; description: 400 The resource instance is removed/invalid."
pipenv run python main.py -o create -p covsafe -t c4c -r jp-tok -g covid-19-dev -l standard
  1. Deploy Push Notifications

If you have MESH LED device and wish to try it with our applicatin, please follow the below instructions.

  1. Deploy Functions

See README of each repo to get known how to buid and deploy the functions. All functions require the Cloudant secret, and parts of them need either Cloud Object Storage or Event Streams secret. Please get those secret from /path/to/COVSAFE/delivery/scripts/.credentials created after you run main.py above.

  • data-proxy
    • assumes in /path/to/COVSAFE/data-proxy localy
    • required secrets
      • N/A (just use names of service credentials. so just follow the instraction without any copy and paste)
  • risk-calculator
    • assumes in /path/to/COVSAFE/risk-calculator localy
    • required secrets
      • CLOUDANT_WRITER_CREDENTIALS
      • CLOUDANT_READER_CREDENTIALS
  • risk-notifier
    • assumes in /path/to/COVSAFE/risk-notifier localy
    • required secrets
      • CLOUDANT_WRITER_CREDENTIALS
      • CLOUDANT_READER_CREDENTIALS
  • data-recorder
    • assumes in /path/to/COVSAFE/data-recorder localy
    • required secrets
      • EVENT_STREAMS_READER_CREDENTIALS
      • CLOUDANT_WRITER_CREDENTIALS
  1. Deploy covsafe-view

Go to covsafe-view or /path/to/COVSAFE/covsafe-view and see the README. For demonstration, it's recommended to take steps of "How To Build" > "Prod Mode" and "How to Deploy to IBM Cloud."

  1. Deploy mobile apps

If you have MESH LED device and wish to try it with our applicatin, please follow the instuctions shown in README of each repos below.

  1. Deploy edge devices

If you have sensors that our application support, named HLS-LFOM5 or HLS-LFOM1, and would like to try it with our application, please follow the instructions shown in README of a repo below.

  1. Check it

After your deployment of covsafe-view, covsafe-view URL should be shown with the keyword "Please access to:". Access to the URL with login credentials. If you don't change the default username and password, just use username: "user@fake.email" and password "password".

How to create dummy data

If you use the tenant "c4c", we prepare the dummy data generator of the sensors that are imagined to be placed at the imaginary shopping mall to have a fun without any physical sensors. If you would like to get it, kick these commands below.

export APIKEY=YOUR_API_KEY
cd /path/to/COVSAFE/delivery
cd scripts
# change some variables for your env, like resource group
pipenv run python function_dummy_generator.py -o create -r jp-tok -g covid-19-dev -n dummy-generator -p dummy-generator -a dummy-generator -t dummy-generator-trigger -u dummy-generator-rule -c ./.credentials

How to delete COVSAFE

# dploy covsafe solution
export APIKEY=YOUR_API_KEY
cd /path/to/COVSAFE/delivery
cd scripts
pipenv install

# change some variables for your env, like resource group
pipenv run python main.py -o delete -p covsafe -t c4c -r jp-tok -g covid-19-dev