Machines restart policy set to 'always', but treated as 'no'

I have a machine that is being created with a fly.toml with the following section:

[[restart]]
  policy = "always"
  retries = 10

If I run fly m status -a APP_NAME -d I see in the bottom of the json:

{
  ...
  "restart": {
    "policy": "always",
    "max_retries": 10
  }
}

If I attempt to update it with fly m update --restart always -a APP_NAME, I get this diff:

Configuration changes to be applied to machine: 7843d17a222708 (broken-brook-8739)

  	... // 82 identical lines
  	 "image": "registry.fly.io/APP_NAME:deployment-0123456789ABCDEFGHIJKLMOP",
  	 "restart": {
- 	   "policy": "always",
- 	   "max_retries": 10
+ 	   "policy": "always"
  	 },
  	 "stop_config": {
  	... // 3 identical lines
  	
? Apply changes? (y/N) 

So the configuration appears to be set and in the correct place.

However, no matter what I do, after I run fly deploy -c fly/APP_NAME.toml, I get the following logs:

2024-07-25T07:54:46Z runner[1781573c272d08] ams [info]machine restart policy set to 'no', not restarting
2024-07-25T07:54:48Z runner[7843d17a222708] ams [info]Pulling container image registry.fly.io/APP_NAME:deployment-0123456789ABCDEFGHIJKLMOP
2024-07-25T07:55:09Z runner[7843d17a222708] ams [info]Successfully prepared image registry.fly.io/APP_NAME:deployment-0123456789ABCDEFGHIJKLMOP (20.704536602s)
2024-07-25T07:55:09Z runner[7843d17a222708] ams [info]Configuring firecracker

… and that’s it. I have to manually run a restart and everything works.

The machine’s restart policy is clearly NOT set to no. It’s configured in every way to not be no, but the machine will not operate any other way.

How can I get the machine to respect it’s restart policy?

Hi @barrelltech, perhaps you solved this already, but from your pasted logs it looks to me like you have two Machines with different configs. fly m update only updates one Machine per invocation, as far as I’m aware. Would that explain your observations?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.