Fly.io
Fly.io is a public cloud built for developers who ship.
Electric and Fly
You can use Fly to deploy any or all components of the Electric stack:
One of Fly's specialities is deploying Elixir applications. So Fly is especially good for deploying the Electric sync service and/or Phoenix applications using Electric.
Need context?
See the Deployment guide for more details.
Deploy Postgres
Fly Postgres is not a managed Postgres service. See the general advice on Running Postgres in the deployment guide for information on how to configure Postgres to work with Electric.
Fly's Supabase Postgres is a managed Postgres service, powered by Supabase. If you use it, make sure to connect on the IPv6 DATABASE_URL
rather than the DATABASE_POOLER_URL
and see the Supabase guide for more context.
Deploy Electric
Copy the following config into a file called fly.toml
, replacing the app name and DATABASE_URL
:
app = "YOUR_UNIQUE_APP_NAME"
[build]
image = "electricsql/electric:latest"
[env]
DATABASE_URL = "postgresql://..."
ELECTRIC_DATABASE_USE_IPV6 = true
[http_service]
internal_port = 3000
force_https = true
[[http_service.checks]]
interval = "10s"
timeout = "2s"
grace_period = "20s"
method = "GET"
path = "/v1/health"
Using the flyctl
client, in the same directory as fly.toml
, run:
flyctl launch --copy-config --ha=false
Hit the health check endpoint to verify that everything is running OK:
$ curl https://YOUR_UNIQUE_APP_NAME.fly.dev/v1/health
{"status":"active"}
Deploy your app
You can run most kinds of apps on Fly, including static sites.