When starting a new Heroku application, it's pretty common that we'll find ourselves repeating the same steps. There is probably a set of add-ons that we find ourselves using over and over again. For a Rails app, we might find ourselves consistently setting up a stack with Postgres, MemCachier, LogEntries, and Rollbar. We can automate this!
In this recipe, you'll learn how to create applications and enable add-ons programmatically via the API.
Note
Be sure to read the Getting started with the Platform API Gem recipe before attempting this recipe.
Let's start by opening up a terminal and going to our heroku-api-examples
directory. Then, we can perform the following steps:
We'll use Ruby in this recipe. Let's start it now by running
console.rb
:$ ruby console.rb
To create a new application, we can use
app.create
. We'll need to specify the application's name, its region (us
oreu
), and its Heroku stack. We should always use the latest stack, which at...