Heroku apps shuts down every few minutes - heroku

I've been hosting the back end of my mysql-express-react app on heroku (and the front end on netlify) and after starting heroku, the app works fine and I get a response from the database. A few minutes after though, I get an "Application Error" from heroku.
It turns on again for a few minutes when I do:
heroku ps:scale web=1
I'm using a free dyno in heroku (web node index.js) and ClearDB. I put "web node index.js" into a Procfile (though to be honest I don't exactly understand what it is), though there has been no difference. What can I do to fix this issue? Thanks!
Here are my logs

Related

Using bye bug on Heroku

I have a simple Sinatra application. When I launch it (rackup) locally, and I place a byebug breakpoint, then I can see and interact with bye bug when that spot is reached in the code.
When I deploy that same app on heroku, I have problems:
Using heroku logs -t I can see the output of the server as it runs, and when it hits the break point, I can see it but not interact with it.
Using heroku run irb I can run an interactive rib session but it is not of the running server.
I think this must be possible but I cannot find it documented anywhere.
I highly doubt this is possible.
When you run "heroku run irb", you are spinning up and interacting with a Heroku one-off dyno.
The one-off dyno is a completely separate VM, that has no connection (out of the box) with the dyno(s) running your Sinatra app.
You can check on Heroku Elements to see if there might be add-ons to enable you to debug your running Sinatra app, but out of the box, I don't think you can run an interactive irb session against it.

How can I push to Heroku, and still keep the web app live?

Say for example you had two web dynos set up for your account (0 worker dynos).
To save on switching to maintenance mode, how would one push to one web dyno, and then the other update once the first has finished booting?
You can't do that - pushing to Heroku will result in both dynos being restarted with the contents of the new slug.
However, there is a labs feature called preboot (https://devcenter.heroku.com/articles/labs-preboot) which might accomplish exactly what you want.

How do i shutdown my heroku app?

I've slowly battled through to the point where I have a working Grails app on Heroku. I'm going to bed now so I want to shut it down so I don't continue to use up my 750 free hours of my Dyno. It is probably obvious but I can't find how to shutdown my Heroku web server and restart it again in the morning.
To shut down your Heroku app scale the web processes to 0:
heroku ps:scale web=0
See the Usage & Billing dev centre article: "A web dyno that is idled continues to accrue usage". I believe maintenance mode will continue to accrue time; it simply serves a static page to visitors instead of serving your app.
Keep in mind each app receives 750 free billing hours per month. Depending on your intended usage, this may mean you don't need to shut down (i.e. if you only plan to run a single dyno for the whole month).
From web:
Personal => Your App Name => Overview => Configure Dynos => Click on edit against web => Flip the switch => Confirm
To stop a DYNO you can use:
heroku ps:stop "appname"
To get list of running appnames you can use:
heroku apps
Just read the documentation:
https://devcenter.heroku.com/articles/one-off-dynos#one-off-dynos
Type
heroku ps
to see all running app associated to you account, with an id associated, then
heroku ps:stop run.1
if the app you want to stop has the 1 id.
Note that the maintenance mode will not stop your app. Mine was wrongly configured and continued to crash with the maintenance mode enabled.
There's a Maintenance Mode in Settings now in 2019.
Maybe turn on maintenance mode? heroku maintenance:on
You can use the add-on AutoIdle to automatically shutdown:
https://elements.heroku.com/addons/autoidle

Upgrade process on Heroku?

If I update an application running on Heroku using git push and this application is running on multiple dynos - how is the upgrade process run by Heroku?
All dynos at the same time?
One after another?
...?
In other words: Will there be a down-time of my "cluster", or will there be a small time-frame where different versions of my app are running in parallel, or ...?
well can not tell the internal state but what i have experienced is
Code push complete
Code compiled (slug is compiled )
After that all dynos get the latest code and get restarted. (restart take up to 30 seconds or so and during this time all requests get queue).
So there will be no down time as during the restart process all the requests get queued and there i dont think that that multiple versions of your code will be running after the deployment.
Everyone says there's 'no downtime' when updating a Heroku app, but for your app this may not be true.
I've recently worked on a reasonably sized Rails app that takes at least 25 seconds to start, and often fails to start inside the 30 seconds that Heroku allows before returning errors to your clients.
During this entire time, your users are waiting for something to happen. 30 seconds is a long time, and they may not be patient enough to wait.
Someone once told me that if you have more than 1 dyno, that they are re-started individually to give you no downtime. This is not true - Heroku Stops all dynos and then Starts all Dynos.
At no time will there be 2 versions of your app running on Heroku

Is there any down time when committing to a clojure app running on Heroku?

Is there any potential downtime when I do a commit to a clojure/Java app running on Heroku?
I am guessing not - but can't find out for sure.
Thanks.
When you push to Heroku, you invoke the slug compiler, which does all the heavy lifting needed to turn your application into a self-contained archive. That can take a little while, as you see whenever you run git push. However, during this time, your application is running normally.
When your slug finishes compiling, Heroku then pushes it out to the dyno grid. This causes existing web dynos to stop and causes new ones to start. Your application will be unresponsive between the time that the old dynos stop and the new ones begin serving requests -- probably only a few seconds. During this interval, Heroku's routing layer will queue incoming requests.
TL;DR: users might notice a pause (but not an error!) as your application is updated. You can simulate this at any time by running heroku restart.

Resources