This add-on is operated by Monkey 5 Labs LLC
Turn off your dynos when they're not being used, save big bucks!
Last updated 16 November 2016
The Light Switch add-on is currently in beta.
Table of Contents
LightSwitch is an add-on designed to save compute resources (and tons of money) that you have running on the Heroku platform by scaling down dynos when they’re not in use. You can also use LightSwitch to set up “operating hours” for your application. LightSwitch gives you the ability to establish “business hours” that define when your dynos are running and off hours when they aren’t.
After you add LightSwitch to your application, LightSwitch will watch for HTTP requests routed to your application. As long as your application is receiving a steady stream of HTTP verbs (GET,PUT,DELETE,POST), your application continues to run normally. If, after a specified timeout, LightSwitch doesn’t see any HTTP traffic, LightSwitch will scale your app down, ensuring that no dynos are running once you’ve gotten past your configured time-out
LightSwitch is perfect if you have development or testing environments that are used only on occasion and you’d like to scale your dynos down when your app is not in use. This saves you a ton of money on unused compute resources. You can also scale dynos up and down based on a schedule, for example if you’d like your demo environment to only be available during certain hours of the day and scaled down on nights and weekends, LightSwitch has you covered!
Provisioning the add-on
LightSwitch can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create lightswitch -----> Adding lightswitch to sharp-mountain-4005... done, v18 (free)
Once LightSwitch has been added to your application, a log drain will be linked to your app which will be used to monitor incoming HTTP traffic. You don’t have to do anything in order for this to happen and we don’t store any of the incoming log data. If LightSwitch does’t see any HTTP activity and you’ve enabled the dyno shut-off feature, LightSwitch will turn your dynos off for you once you’ve gotten past your configured time-out.
After installing LightSwitch your application will be configured and fully integrated with the add-on. All you need to do is specify HTTP time-out parameters and an optional dyno schedule. That’s all there is to it!
LightSwitch does not have any applicability in a local development environment, so there’s no need to worry about this process.
Using with Rails, Python/Django, Java, Node or …..
LightSwitch is completely language agnostic and as such, doesn’t require any special setup or configuration to work with your application. There is nothing special on your behalf that must be done.
You do have to make sure that you give LightSwitch your Heroku API key however, or else it won’t have the capability to turn your dynos on or off via the Heroku API.
The LightSwitch dashboard allows you to turn the dyno scale down feature on and off, set the HTTP traffic time-out value and configure “operational hours” for your application.
The dashboard can be accessed via the CLI:
$ heroku addons:open lightswitch Opening lightswitch for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting your application. Then, select LightSwitch from the Add-ons menu.
Your LightSwitch add-on is relatively self-contained and self sufficient. There is no coding, application-level configuration or other set-up required. If you are having issues with dynos not scaling up or down based on your setup, please open a (https://help.heroku.com)[support ticket] with Heroku.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process.
Upgrading or downgrading your LightSwitch plan is easy. Just use the CLI or the Heroku dashboard and you’re all set!
heroku addons:upgrade command to migrate to a new plan:
$ heroku addons:upgrade lightswitch:FYRKANTIG -----> Upgrading lightswitch:FYRKANTIG to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to: lightswitch:FYRKANTIG
Removing the add-on
LightSwitch can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy lightswitch -----> Removing ADDON-SLUG from sharp-mountain-4005... done, v20 (free)
All LightSwitch support and runtime issues should be submitted via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome at [[email@example.com]].