I can't change the machine restart policy

Seems like the default machine restart policy is “no”, I want to change it to “always”. I went to this thread and changed my fly.toml to set the restart policy but it seems like every machine created for my project has a restart policy set to “no”. How do I actually change the policy? Changing my fly.toml file does nothing.

Here’s the entire config in case it matters:

app = 'rtr'
primary_region = 'bog'


  release_command = 'python main.py'

  internal_port = 8080
  force_https = true
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

  protocol = 'tcp'
  internal_port = 8080
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 1

    port = 8080
    handlers = ['tcp']

  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

  policy = "always"
  retries = 10
  processes = ["app"]

I have tried to execute fly machine update [MACHINE_ID] --restart always, but I get this error:

Error: could not update machine : failed to update VM : invalid_argument: unable to update machine configured for auto destroy 

But I do not want to configure the machine for auto destroy, and as far as I know, there’s nothing in my fly.toml file that suggests that I want auto destroy for my machines, I’m not sure what to do here

UPDATE: When I deploy using fly m run . instead of fly deploy it sets the correct restart policy, not sure if there’s a way to configure it using fly deploy though so I’ll leave this open

Hi @NeutronBlast :wave:

When no policy is set explicitly, machines default to the on-fail restart policy if deployed with fly deploy, and always if started with fly m run. The “auto destroy” flag only gets set if your machines are started with fly m run --rm, in that case the only valid restart policy is no and cannot be updated.

More details can be found in the docs

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