Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/cleanup-deleted-workspaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ echo
# --- Docker volumes ---
orphan_volumes=()
while IFS= read -r vol; do
# Volume names look like: coder-<owner>-<workspace>-dind-cache
if [[ "$vol" =~ ^coder-(.+)-dind-cache$ ]]; then
# Volume names look like: coder-<owner>-<workspace>-dind-cache or
# coder-<owner>-<workspace>-linuxbrew. Add any new persistent per-workspace
# volume suffix here too, or orphans of that type will go undetected.
if [[ "$vol" =~ ^coder-(.+)-(dind-cache|linuxbrew)$ ]]; then
owner_workspace="${BASH_REMATCH[1]}"
if [[ -z "${active_dirs[$owner_workspace]+_}" ]]; then
orphan_volumes+=("$vol")
Expand Down
14 changes: 8 additions & 6 deletions scripts/workspace-lifecycle-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# Notify and delete idle workspaces on coder.ddev.com.
#
# Why this exists:
# Stopping a workspace does not free its Docker volume — each Sysbox
# workspace keeps a multi-GB dind-cache volume until the workspace is
# deleted (the destroy provisioner in each template removes it). With no
# lifecycle policy, stopped workspaces accumulate forever and slowly fill
# /data on the host. This janitor enforces: notify at N days idle, delete
# 7 days after the notice if the workspace is still untouched.
# Stopping a workspace does not free its Docker volumes — each Sysbox
# workspace keeps a multi-GB dind-cache volume and a linuxbrew volume until
# the workspace is deleted (Terraform destroys them, along with everything
# else in the workspace's resource graph, when the workspace itself is
# deleted). With no lifecycle policy, stopped workspaces accumulate forever
# and slowly fill /data on the host. This janitor enforces: notify at N
# days idle, delete 7 days after the notice if the workspace is still
# untouched.
#
# Policy (state machine per workspace, keyed by workspace id):
# - Not yet notified, age(last_used_at) >= NOTIFY_DAYS
Expand Down
Loading