How to deploy Elixir Phoenix to Fly with Continuous Deployment

I put together a guide on how to deploy Elixir Phoenix to Fly with Continuous Deployment and automated database migrations. It also included Continuous Integration to run tests as you open a pull request and before deploying. It was a follow up to a review of hosting options for Elixir that included Fly.

Jack

5 Likes

Great! Looks like a very helpful resource. Thanks for sharing!

Oh, and welcome @jackgray!

Thanks @Mark! I hadn’t used Fly before writing the article and my experience using it was awesome.

1 Like

For an update to your “review of hosting options for Elixir”, you could consider the newest updates!

  • With Phoenix 1.6.4+
  • And latest flyctl

Then the deployment process for a non-clustered Phoenix app on Fly.io (with or without LiveView) is just this…

  • mix phx.new my_app
  • fly launch

That’s it!

Wow, that’s great! I updated the article with a note on the new process.

One other question, what log management tool/service do you all recommend to use with Fly? Are there any that you’ve found particularly easy to integrate?

@jackgray please check out the fly-log-shipper project! It ship logs from fly to other providers using NATS and Vector.

There’s config on the readme for plugging it into your logging service of choice. :slight_smile:

@Mark, if I plan to use Logflare for logs, do you recommend I set up logs with fly-log-shipper or the logflare logger backend? Are there big pros or cons with either choice?

It seems like adding the logflare logger backend package to my Elixir project would be simpler than running another Fly app for logs.

That is if I only plan to send logs to Logflare. If I plan to send logs to multiple providers, then maybe fly-log-shipper would be the better option. What do you think?

@jackgray I don’t have any particular recommendation here. I think it’s fine to experiment here, since log data is usually only diagnostic and changing it isn’t usually an issue. It makes sense to me to try the logflare logger backend for that reason.

Best of luck!

1 Like

I’ve updated my post above to use fly launch for deploying your Phoenix app with one command. Haha, I considered saving the old one to allow you to do a compare and contrast…the new process saves so many steps!

The updated post is adapted from chapters 1 and 2 of the Phoenix Deployment Handbook.