extinctionrebellion / RebelsManager

MIT License
61 stars 20 forks source link

Status check endpoint to prove the server is running #81

Open mhulet opened 4 years ago

mhulet commented 4 years ago

The Rebels Manager should respond with 200 OK to a GET call from ping.extinctionrebellion.be. DNS records for this subdomain will be added on both Heroku and Cloudflare (no proxy).

If the dynos are down, this shouldn't respond.

Then we can point a tool like Uptime Robot at the https://ping.extinctionrebellion.be route, and notify anyone who can take care of this issue.

mhulet commented 4 years ago

We can do this in a middleware.

  ...
    return status_check(request) if bot?(request)
  ...

  private

  def bot?(request)
    request.url =~ /\/\/bot\./
  end

  def status_check(request)
    [200, {"Content-Type" => request.content_type || "text/html"}, ["OK"]]
  end