Skip to content

Instantly share code, notes, and snippets.

@crueber
Last active December 26, 2015 13:19
Show Gist options
  • Save crueber/7157038 to your computer and use it in GitHub Desktop.
Save crueber/7157038 to your computer and use it in GitHub Desktop.
A bunch of useful function for dealing with Heroku
# Setting up environment configuration on Heroku.
heroku config --app myapp
heroku config:add ENV_VAR=somevalue --app myapp
# Apply SSL Certs to Heroku
heroku certs --app myapp
heroku certs:add ssl.crt ssl.key --app myapp
# Generally useful commands for Heroku
heroku logs --tail --app myapp
heroku domains --app myapp
heroku maintenance:on --app myapp
heroku maintenance:off --app myapp
heroku run bash --app myapp
# Restoring a backup file to a Heroku Postgres DB.
heroku pgbackups:restore HEROKU_POSTGRESQL_COBALT_URL 'https://location.com/offile.backup' --confirm myapp
# Running arbitrary sql file on a Heroku Postgres DB.
heroku pg:psql HEROKU_POSTGRESQL_ROSE_URL < ~/file.sql
# Adding a post-deploy hook notification to a Heroku app.
heroku addons:add deployhooks:http --url="https://some.domainname.com/hook" --app myapp
# Deploying a WAR file to Heroku
heroku plugins:install https://github.com/heroku/heroku-deploy --app myapp
heroku labs:enable user_env_compile --app myapp
heroku deploy:war --war target/app.war --app myapp
# Useful MongoDB commands for use with MongoLabs and MongoHQ on Heroku
mongorestore -u username -p password -h hostname.com:1234 -d dbname .
mongodump -u username -p password -h hostname.com:1234 -d dbname
mongoimport --headerline --type csv -h hostname.com:1234 -u username -p password --collection colname --db dbname < ~/path/to/file.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment