fly.io /init docs part 2

It does work in fly.toml, actually, although there are some rough edges that might cause a person to conclude otherwise, :sweat_smile:.

Here is a full example of a user process running as PID 1…

app = "multiverse"
primary_region = "ewr"
swap_size_mb = 512

machine_config = "solo-config.json"

[build]
  image = "debian:bookworm"

And the JSON file:

{
  "containers": [
    {"name": "c1",
     "image": "debian:bookworm",
     "cmd": ["sleep", "inf"]}
  ]
}

Then…

$ fly app create multiverse
$ fly config validate --strict
$ fly deploy --ha=false --depot=false
$ fly ssh console
# od -c /proc/1/cmdline 
0000000   s   l   e   e   p  \0   i   n   f  \0
0000012

I.e., PID 1 is the cmd from solo-config.json.


Aside: The build.image knob is mandatory, but it’s not clear what it really changes at run time…

2 Likes