Google App Engine requests /_ah/health from the managed vm to do health checking.
I trying to deploy a project that I'm not the code maintainer, it's going to be deployed as managed vm to have autoscaling and health checking.
Currently app.yaml doesn't support rewrite rules, if it supported I could point the /_ah/health to a /ping endpoint. This would be great because health checking could be implemented without changing code.
In app.yaml there is the configuration for handlers, my understanding is that handler are for use with the google runtime, not for managed VMs.
I want to change the location of the /_ah/health request. Is there a way to do this change?
So, suppose you have a "health-check serving endpoint" (using
webapp2
for definiteness, other frameworks would of course work similarly) inhealth.py
:and unfortunately you also have routing information hard-coded, say in the same file (rather than more properly reading it from an easily modified and pushed configuration file):
Now, to serve health checks from that same
HealthPage
handler, you need to edit yourapp.yaml
to have:before any handlers whose
url:
has wildcards that might "swallow" this one, of course.Now, since you have a strict, hard-coded routing decision in your application object, you'll have to edit that. This isn't really "editing code" -- it's editing configuration information that you unfortunately decided to embed as strict, hard-coded strings in your code, rather than picking it up from a configuration code.
Either make the in-code routing less strict, maybe all the way down to:
or if you're committed to using very strict hardcoded routes in your code, you' might choose to add one line...:
Similarly for other routing systems (beyond
app.yaml
and other configuration-based routing done for you by App Engine itself) of course --webapp2
's routing system is nothing strange, nor anomalous.Note that none of these edits stop your code from serving the
/howareyou
URL if it's routed tohealth.py
in other (non-GAE and non-GAE-like) deployments -- they'll serve it just as well as they used to do.If despite all of this you still demand a "URL rewriting" capability in
app.yaml
, or similarly powerful features, to deal with health checks while avoiding the need for this kind of tiny workaround, you can of course open a feature request at https://code.google.com/p/googleappengine/issues/list -- I just can't imagine it getting high urgency vs the thousands of open issues there, but, hey!, I've been wrong before:-).