This project was bootstrapped with Create React App.
- Create
.env
files in thefrontend
andbackend
folder and fill in information specified by corresponding.env.example
files - Create a file called
private.key
andpublic.key
with RSA Private and public keys in thebackend
folder. It will be used for the JWT token signing and verification respectively
- Start a local instance of mongodb on port
27017
cd
intobackend
folder, runnpm run dev
cd
intofrontend
folder, runnpm run dev
- Create a
.env
file at the project root folder and fill with enter values forMONGO_ROOT_USERNAME
andMONGO_ROOT_PASSWORD
. This will be used in docker-compose for creation of the mongodb admin user - Update mongodb credentials in
mongo-init.js
. This file contains the script to create a user that can read/write to the records database - At root folder, run
docker-compose up --build -d
Note: This doesn't work with Windows
- Install Node.js using the NodeSource repo
- Install Git
- Optional: Setup SSH
- Optional: Install Docker
- Before installing Docker, configure the lxd container first
- Install MongoDB (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/)
- Will need to first install WGET by running
sudo apt-get install wget
- To setup database:
- Run command
mongod
in container terminal - In separate terminal, run mongo shell with
mongo
- In shell, run
db.createUser({ user: {ADMIN_USERNAME}, pwd: {ADMIN_PWD}, roles: [{ role: "root", db: "admin" }] })
- Terminate mongodb process and exit mongo shell
- Start mongodb process again in the background with authentication enabled by running
mongod --auth --fork --logpath /var/log/mongod.log
- In separate terminal, run mongo shell again with
mongo
- In shell, run
use admin
to go to admin db - Run
db.auth({ADMIN_USERNAME}, {ADMIN_PWD})
to authenticate as admin user - Upon successful authentication, run
use records
to create database to store survey data - Run
db.createUser({ user: {RECORDS_USERNAME}, pwd: {RECORDS_PWD}, roles: [{ role: "readWrite", db: "records" }] })
to create a separate user to read and write to the records db
- Run command
- Will need to first install WGET by running
- Install the Nodejs process manager, PM2, by running
sudo npm install pm2 -g
, this is needed to manage/run project in background - Clone this repo and follow instructions to setup
.env
files in thefrontend
andbackend
folder - Install Python 2 and Pip if they are not yet installed in the container
- Install the pandas and xlrd library by running
pip install pandas
andpip install xlrd
. The two python libraries are required when executing the python script for parsing FNH and MCML fob data report. - Go into the
frontend
folder in repo and create a production build of the front-end by runningnpm run prod
- Go into the
backend
folder and runpm2 --name Covid-dashboard start npm – start
to start the project in the background - Tada! The app can now be accessed in the specified port in
.env