Deploying WordPress on fly.io

fly.io offers an interesting take on “NoOps” infrastructure that is centered around a pay-as-you-go approach to application deployment. Much like Heroku, fly.io allows developers to deploy their own ‘containerized’ applications with a CLI (at a cheaper price). But unlike Heroku, fly.io offers persistent volumes for storing files with built-in resting encryption & snapshot backups (priced at $0.15/GB at the time of writing). Applications can also be deployed to multiple regions, all with a single Anycast IP allowing applications to be distributed globally.

I took the time to create a sample repo that details how to deploy a WordPress application to fly.io (based on my local WordPress development environment). The actual detailed steps for deploying a WordPress application are listed on the readme, but I’ll go ahead and list an overview here

  1. Clone the repo & install the flyctl CLI
  2. Run fly launch and answer guided questions
  3. Create a persistent volume for the sqlite database
  4. Set configuration variables within the fly.toml file
  5. Deploy the app
  6. Fix a file permission issue with the mounted persistent volume
  7. Set up WordPress

The deployment process is very simple for full-stack apps that use sqlite as a database. fly.io even has documentation for how to use LiteFS to create distributed copies of sqlite databases in multiple regions. The platform has a lot of cool features including seemingly limitless scale, which make it a good candidate the next time you’re looking to deploy an application.