-
Clone warehouse and any submodules
git clone --recursive [email protected]:ShoppinPal/warehouse.git -
Open project directory:
cd warehouse -
Setup project root directory as an environment variable:
export PROJECT_ROOT=`pwd` && echo $PROJECT_ROOT -
Setup the environment files
- run:
npm install inquirer --save-dev - then run the command
npm run generate-envornpm run generate-env -e=terraformfor generating tfvars file. - We need to generate this terraform.tfvars file so we can generate queues over SQS.
- Run these commands:
# Tested with Terraform v0.10.8 as of this commit. # step 1 cd $PROJECT_ROOT/terraform/ # step 2 docker-compose run terraform init # step 3: used to download and update modules mentioned in the root module (main.tf). docker-compose run terraform get # step 4 docker-compose run terraform plan # step 5 docker-compose run terraform apply # step 6: to destroy your infrastructure! docker-compose run terraform destroy-
Once terraform creates queues, the appropriate AWS_SQS_URL and AWS_SQS_REGION will be automatically added to your .env and worker.env files.
-
Then run the command
npm run generate-env -e=webfor generating.envfor warehouse web service- It will ask you for the environment variables to be configured.
- Once done, it will generate files for you as per the values you specified.
-
then run the command
npm run generate-env -e=workerfor generatingworker.envfor warehouse worker service. -
Then run the command
npm run generate-env -e=worker2for generatingworker2.envfor warehouse worker 2 service.
- run:
-
Fill in any remaining values that are empty in
.envandworker.envfiles -
Open file
/etc/hosts:sudo vim /etc/hosts-
Append the following line
127.0.0.1 lb
-
-
To build and run, choose:
- background:
docker-compose up -d --build - foreground:
docker-compose up --build
- background:
-
For local development, open application in your browser with url http://lb/