What's the recommended way to load config is via a volume?


Is there a way to load config in via a volume that isn’t a persistent volume in the sense it is tied to a specific region? In many apps I build we load environmental configs via files rather than env variables. In some cases they just can’t easily be env variables. I just had a look at how to do it in Fly, and I don’t think the Fly Volumes is what I want. The best I’ve come up with so far is I need to make custom Docker images that wrap the main image and embed the config.

Interested to hear if there is some other way to mount config as files into the images when they run.


The volumes on Fly don’t auto replicate to each other, so there isn’t idea of a “global hard disk” just yet.

That said, you could have the configs on Consul or another distributed key value store like KeyDB that you can run inside Fly, or just have them stored in external object storage like S3.

There are even options coming up soon, like a key value store on NATS that auto-replicates to all edges.

If you’re feeling clever, you can use our shared Consul setup we use for Postgres as a global config store (that’s how postgres uses it).

You can enable it like:

  enable_consul = true

This injects a FLY_CONSUL_URL environment variable into your app. You can use this to talk to Consul’s KV store, acquire global locks, etc.

You would need a script to retrieve these from Consul at boot time, though!

1 Like

Oh interesting. I assume the image could need to connect.to Consul to retrieve the config during it’s startup? Or is there a way for me.to config Consul to push the files into the container? I’ll do some research, I have more experience with K8s than Consul.

Side question: Is there a way to discover experimental fields?

Yep! It could be as simple as a cURL to pull down json and put it on the disk.

There’s no way to discover experimental fields. This is currently the only one worth using, and we’ve stopped creating them.

1 Like

Yeah, Consul has a super easy HTTP API: HTTP API | Consul by HashiCorp that you can access from pretty much any stack, including just curl. So you don’t actually need to pull in any libraries if you don’t want to. You could just download the data into the volume on application startup.

1 Like