Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Setup Guide

Logan Van Hook edited this page Apr 20, 2020 · 19 revisions

Back End Setup Guide

  1. Clone BE repository and run yarn install --production=false to install all required dependencies (dev environment specified for @types)

  2. Create Docker PostgreSQL container.

    • Use docker pull postgres:12.1-alpine to download image.
      PostgreSQL Docker image - https://hub.docker.com/_/postgres
    • Run image using the following command:
      docker run --name ss-postgres --publish 5432:5432 postgres:12.1-alpine
      (12.1-alpine is the current version as of 3.12.20.
      It may be a different version now. Use the above link to check version and change run command as needed)
  3. Add the following environment variables in a .env file:

    PORT=4000
    SALT=10
    SECRET_SIGNATURE=Its a secret (example - create your own)
    STRIPE_API=STRIPE_KEY
    DATABASE_URL=postgresql://postgres:1234@localhost:5432/postgres
    GOOGLE_APPLICATION_CREDENTIALS='YOUR_GOOGLE_CLOUD_VISION_SERVICE_ACCOUNT_API_INFORMATION'
    
  4. Generate, and run, a migration file using the following command:

    • Note: with typeorm entities, do not generate migrations.
    • yarn typeorm-dev migration:run
  5. Install Python dependencies pipenv install
    This will convert the requirements.txt to Pipfile and Pipfile.lock, these should be in the .gitignore and should not be uploaded to Github.

  6. Start backend pipenv run yarn dev

Pipenv Issues

Getting Started with Python

Please follow this written tutorial to Install Python (latest version) pip and pipenv included - > https://github.com/LambdaSchool/CS-Wiki/wiki/Installing-Python-3-and-pipenv

After Installing Python open Powershell / your preferred terminal other than GitBash and ensure you receive a version response for the following commands:

  1. $ python3 --version OR python --version
    
  2. $ pipenv --version
    

    If you receive an error message for pipenv such as the one below you will need to follow the next set of numbered sets.

pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

+ pipenv install
  1. Run Powershell as ADMIN
  2. run $ pip uninstall pipenv then run $ pip install pipenv
  3. Inside of a non-ADMIN Powershell run $ pipenv --version to ensure it installed properly.

You may now continue to run $ pipenv install in the repositories root directory.

Useful Commands

  • yarn dev to start the local server
  • pipenv run yarn dev to start the local server in the Python virtual environment with environment variables
  • yarn build to build the production version
  • yarn start to start built production version
  • pipenv run yarn start to start built production version with Python VE and EV. Only use this locally.
  • pipenv run yarn test to start server using testing environment with Python environment variables
  • yarn typorm to use typeorm CLI commands on a staging or production environment
  • yarn typeorm-dev to use typeorm CLI commands on the development environment
  • yarn connection to output connection information for a staging or production database
Clone this wiki locally