Skip to content

ci: stop restarters-dev nightly to save cost#889

Open
edwh wants to merge 2 commits into
developfrom
chore/stop-dev-nightly
Open

ci: stop restarters-dev nightly to save cost#889
edwh wants to merge 2 commits into
developfrom
chore/stop-dev-nightly

Conversation

@edwh

@edwh edwh commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Adds a scheduled GitHub Actions workflow that stops the restarters-dev Fly machine(s) every night at 02:00 UTC so we don't pay for the dev/staging box while it's idle overnight.

Why it's safe / how it works

  • fly.dev.toml has auto_stop_machines = "off" → Fly won't auto-stop the box during the day, and won't auto-restart a machine we stop here (min_machines_running is only enforced when autostop is enabled, so it's inert — verified: a manual fly machine stop stayed stopped).
  • fly.dev.toml has auto_start_machines = true → the machine boots again automatically the first time anyone hits it in the morning (verified: a request cold-started it back to started).
  • Stopped machines keep their volume, so no data is lost.

Net effect: off overnight (no CPU billing), back on demand.

Reuses the existing FLY_API_TOKEN repo secret. Also runnable on demand via workflow_dispatch (Actions tab → Run workflow).

Note on time zone

GitHub Actions cron is UTC and doesn't follow BST/DST:
0 2 * * * = 02:00 UTC = 03:00 London in summer (BST) / 02:00 in winter. Nudge the cron if you want exactly 02:00 London year-round.

Scheduled workflows only fire once this is on the default branch (develop), so it starts running the night after merge.

🤖 Generated with Claude Code

Adds a scheduled GitHub Actions workflow that stops the restarters-dev Fly
machine(s) every night at 02:00 UTC. auto_stop_machines is "off" so Fly won't
undo the stop, and auto_start_machines is true so the box boots again on the
next request in the morning. Reuses the existing FLY_API_TOKEN repo secret.

Off overnight (no CPU billing), back on demand; the volume persists so no data
is lost. Also runnable manually via workflow_dispatch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread .github/workflows/stop-dev-nightly.yml Outdated
stop-dev:
runs-on: ubuntu-latest
steps:
- uses: superfly/flyctl-actions/setup-flyctl@master
Pin superfly/flyctl-actions/setup-flyctl from @master to the full commit
SHA ed8efb3 (master as of 2026-07-03). Satisfies SonarCloud's new_security_rating
gate (rule githubactions:S7637 — pin actions to a full-length commit SHA to
prevent a moving tag/branch from silently introducing malicious code).
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants