Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Heroku labs feature in Heroku review apps

I have a Heroku app that has review apps enabled. The review apps are configured based on the app.json file in the root directory of my application. I'm able to add addons but I don't seem to be able to enable the runtime-dyno-metadata labs feature. Below is just one of the many ways I've tried to get this working...

{
  "name": "Foo",
  "scripts": {
    "postdeploy": "bundle exec rake db:migrate db:seed"
  },
  "formation": {
    "worker": {
      "quantity": 1
    },
    "web": {
      "quantity": 1
    }
  },
  "addons": [
    "heroku-postgresql",
    "heroku-redis",
  ],
  "labs": [
    "runtime-dyno-metadata"
  ],
  "buildpacks": [
    {
      "url": "https://github.com/heroku/heroku-buildpack-nodejs.git"
    },
    {
      "url": "https://github.com/heroku/heroku-buildpack-ruby.git"
    }
  ]
}
like image 218
blim8183 Avatar asked Jun 01 '16 13:06

blim8183


2 Answers

Adding lab features in app.json isn't supported.

like image 176
Damien MATHIEU Avatar answered Oct 04 '22 20:10

Damien MATHIEU


You can add labs to a review app using the Heroku API. With ruby, you could do something like this:

require 'platform-api'

heroku = PlatformAPI.connect_oauth(ENV['HEROKU_API_KEY'])

# Add any other features you care about
LABS_FEATURES = %w[runtime-dyno-metadata].freeze

LABS_FEATURES.each do |feature|
  heroku.app_feature.update(ENV.fetch('HEROKU_APP_NAME'), feature, enabled: true)
end

Note that at least some labs require a re-deploy before the lab feature is actually active, so you have to think about where you invoke this (e.g. a rake task invoked in release-phase or during the postdeploy command in app.json)

like image 39
rubendinho Avatar answered Oct 04 '22 20:10

rubendinho