6

Heroku has a free plan, as outlined here: https://www.heroku.com/pricing

One of the drawbacks of the free plan is that the server goes to sleep after 30 minutes of inactivity. Is it possible to bypass this if I have a console.log("stay awake"); occur every 20 minutes?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ralph David Abernathy
  • 5,230
  • 11
  • 51
  • 78

1 Answers1

9

It is not possible to bypass that limit - in a sense that all your services will likely get shut down before the end of the month for much longer than 30 minutes if you do that all the time - but you can keep your process alive e.g. by hitting some endpoint periodically but you will quickly exhaust your free hours that way:

Verified accounts come with a monthly pool of 1000 Free dyno hours; unverified accounts receive 550. When a Free dyno is active, it draws from the pool; your free apps can run as long as there are dyno hours left in your monthly pool.

It may be useful if you need to make sure that you API is responsive for short periods of time like during a demo or a presentation.

Whatever you do make sure that it is not against the TOC. When in doubt ask the customer service. They are very helpful.

If you want an uninterrupted service but Heroku is too expensive then you should probably use a VPS like Digital Ocean or Vultr. They are much cheaper, work 24/7 and you can have few months for free with promo links (Digital Ocean, Vultr) but the drawback is that you will have to make more things yourself - like install Node, deploy the application, keep the OS, Node and all services updated and configured properly etc. It's not that hard to do but you need to know what you're doing and no one will fix your system for you. To see how to install Node on a VPS see:

Community
  • 1
  • 1
rsp
  • 107,747
  • 29
  • 201
  • 177
  • 1
    Kinda contradicted yourself. _It is **not** possible to bypass that limit. **You can** keep your process alive_ although I gave you a +1 for the warning about running out of the dyno hours – George Apr 13 '17 at 13:42
  • @George I meant that it is not possible to bypass that limit in a sense that all your services will likely get shut down before the end of the month for much longer than 30 minutes if you do that. I may not have been clear enough. Thanks for pointing it out. :) – rsp Apr 13 '17 at 13:50
  • It's worth noting that VPS services like DigitalOcean (good though they are; my site is hosted on there and the service has been excellent thus far) are a fair bit more hands-on than Heroku - expect to do quite a bit of Linux command-line stuff if you opt for that option. That's why Heroku costs more - you're paying for the convenience of not having to manage that side of things yourself. – Joe Clay Apr 13 '17 at 13:52
  • Thanks for the answer and comments. I'm fine with setting up the server up myself. Just looking for a free a server to house a Slack bot that sends 1 message every week. – Ralph David Abernathy Apr 13 '17 at 13:55
  • 4
    @RalphDavidAbernathy If your server needs to send 1 message every week then I don't think that having few seconds of waking up after 30 minutes inactivity should be a concern here. – rsp Apr 13 '17 at 13:58