Deploying Elixir Apps with Ease: My Experience with Fly.io


I quick note on my experience deploying this website with Fly.io


Deploying with fly.io

As a developer, deploying and managing apps can be a difficult and frustrating. Luckily, there are services like Fly.io that make it much easier. In this post, I’ll be sharing my personal experience using Fly.io to deploy my this blog, and why I think it’s an excellent choice for anyone looking for a simple and elegant deployment solution.

Compared to other cloud platforms I’ve used, such as AWS, DigitalOcean, and Heroku, Fly.io stands out for its ease of use and simplicity. Their documentation is clear and concise, and it has been a great way to get an Elixir/Phoenix app up and running. With Fly.io, you need almost no knowledge of how Docker and hosting services work, making it an excellent choice for beginners. But even for experts, it offers powerful features like low-latency global distribution and grafana metrics.

In fact, Fly.io has a large number of simple deployment processes for many different frameworks, including one just Docker images themselves, so any app you can put in a Docker image, you can easily deploy on Fly.io. And if you’re looking to get started with Elixir, they have a getting started guide to help you.

I used Fly.io’s Elixir deployment docs to deploy davidtannerjr.com. I also set up a pipeline in GitHub so that on a pull request, it will automatically deploy to Fly.io. This is known as a Continuous Integration/Continuous Deployment (CI/CD) setup, which automates the process of building, testing, and deploying software changes. By setting up a pipeline, I can ensure that my app is always up to date after a pull request has been merged.

Setting up the pipeline was easy thanks to Fly.io’s documentation and the fact that they offer a GitHub Action for it. Here’s my github.yml that I got from following their docs here

htmlCopy code
name: Fly Deploy
on: [pull_request]
env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
  deploy:
      name: Deploy app
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - uses: superfly/[email protected]
          with:
            args: "deploy"

If you follow the links, you can have a CI/CD app setup and ready to use in no time. However, one gotcha that I ran into was that the certificates at the time I was setting it up didn’t work with Namecheap domains. So, I had to transfer my domain to Cloudflare.com in order to get the certs to work properly. Then their documentation worked just as expected.

If you’re looking to set up custom domains, Fly.io has a walkthrough on how to do it. You can check it out here: https://fly.io/docs/app-guides/custom-domains-with-fly/

In summary, Fly.io is an excellent service for deploying and managing your apps. It’s easy to use, offers powerful features, and has clear and concise documentation. Whether you’re a beginner or an expert, Fly.io has something to offer.