Deploying applications built on EdgeDB Cloud to Fly.io
-
Install the Fly.io CLI
-
Log in to Fly.io with
flyctl auth login
-
Run
flyctl launch
to create a new app on Fly.io and configure it. It will ask you to select a region and a name for your app. When done it will create afly.toml
file and aDockerfile
in your project directory. -
Set
EDGEDB_INSTANCE
andEDGEDB_SECRET_KEY
as secrets in your Fly.io app.For runtime secrets, you can do this by running the following commands:
Copy$
flyctl secrets set EDGEDB_INSTANCE <EDGEDB_INSTANCE>
Copy$
flyctl secrets set EDGEDB_SECRET_KEY <EDGEDB_SECRET_KEY>
Read more about Fly.io runtime secrets.
For build secrets, you can do this by modifying the
Dockerfile
to mount the secrets as environment variables.Copy# Build application RUN pnpm run build RUN \ EDGEDB_INSTANCE="$(cat /run/secrets/EDGEDB_INSTANCE)" \ EDGEDB_SECRET_KEY="$(cat /run/secrets/EDGEDB_SECRET_KEY)" \ pnpm run build
-
Deploy your app to Fly.io
Copy$
flyctl deploy
If your app requires build secrets, you can pass them as arguments to the
deploy
command:Copy$
flyctl deploy --build-secret EDGEDB_INSTANCE="<EDGEDB_INSTANCE>" \ --build-secret EDGEDB_SECRET_KEY="<EDGEDB_SECRET_KEY>"