Skip to content

Instantly share code, notes, and snippets.

@hendrikbeck
Created September 14, 2013 10:27
Show Gist options
  • Save hendrikbeck/6560856 to your computer and use it in GitHub Desktop.
Save hendrikbeck/6560856 to your computer and use it in GitHub Desktop.
Rails configuration to test and deploy to Heroku via CircleCI
database:
override:
- mkdir -p config
- |
echo 'test:
host: localhost
username: ubuntu
database: circle_ruby_test
adapter: postgresql
' > config/database.yml
- bundle exec rake db:create db:migrate --trace
deployment:
production:
branch: production
commands:
- heroku pgbackups:capture --expire --app [HEROKU_APP_NAME]
- heroku maintenance:on --app [HEROKU_APP_NAME]
- heroku scale worker=0 --app [HEROKU_APP_NAME]
- git push git@heroku.com:squar.git $CIRCLE_SHA1:refs/heads/master
- heroku run rake db:migrate --app [HEROKU_APP_NAME]
- heroku scale worker=1 --app [HEROKU_APP_NAME]
- heroku restart --app [HEROKU_APP_NAME]
- heroku maintenance:off --app [HEROKU_APP_NAME]
- curl -H "x-api-key:[NEW_RELIC_API_KEY]" -d "deployment[application_id]=[NEW_RELIC_APP_ID]" -d "deployment[description]=Deployment via CircleCI'" -d "deployment[revision]=$CIRCLE_BUILD_NUM" -d "deployment[changelog]=$CIRCLE_SHA1" -d "deployment[user]=CircleCI" https://rpm.newrelic.com/deployments.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment