Fly.io installation guide

Create fly account

  1. Create account and login at https://fly.io.
  2. Setup two factor authentication under Account->Settings->2FA.
  3. Logout and login again using 2FA.

Install flyctl

Using homebrew

brew install flyctl

Or using installer script

curl -L https://fly.io/install.sh | sh

Login with the fly auth cmd

fly auth login

Read more about flyctl here: https://fly.io/docs/hands-on/install-flyctl/

Create fly app

First, create a local directory for your fly application.

mkdir cradle-cms
cd cradle-cms

Then create the app.

fly app create cradle-cms

List the available fly regions and note the region id of the datacenter you want to deploy to (primary_region).

fly platform regions

Edit or create a fly.toml configuration file with a text-editor.

You can use this simple template for the app and change the configuration options specified in the [env] section.

app = 'cradle-cms'
primary_region = ''
[env]
  TLS = false
  PORT = 8080
  ADMIN_USER = 'admin'
  ADMIN_EMAIL = 'your@email.invalid'
  ADMIN_PASS = 'your secret password'
[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]
[[vm]]
  memory = '512mb'
  cpu_kind = 'shared'
  cpus = 1
[mounts]
  source="storage"
  destination="/storage"
  processes = ["app"]
  initial_size = "3gb"

Set primary_region to the fly datacenter you prefer i.e the one being closest to you.

NOTE: since fly terminates https we must specify TLS = false and configure the web server to listen on PORT = 8080.

Deployment

Cradle-cms is deployed as a docker image so you need podman or docker installed on your computer.

With the docker or podman cli installed, login to our registry using your cradle-cms licence key and your account password.

docker login registry.cradlecms.com

Note: You might need to specify port :5000 on the registry url.

Then fetch the latest cradle-cms release.

docker pull --platform linux/amd64 registry.cradlecms.com/cradle-cms:latest

NOTE: As fly.io only supports linux/amd64 containers you should specify --platform linux/amd64 when downloading the image.

Then authenticate against fly.io docker registry

fly auth docker

Tag the local cradle-cms release which we will push to the fly application registry.

docker tag registry.cradlecms.com/cradle-cms:latest registry.fly.io/cradle-cms:latest

Then upload the image to the fly registry.

docker push registry.fly.io/cradle-cms:latest

Launch

Now you can start cradle-cms with the deployed image.

fly deploy --image=registry.fly.io/cradle-cms:latest

Then open a browser using the url that fly has assigned to your application.

Login to the admin with the username and password you specified in the configuration file.

NOTE: For better security you can configure the system using fly secrets instead.

Also there's a lot more configuration options available, but we've tried to keep things simple to begin with.