A console utility easing up interactions with heroku when you have several heroku apps for one project (most common use case: production and staging environments for a webapp). This gem was inspired by a collection of thoughtbot aliases.
Ruby 1.9+ only. This gem depends on novelys/gomon. However, the presence of the commands
git is assumed.
gem install noveku
This gem is developed with Rails 3+ in mind.
However, it should be suited to any project with a notion of "app environment", with different heroku apps for these environments. It is assumed that your apps are using the cedar stack. While some commands might work for other stacks, this is purely coincidental.
noveku ENV COMMAND means that
COMMAND will be executed for the heroku app with the remote named
In the case of the commands
deploy, the local branch used as source is
Please read the next two paragraphs for detailed explications.
This gem makes a few assumptions about how your branches and remotes are named. This is not configurable, and there is no plans to change this.
originis the main git remote, pointing towards GitHub, BitBucket, or any other server.
- if you have a branch named
novelys, the heroku git remote corresponding this branch is assumed to be
Our git flow at Novelys is pretty straightforward :
master is the current version of the app;
staging is the pre-production version;
production the production one.
This translates to two heroku apps (the name of the apps does not matter), and the remotes named
[remote "heroku-production"] url = email@example.com:sampleapp.git fetch = +refs/heads/*:refs/remotes/production/* [remote "heroku-staging"] url = firstname.lastname@example.org:sampleapp-preprod.git fetch = +refs/heads/*:refs/remotes/staging/*
Considering what is written above :
noveku ENV COMMAND: will execute the given
COMMAND in the context of the
ENV local branch and
heroku-ENV heroku git remote.
When giving a command that has no specific support, it will be proxied to
heroku ARGS --remote ENV.
This makes several other commands available, such as
Exception made of mongodb related commands, they all accept the following options:
--dry-run: only prints the git command that is going to be executed, without executing it;
--verbose: prints the git command that is going to be executed, and then execute it.
Supported commands and their equivalent :
heroku run rake ARGS --remove ENV
heroku run console --remote ENV
heroku run rake db:migrate --remote ENV && heroku restart --remote ENV
heroku logs --tail --remote ENV
create APP_NAME ENV [ADDONS...]: creates
APP_NAMEbound to the remote
heroku-ENV. Each listed addon will be added right away. If any part of the subcommand fails, the remaining will not be executed.
Those commands are shortcuts for other git commands.
git push origin ENV, push your changes in your local branch to the
git push heroku-ENV ENV:master, push your changes in your local branch to the heroku remote.
mongodump: Dumps the mongo database. Shortcut for both
mongohq_dump: tries mongolab first, then mongohq.
mongolab_dump: Dumps the mongo database. Look in the config keys of
mongohq_dump: Dumps the mongo database. Look in the config keys of
Those commands put the dump in the
dump dir, relatively to where you executed it.
Since the restoration of the database does not involve any interaction with heroku, it is out of the scope of this gem at the moment. However, this gem depends on novelys/gomon, which includes a class wrapping mongodump/restore, making it very easy to use in a rake task.
Better test coverage. This will be bumped to
1.0.0 once this is done and after using the gem in our daily flow for a few weeks.
- Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. In the first case, please include a use-case.
- Fork the repository on Github, make a feature branch, work on this branch.
- If necessary, write a test which shows that the bug was fixed or that the feature works as expected.
- Send a pull request and annoy us until we notice it. :)
push; assumes heroku remotes are prefixed with
heroku-; enhanced README; internal refactoring.
0.5: Test coverage, check the presence of environment & that it matches a heroku app, that pwd is a heroku app, the presence of mongohq/lab uri.
gomonfor mongodump, changed executable names, internal refactoring.
0.1: First version. Available commands :