Title: Research and document how to gracefully shut down agents using different terraform providers (update templates) · Issue #6174 · coder/coder · GitHub
Open Graph Title: Research and document how to gracefully shut down agents using different terraform providers (update templates) · Issue #6174 · coder/coder
X Title: Research and document how to gracefully shut down agents using different terraform providers (update templates) · Issue #6174 · coder/coder
Description: Also see #6175 To ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown procedure. What does graceful shutdown mean?...
Open Graph Description: Also see #6175 To ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown proc...
X Description: Also see #6175 To ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown proc...
Opengraph URL: https://github.com/coder/coder/issues/6174
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Research and document how to gracefully shut down agents using different terraform providers (update templates)","articleBody":"Also see https://github.com/coder/coder/issues/6175\n\nTo ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown procedure.\n\nWhat does graceful shutdown mean? It means the provider issues a `kill -INT [coder_agent_pid]` (one of `HUP`, `INT`, `TERM`) when the resource is stopped. After a specified timeout, it may issue `kill -KILL [coder_agent_pid]` to ensure de-provision progresses.\n\n**Note:** This will not be the primary form of ensuring an agent is stopped gracefully. In the ideal scenario, this happens in a pre-provision step and this acts as a safety net (https://github.com/coder/coder/issues/6175).\n\nWe need to figure out how to perform graceful shutdown with (or verify that it works):\n\n- [x] [kreuzwerker/terraform-provider-docker](https://github.com/kreuzwerker/terraform-provider-docker) (see below)\n- [ ] [hashicorp/terraform-provider-aws](https://github.com/hashicorp/terraform-provider-aws)\n\t- Is there a better option than trying to gracefully interrupt in user_data script?\n\t- Container [should work out-of-the-box](https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/), timeout can be controlled via `stopTimeout`/ `ECS_CONTAINER_STOP_TIMEOUT`\n\t- Related: #5901\n- [ ] [hashicorp/terraform-provider-azurerm](https://github.com/hashicorp/terraform-provider-azurerm)\n- [ ] [digitalocean/terraform-provider-digitalocean](https://github.com/digitalocean/terraform-provider-digitalocean)\n\t- Droplets\n\t- K8S\n- [ ] [hashicorp/terraform-provider-google](https://github.com/hashicorp/terraform-provider-google)\n- [x] [hashicorp/terraform-provider-kubernetes](https://github.com/hashicorp/terraform-provider-kubernetes)\n\nEventually:\n- [ ] Update documentation and example templates\n\nRelated: #4677, #5914, #6139\n\n---\n\n**Docker:**\n```tf\nresource \"docker_container\" \"workspace\" {\n destroy_grace_seconds = 30\n stop_timeout = 30\n stop_signal = \"SIGINT\"\n}\n```\n\n**EDIT:** It looks like `destroy_grace_seconds` is required to trigger a graceful stop, `stop_{timeout,signal}` is insufficient alone. It may be that `stop_{timeout,signal}` can be omitted in normal use-cases though (needs verification).\n\n- [`destroy_grace_seconds`](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs/resources/container#destroy_grace_seconds)\n- [`stop_signal`](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs/resources/container#stop_signal)\n- [`stop_timeout`](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs/resources/container#stop_timeout)","author":{"url":"https://github.com/mafredri","@type":"Person","name":"mafredri"},"datePublished":"2023-02-13T11:36:14Z","url":"https://github.com/coder/coder/issues/6174"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:478e0421-e22c-c62c-61ac-357a8658b9f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDC6:669A1:4B2BF0:6377D9:6B019B5B |
| html-safe-nonce | 44e54f18bef93a104b68b633d1fd35a114194e325751187d4e246d48de4440e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREM2OjY2OUExOjRCMkJGMDo2Mzc3RDk6NkIwMTlCNUIiLCJ2aXNpdG9yX2lkIjoiODAwMzU4OTE5NzU5ODM5OTMyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1d34b6ace5e31efba344d39e53289ede0463df4520e3734d9729e4fdc3dcac14 |
| hovercard-subject-tag | issue:1582185481 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/6174/issue_layout |
| twitter:image | https://opengraph.githubassets.com/89c96f9157314e79fc0d8c15bcd014535d5e5c779f233737972e8689d6c957a0/coder/coder/issues/6174 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/89c96f9157314e79fc0d8c15bcd014535d5e5c779f233737972e8689d6c957a0/coder/coder/issues/6174 |
| og:image:alt | Also see #6175 To ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown proc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mafredri |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width