Prerequisites:

1

Create an app with Fly.io

In your terminal, run the following command from the source directory of your project to create a new Fly.io app with a fly.toml configuration file:

fly launch
2

Edit the fly.toml configuration file

Add a build section to the fly.toml file to specify the Infisical public Docker image:

[build]                                                                         
image = "infisical/infisical:v0.43.4"

Afterwards, your fly.toml file should look similar to:

app = "infisical"
primary_region = "lax"

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 1024

[build]
image = "infisical/infisical:v0.43.4"

Depending on your use-case and requirements, you may find it helpful to further configure your fly.toml file with options here.

For example, you may want to adjust the primary-region option to specify which region to create the new machine for your instance of Infisical to minimize distance and therefore latency between the instance and your infrastructure.

3

Set secrets for your Fly.io app

Running Infisical requires a few environment variables to be set on the Fly.io machine. At minimum, Infisical requires that you set the variables ENCRYPTION_KEY, AUTH_SECRET, MONGO_URL, and REDIS_URL which you can read more about here.

For this step, we recommend setting the variables as Fly.io app secrets which are made available to the app as environment variables. You can set the variables either via the Fly.io CLI or project dashboard.

  • CLI

  • Dashboard

Run the following command (with each VALUE replaced) in the source directory of your project to set the required variables:

flyctl secrets set ENCRYPTION_KEY=VALUE AUTH_SECRET=VALUE MONGO_URL=VALUE REDIS_URL=VALUE...

To use more features like emailing and single sign-on, you can set additional configuration options here.

4

Deploy the Fly.io app

Finally, run the following command in the source directory of your project to deploy your Infisical instance on Fly.io with the updated fly.toml configuration file from step 2 and secrets from step 3:

fly deploy

Resources:

Was this page helpful?