mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 14:27:21 +01:00
Its first complete run (2026-11-11, dry) would have freed nothing: every app was already at two releases and the 127G in use was elsewhere. Six tiers written from that day's usage report, each dry-run first: - container logs over 200M are truncated (one was 2.2G), syslog rotated - /opt/<app>/app-prev-* copies older than 14 days (kivvi kept seven from July), never the live app or the rollback target - superseded browser downloads under ~/.cache: the newest of each is kept - superseded agent CLI versions: the two newest are kept - pnpm store prune - node_modules and build output inside checkouts and agent worktrees idle for 14 days and not in use; source is never touched The target percentage is an input (default 75). Database dumps and Solon's 17G of places-snapshots are deliberately not here. Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq Co-authored-by: Claude <noreply@anthropic.com>
59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
# Safe, manual disk reclaim on the bitbaum box. Default is a dry run.
|
|
#
|
|
# Same SSH setup as box-doctor.yml and install-backups.yml (repo secret
|
|
# HETZNER_SSH_KEY, org variable HETZNER_IP). The script is piped to bash
|
|
# on the box as root and is never re-parsed in between.
|
|
#
|
|
# Run: gh workflow run disk-cleanup.yml # dry run (default)
|
|
# gh workflow run disk-cleanup.yml -f dry_run=false
|
|
name: Box disk cleanup
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry_run:
|
|
description: "Inventory and planned deletions only; change nothing"
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
target_pct:
|
|
description: "Stop once the disk is at or below this percentage"
|
|
required: false
|
|
default: "75"
|
|
|
|
concurrency:
|
|
group: box-disk-cleanup
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
cleanup:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
env:
|
|
HETZNER_IP: ${{ vars.HETZNER_IP }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: SSH setup (same key and host as deploy.yml)
|
|
run: |
|
|
test -n "$HETZNER_IP" || { echo "::error::org variable HETZNER_IP is not set"; exit 1; }
|
|
mkdir -p ~/.ssh
|
|
printf '%s\n' "${{ secrets.HETZNER_SSH_KEY }}" > ~/.ssh/id_deploy
|
|
chmod 600 ~/.ssh/id_deploy
|
|
ssh-keyscan -H "$HETZNER_IP" >> ~/.ssh/known_hosts 2>/dev/null
|
|
printf 'Host %s\n IdentityFile ~/.ssh/id_deploy\n IdentitiesOnly yes\n' "$HETZNER_IP" >> ~/.ssh/config
|
|
|
|
- name: Reclaim disk (or print the plan)
|
|
env:
|
|
DRY_RUN: ${{ inputs.dry_run }}
|
|
TARGET_PCT: ${{ inputs.target_pct }}
|
|
run: |
|
|
[ "$DRY_RUN" = "true" ] && D=1 || D=0
|
|
case "$TARGET_PCT" in ''|*[!0-9]*) TARGET_PCT=75 ;; esac
|
|
echo "dry_run=$DRY_RUN (script flag $D), target ${TARGET_PCT}%"
|
|
ssh -o BatchMode=yes -o ConnectTimeout=15 -o ServerAliveInterval=15 \
|
|
"root@$HETZNER_IP" bash -s -- "$D" "$TARGET_PCT" < scripts/hetzner/disk-cleanup.sh
|