How I Fly

A cartoon shark with a split keyboard types into an iMac while balloons fly past bearing the Xe Iaso sigil.
Image by Annie Ruygt

We are Fly.io. We make it easy to run your programs close to your users. We make it easy to update your programs whenever you need to and communicate between your services in an end-to-end encrypted fashion. Today, Xe is going to tell you what they do to use Fly.io effectively. Deploy your first app for free and scale it up to production. That’s what Xe did.

I’m Xe Iaso. I’m a writer, technical educator, and philosopher who focuses on making technology easy to understand and scale to your needs. I use Fly.io to host my website and in nearly all of my personal projects now. Fly.io allows me to experiment with new ideas quickly and then deploy them to the world with ease.

What is Fly.io?

Fly.io lets you host your applications in data centers close to your users. Fly.io also lets you have rolling updates of your programs and facilitates easy communication between your services inside and outside of your organization’s private network.

I use Fly.io to host my blog, its CDN (named XeDN for reasons which are an exercise for the reader), and a bunch of other supporting services that help make it run. It is easily the most fun I’ve had deploying things since I worked at Heroku.

My blog

My blog is made up of several parts: the backend blog server and the CDN. Both are written in Go, my favorite programming language. The back-end blog server runs in Toronto, but XeDN runs in 35 datacenters worldwide. I plan to eventually move my blog to be served from XeDN, but for right now it’s still comfortably running off of a single server in Toronto.

The entire flow for how things run on Xesite.

Overall, my website’s architecture looks like this. My website listens for updates from Patreon and GitHub to trigger rebuilds because of its dystatic nature. When I am working on new posts or building new assets, I upload them to Backblaze B2. Anytime someone tries to access one of the files on a XeDN node, it will download it from Backblaze B2 if it doesn’t have it locally already.

With Fly.io, I don’t have to worry about the user experience being degraded when servers go down. If any individual XeDN server goes down, I can rely on the other XeDN servers worldwide to pick up the slack thanks to the fact that Fly.io will shunt the traffic to the servers that aren’t down. Combine this with some very aggressive caching logic for things like video assets, I can make sure that my blog is fast for everyone, no matter where they are in the world.

Of course, it doesn’t end here. My CDN server is the back end that helps make my other projects work too. I spent some time working on a custom font for all of my web properties, and I serve it from my CDN so that I can use it in every project of mine. This allows me to integrate it into other projects like Arsène without having to do anything special.

Building on top of projects with Fly.io

I like making projects that aren’t entirely serious. I love using these projects to explore aspects and bits of technology that I would have never gotten to play with before. One of these is Arsène, a project I used to explore what a “dead internet” powered by AI could look like.

Every 12 hours, Arsène will have the ChatGPT API generate new posts and then use Stable Diffusion to create a (hopefully relevant) illustration for that post. I run a copy of the Automatic1111 Stable Diffusion API in my private network. When Arsène generates an image, it reaches out to that Stable Diffusion API directly over that private network to make the calls it needs. Since XeDN is in the same private network, I can also have Arsène send the images there to be cached and served all over the world.

Here’s what the total flow looks like:

The flow of data for Arsène, showing how this lets me reuse projects

This means that when I am creating things, I am not just making one-off things that don’t work with each other. I am creating individual building blocks that interoperate with each other. I am creating opportunities for me to reuse my infrastructure to create brand new things that are robust and scalable with minimal effort on my end.

My other projects

I have some other projects that I’m working on that I don’t want to get into too much detail about yet, but it’s going to mostly involve transforming the basic ideas of using my CDN for distributing things and a webserver for sending HTML to users in new and interesting ways. I love using Fly.io for this because I am just allowed to create things instead of having to worry about how to implement it, where state is going to be stored, or how I’m going to scale it.

Fly.io is the only platform where I’ve used where I can spin up 35 copies of a program as easily as one copy of a program.

Conclusion

If you haven’t given Fly.io a try yet, you’re really missing out. It is utterly trivial to deploy your application across the globe. Not to mention, when your applications are idle, you can have them scale down to zero copies. This means that you only pay for what you actually use. I don’t have to worry about overpaying for my blog by having a giant server in Helsinki running 24/7, even though I’m only using a small sliver of it.

If you want to learn more about Fly.io, you can check out fly.io. My CDN cost me nothing until I started adding cover art per post and the conversation snippets with furry stickers. It definitely went over the bar when I started uploading video. I can see it scaling in the future as my demands scale too.

Of course, this is barely even scratching the surface. Stay tuned for secret tricks you can use to dynamically spin up and spin down machines as you need. Imagine uploading an image, automatically creating a machine to handle compressing it, and uploading it to your storage back end. Imagine what you could do if compute was a faucet that you could turn on and off as you needed it.

You can do it on Fly.io. Try it today, you can run an app on a 256 MB Machine for free. XeDN ran on three 256 MB Machines for a year. Arsène still runs on a 256 MB Machine to this day. It’s more than enough for what you’re going to do. And when it isn’t, scaling up is cheaper than you can imagine.