Skip to content

chrisforrette/foodtrucks-app

Repository files navigation

Food Trucks App

Food Trucks frontend app

Requirements

Quick Start

This was created with Create React App, so everything in their user guide should apply here.

Create a .env and set the API URL with the REACT_APP_API_URL environment variable. You can run chrisforrette/foodtrucks-api for this, or point it at the staging API:

REACT_APP_API_URL="http://staging-food-trucks-api.herokuapp.com"

Activate Node version, install dependencies, and start the local server:

nvm use
npm i
npm start

Provisioning

Terraform is used to provision a server and addons on Heroku. Makefile has its own plan and apply commands, wrapping the Terraform commands of the same name for ensuring proper data-passing.

To create a Terraform, login with the Heroku CLI:

heroku login

Then run:

make plan ENV=staging TAG=1.2.3

Assuming the plan looks correct, apply it, provisioning server components:

make apply ENV=staging

CircleCI

CircleCI is configured to automatically deploy everything merged to master to a staging environment, and to deploy every Semver-like tag (e.g. v1.5.2) to a production environment. In order to do that, those environments must be set up first using Terraform following the Provisioning instructions above, and the CircleCI project needs HEROKU_EMAIL and HEROKU_AUTH_TOKEN environment variables in order to successfully execute the deployment script at scripts/deploy.sh.

This runs on Heroku using the Node.js buildpack and the Heroku static buildpack. The CircleCI 2.0 Heroku deployment instructions were used to set up Circle deployment, including the setup-heroku.sh script, which can be found in the .circleci/ directory, along with a deployment SSH key pair that needs to be added to any Heroku project you want to deploy to.