Tom Larkworthy
Tom Larkworthy

Reputation: 2364

Cycle Cloud Run Instance Manually

Occasionally my instances get into a corrupted state (especially since min-instance=1). I would like to restart one manually. Is this possible?

I know I can go through the console to create a new version, but this messes up my Terraform state. I would like to keep with the current version and just cycle the instance, a classic IT procedure called "Turning it on and off again" to fix my short term issue while I figure out the larger issue.

Upvotes: 0

Views: 864

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75745

No, you can't do it. If you have a routine that can detect a corruption, you can exit the container (the instance stopped and a new one is created). For that, 2 options:

  • Either you have an internal check that detects automatically the state of the container and exits in case of corruption (works for max-instance >=1 )
  • Or you can have 2 different endpoints (works only for max-instance=1):
    • One tell you the state of the container (OK or KO)
    • In case of KO, you can call an endpoint in your app that stop the instance ( And if your container is public, it's dangerous because anyone can restart your container!)

Upvotes: 2

Related Questions