- Node.js 9.x
- Postgres 9.x
- Terraform 0.10.x (for provisioning)
- Heroku CLI (for provisioning)
createdb foodtrucksCreate a .env file in the root of the project and drop in the DB URL, swapping in your own username/password:
DATABASE_URL="postgres://yourusername:yourpassword@localhost/foodtrucks"Build the tables in the database (if you've done this before, it will overwrite them so be careful) and import Food Truck data:
./scripts/syndb.js
./scripts/import_food_truck_data.jsnvm use # Run this if using NVM for Node version management
npm i
npm run dev
curl -i http://localhost:3000/food-trucksTerraform 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 loginThen run:
make plan ENV=staging TAG=1.2.3Assuming the plan looks correct, apply it, provisioning server components:
make apply ENV=stagingCircleCI 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.
To set these, go into the CircleCI project settings for this project, go into "Environment Variables", set HEROKU_EMAIL to the email of the Heroku account, and HEROKU_AUTH_TOKEN can be grabbed by running this with the Heroku CLI: heroku auth:token.