# Innovation Lab Local Setup Guide
## Tools You'll Need
- Terminal
- VS Code (Or preferred IDE)
## Install Innovation Lab Web
Clone repo: `git clone git@github.com:TISTATechnologies/innovation-lab-web.git`
- [ ] NPM
- [ ] Download Node [NPM](https://nodejs.dev/)
- [ ] Install Brew `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
- [ ] Install NVM via Brew
- [ ] `brew update`
- [ ] `brew install nvm`
- [ ] Next, create a directory for NVM in home. `mkdir ~/.nvm`
- [ ] Now, configure the required environment variables. Edit the following configuration file in your home directory `vim ~/.bash_profile`
- [ ] and, add below lines to ~/.bash_profile ( or ~/.zshrc for macOS Catalina or later)
```
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
```
- [ ] Next, load the variable to the current shell environment. From the next login, it will automatically loaded.
- [ ] `source ~/.bash_profile`
- [ ] Be sure to install NPM globally `npm install -g npm`
- [ ] Make sure your terminal is using Node Version 16.14.2
- [ ] Check Node Version: `node -v`
- [ ] If node version is different, set Node Version to 16.14.2: `nvm use 16.14.2`
- [ ] Open the `innovation-lab-web` directory folder and run `npm install` to install any packages used in the webapp
- [ ] AWS
- [ ] Install the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- [ ] Go to Security Credentials for your account and set up MFA.
- [ ] Create a new set of Security Credentials for your account (copy the Access Key ID (Account ID) and Secret Access Key (Account Secret) - *If you don't have an account or if you can't create and access key create JIRA Ticket and assign to whomever the AWS Admin is.*
- [ ] Run `aws configure` supplying the Account ID and Secret that you just created
- [ ] Use `us-east-1` as region name.
- [ ] Use `json` as format
- [ ] Running the Project
- [ ] Setup the environment and install dependencies
```
./setup.sh
```
*If there is an `AccessDeniedException` contact your AWS Admin to elevate your permissions.*
- [ ] Start the webpack development server
```
npm start
```
## Install Innovation Lab Persist
Clone repo: `git@github.com:TISTATechnologies/innovation-lab-persist.git`
- [ ] Setup
```
# Setup the environment
npm run setup
```
- [ ] Generate JWT
```
npm run test:auth -- -u <username> -p <password>
```
- [ ] Start the service
```
npm start
```
## Install Innovation Lab Builder
- [ ] Make sure you have at least v10 of NodeJS installed, to install for Mac OS, Windows, Ubuntu
- [ ] Check that you have python installed
```
pip3 -V
```
- [ ] Install credstash
```
pip3 install credstash
```
- [ ] Setup
```
# Setup the environment
npm run setup
```
- [ ] Start the service
```
npm start
```
## FAQ
### Web
### Persist
1. If you send a request to the server and receive a `JWT is expired` error
* `npm run test:auth -- -u <username> -p <password>`
* *Note: The username and password come from AWS Cognito*
2. See error below:
```
Starting docker container
ERROR: permission denied to create database
```
- First login to the PSQL Database `psql -d <database-name> -U <username> -W`
- Enter password. (If no password hit enter)
-
3. `Error: error:0308010C:digital envelope routines::unsupported`
- Make sure your terminal is using Node Version 16.14.2
- Check Node Version: `node -v`
- Set Node Version to 16.14.2: `nvm use 16.14.2`
### Builder
1. If you run `npm start` and get this error `MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017`
* Make sure your Docker container is up and running.
* `docker ps`
* *If no container is running run `make db`*