Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 2.15 KB

local.md

File metadata and controls

61 lines (46 loc) · 2.15 KB

Deploy

  1. Clone warehouse and any submodules

    git clone --recursive [email protected]:ShoppinPal/warehouse.git
    
  2. Open project directory: cd warehouse

  3. Setup project root directory as an environment variable:

    export PROJECT_ROOT=`pwd` && echo $PROJECT_ROOT
    
  4. Setup the environment files

    • run: npm install inquirer --save-dev
    • then run the command npm run generate-env or npm run generate-env -e=terraform for generating tfvars file.
    • We need to generate this terraform.tfvars file so we can generate queues over SQS.
    1. 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=web for generating .env for 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=worker for generating worker.env for warehouse worker service.

    • Then run the command npm run generate-env -e=worker2 for generating worker2.env for warehouse worker 2 service.

  5. Fill in any remaining values that are empty in .env and worker.env files

  6. Open file /etc/hosts: sudo vim /etc/hosts

    • Append the following line

      127.0.0.1 lb
      
  7. To build and run, choose:

    • background: docker-compose up -d --build
    • foreground: docker-compose up --build
  8. For local development, open application in your browser with url http://lb/