Mhmmmmm food
Install Postgres:
Current version requirement: 9.3 and up
Install Node.js:
https://nodejs.org/ v0.10.36
Create databases:
psql -h localhost --command="create database cater"
psql -h localhost --command="create database cater_test"
Setup errthing:
git clone git@github.com:goodybag/cater-api-server.git
cd cater-api-server
Setup Dropoff Module Installation
Create a github personal access token: https://github.com/settings/tokens - You can call it something like, "Goodybag Dropoff Installation Token".
Export it in your environment as GITHUB_DROPOFF_TOKEN
Install deps
npm install
Setup local config
In the root directory there is a file named local-config.json.sample
, edit
this file as needed and save it as local-config.json
Change the information in local-config.json
:
Install MongoDB:
brew install mongodb
mongod
If you run into this error after running the last command:
ERROR: dbpath (/data/db) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo
sudo mkdir /data
sudo mkdir /data/db
sudo chown <YOUR_USERNAME> /data
sudo chown <YOUR_USERNAME> /data/db
mongod
Install Redis
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
Install Heroku Toolbelt
heroku login
heroku git:remote --app goodybag-production-cater # in the git repo
if you have multiple heroku accounts, checkout https://github.com/ddollar/heroku-accounts
Watch files, start log server, etc:
npm install -g grunt-cli
grunt
Create a balanced config
./bin/create-balanced-configs.js
Signup to Goodybag:
Visit the singup page, create an account and ask an existing administrator to make your account an admin too.
Capture database backup:
heroku pg:backups capture # maybe add: -a goodybag-production-cater
Sync prod data with local:
./bin/prod-to-local
Start server:
npm start
npm start
can take awhile. Trying running node server
for a faster start.
To run the functional test suite, you currently need the selinium chrome driver installed:
wget http://chromedriver.storage.googleapis.com/2.9/chromedriver_mac32.zip
unzip chromedriver_mac32.zip
mv chromedriver /usr/local/bin
node db/setup --test
node db/fake-data --test
To run the entire suite:
./bin/start-test-server
npm test
Or a single file:
mocha test/functional/login.js
To write your own functional tests, start off with some scaffolding:
grunt generate.functional-test:my-test-name
This will generate my-test-name.js
in test/functional
. You may have multiple tests per file, but keep the file scoped to one task. For instance, if you're testing login, it's ok to test the login functionality of multiple pages. And it's ok to add tests for failing login cases.
Resources: