Friday, February 27, 2015

Heroku Scheduler Logs

See which processes are running, and note the number after 'scheduler'.

$heroku ps

Then view the log, replacing '123' with your number (--tail if you want more than just the last few lines).

$heroku logs --ps scheduler.123 --tail You can pipe that to a file $heroku logs --ps scheduler.123 --tail > log/scheduler.log

Or pipe and also view the output in your terminal window at the same time (note the vertical pipe character).

  $heroku logs --ps scheduler.123 --tail | tee log/scheduler.log

Thursday, February 26, 2015

Heroku Postgres Database - Backup and load into development environment

Create a new backup, expire the oldest one at the same time.

$heroku pgbackups:capture --expire

Download the backup to your local file folder

$curl -o latest.dump `heroku pgbackups:url`

Lastly, override your local development db (replacing username and dbname below)

$pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [dbname] latest.dump