Improved tired-proxy for use with Fly Machines

As shown in in a Fly blog post, it is possible to scale to 0 with machines. In this blog post, tired-proxy is introduced to shut down the machine after a configurable amount of time with no requests. However, it could be improved a bit. Therefore, I forked the repository and added my two cents:

  • Proper shut down of the server
  • Ability to wait for the web server to come online before starting the proxy server. Previously, the first request to the machine would return a HTTP 502, except if the web server starts very fast.
  • Logging that is easier to parse

You can find the repository with details here. Oh, and there is a docker image: tiesv/tired-proxy

Give it a try (in your container deployed to a machine):

./run-my-webserver & /tired-proxy --origin=http://localhost:3000 --wait-for-port=10

For me the application is useful, hopefully for you too!


Breaking changes compared to superfly/tired-proxy:
Some options have been renamed:

  • --host => --origin
  • --time => --idle-time

@fly staff: you are of course free to port these changes back into your version. That is what FOSS is all about :wink:

6 Likes

Hi!

It looks like this little experiment is getting used more. I just came across this post that I missed back in February when you posted it (thanks!)

I think we’d be open to PR’s on the original repo, but better check with @lubien , as he (we) may not have time to maintain that!

2 Likes

Thank you! Going to poke into this.

This is a huge issue for us as well. I tried tiesv/tired-proxy and it worked. Would love for this to be built from the official tried proxy as well.
@tries-v thank you for your efforts

1 Like