- Install NVM: https://github.com/creationix/nvm
nvm install --ltsnpm install
npm startinstall PostgreSQL extensions:
pip install pgxnclient
pgxn install pgtapcreate schema of DB
createdb timesheet
./setup.sh timesheetthis will also run the test suite.
brew install fswatch
./watch-test.sh timesheetUse http://ngrok.io
Sample file:
{
"id": "1234",
"doc": {
"apptype": "Spreadsheet",
"category": "Timesheet"
},
"apikey": "STRING_CONFIGURED_IN_ENV"
}post to the API:
curl --verbose -X POST "http://localhost:3000/gsuite/snapshot" -H "Content-Type: application/json" -d @samples/coderbunker-intranet-timesheet.jsonshould return:
[{"snapshot_json":[]}]database:
pg_dump -N postgraphql_watch -O -s postgresql://localhost/timesheet > sql/timesheet.sqlBecause Heroku requires the app to be in the root, we use subtree to push:
git subtree push --prefix server heroku masterCreating/updating schema on Heroku instance:
psql -v "ON_ERROR_STOP=1" -b -1 -e -f sql/PSQL.sql `heroku pg:credentials:url | tail -1`Restarting the dyno (to load changes to the database for example)
heroku restart -a coderbunker-timesheetPushing the local database:
heroku pg:push timesheet postgresql-rigid-65921 --app coderbunker-timesheetPulling the Heroku database locally and making a copy before changing the pulled version (adjust date):
heroku pg:pull postgresql-rigid-65921 heroku-timesheet --app coderbunker-timesheet
psql -c 'CREATE DATABASE "heroku-timesheet-20180416" TEMPLATE "heroku-timesheet";' postgres-
Build Image:
docker build -t timesheet-backend . -
Run Container:
docker run -p 3000:3000 -e DATABASE_URL=postgres://docker.for.mac.localhost/DATABASE_NAME timesheet-backend
-
Get CNAME from heroku:
heroku domains -a coderbunker-timesheet -
add CNAME to google domains
NAME TYPE TTL DATA data CNAME 1h data.coderbunker.com.herokudns.com.
Enable SSL automatically managed by heroku.
want to push an amended history with subtree push? sadly, does not support push.
create a local branch and force push that first:
git subtree split --prefix server -b backup-branch
git push -f heroku backup-branch:master
should now be back to normal...