gabriel / musehub public
deploy.md markdown
167 lines 6.3 KB
Raw
sha256:cfefc25a166c3c3eed8ea3529aee19ea350bc05f2954d007420e924133b7d8ce chore: pivot to nightly channel — bump version to 0.2.0.dev… Sonnet 5 patch 13 days ago

Deploy Runbook

Two things live here: deploying the MuseHub server and publishing a new Muse CLI build.

See versioning.md for why pyproject.toml and muse release tags use two different, both-correct version formats (PEP 440 vs SemVer 2.0), and for the alpha/beta/rc/nightly channel definitions referenced below.


Standard release flow

Both repos share the same version string — in PEP 440 canonical form (e.g. 0.2.0rc16, 0.2.0.dev1 — no hyphen, no v prefix; see versioning.md). Bump, deploy server, publish CLI — in that order.

# 1. Bump version in muse/pyproject.toml AND musehub/pyproject.toml, commit each on dev
#    (the bump commit is a simple chore: on a short-lived branch, merged back to dev)
#    Use PEP 440 canonical form: 0.2.0rc17, 0.2.0.dev1, 0.2.0 — never a hyphen or "v" prefix here.
#    Nightly counters are sequential, starting at dev1 (never date/timestamp-based — see versioning.md).

# 2. Push muse source to hub (local + staging)
muse -C ~/ecosystem/muse push local dev
muse -C ~/ecosystem/muse push staging dev

# 3. Deploy MuseHub server first — install.sh is generated from the server's MUSE_VERSION,
#    so the server must be at the new version before the tarball is published
cd ~/ecosystem/musehub
bash deploy/push.sh staging

# 4. Publish the Muse CLI tarball and smoke-test it
bash deploy/publish_muse_release.sh
#    Steps: build sdist → upload S3 → SSM copy to staging → prune old → HTTP check → smoke (18 checks).
#    If smoke fails, the tarball URL is live but broken — investigate before announcing.

# 5. Verify the installer picks up the new version
curl -fsSL https://staging.musehub.ai/install.sh | sh
muse --version   # should print the new version

0 — Build frontend assets (required before deploying MuseHub)

The Docker image copies compiled assets directly from the working tree. app.css and app.js are in .museignore (not committed), so they must be built locally before running push.sh.

cd ~/ecosystem/musehub
npm run build        # compiles src/scss → app.css and src/ts → app.js

Or rebuild only what changed:

npm run build:css    # SCSS only  (src/scss/app.scss → musehub/templates/musehub/static/app.css)
npm run build:js     # TS only    (src/ts/app.ts → musehub/templates/musehub/static/app.js)

Source files to edit (never edit the compiled output directly):

Asset Source
static/app.css src/scss/ — entry point app.scss, partials _*.scss
static/app.js src/ts/ — entry point app.ts
static/embed.css src/scss/embed.scss
static/embed-player.js src/ts/embed-player.ts

During local development, use the watch commands to rebuild automatically on save:

npm run watch:css    # rebuilds app.css on every SCSS change
npm run watch:js     # rebuilds app.js on every TS change

1 — Deploy MuseHub (server)

cd ~/ecosystem/musehub
bash deploy/push.sh staging          # build, push to ECR, blue-green deploy
bash deploy/push.sh prod             # same for prod
bash deploy/push.sh staging prod     # staging then prod in sequence
IMAGE_TAG=<prev-tag> bash deploy/push.sh staging   # rollback to a prior image

push.sh does a full blue-green deploy: builds a Docker image for linux/amd64, pushes it to ECR, starts the inactive slot, health-checks /healthz, switches nginx, and stops the old slot. The image tag is <short-commit-id>-<YYYYMMDDHHMMSS>.

For full infrastructure details (instance IDs, slot switching, SSM recovery) see infrastructure.md.


2 — Publish a new Muse CLI build

cd ~/ecosystem/musehub
bash deploy/publish_muse_release.sh

Must be run after step 1 (server deploy). Reads the version from ~/ecosystem/muse/pyproject.toml automatically.

What it does:

  1. Builds muse-<version>.tar.gz from ~/ecosystem/muse using python3 -m build
  2. Uploads the tarball to s3://musehub-releases/
  3. SSMs into staging and copies it to /data/releases/ on the instance volume
  4. Prunes S3 and the instance to keep only the 3 most recent tarballs
  5. Smoke-tests https://staging.musehub.ai/releases/muse-<version>.tar.gz — exits non-zero on failure

After a successful run, the new version is live and anyone running the installer gets it:

curl -fsSL https://staging.musehub.ai/install.sh | sh

Prerequisites

  • Python 3.14 + build package: pip install build
  • AWS CLI configured with credentials that can write to s3://musehub-releases and send SSM commands to i-07547cd20bee2dea5

Override version label

MUSE_VERSION=0.2.1 bash deploy/publish_muse_release.sh

Useful if you need to re-publish a tarball under a different version label without editing pyproject.toml.


3 — Smoke test the installed CLI

deploy/smoke_muse.sh runs 18 checks against the installed binary. It is called automatically at the end of publish_muse_release.sh, but can be run standalone to verify any staging or prod build:

cd ~/ecosystem/musehub

# Default: staging, version read from ~/ecosystem/muse/pyproject.toml
bash deploy/smoke_muse.sh

# Explicit URL (prod)
bash deploy/smoke_muse.sh --url https://musehub.ai

# Explicit version (re-smoke a prior build)
bash deploy/smoke_muse.sh --version 0.2.0rc13

Exit code 0 = all 18 checks passed. Exit code 1 = one or more checks failed. Exit code 2 = setup error (tarball not found, venv failed).

The checks cover: version, init, add, commit, status, log, read, ls-files, branch, diff, checkout -b, checkout, branch -d, tag add, tag list, verify.


4 — Push benchmarking (manual, not a release gate)

tools/bench_push.py creates real repos on a hub, builds N commits of random content, times the first push and the re-push (all objects already present), then cleans up. Use it to verify push performance after changes to the wire protocol or to reproduce timeout issues.

cd ~/ecosystem/musehub

# Sizes: xs=1c/5f/512B  s=10c/10f/1KB  m=100c/20f/2KB  l=500c/50f/4KB  xl=1000c/100f/8KB
python tools/bench_push.py xs                                # local hub
python tools/bench_push.py --hub https://staging.musehub.ai xs s m

This is not a release gate. It creates real gabriel/bench-* repos on the hub — clean them up afterwards if needed.

File History 13 commits
sha256:cfefc25a166c3c3eed8ea3529aee19ea350bc05f2954d007420e924133b7d8ce chore: pivot to nightly channel — bump version to 0.2.0.dev… Sonnet 5 patch 13 days ago
sha256:31491a5f31832312965ba9c8d73c9eb6171069015bde3a471acc9d5006c1e45a revert: keep pyproject.toml in canonical PEP 440 form Sonnet 4.6 patch 15 days ago
sha256:d035733f21ccff27735fddebfbbe0ed24565a32a22db8de5885402262671ecd2 chore: bump version to 0.2.0rc15 for musehub#113 fix release Sonnet 4.6 patch 15 days ago
sha256:0032d6cfa33bc3c8367436ad768e7dd0e339b4332153160247da8266cb5fa352 Merge branch 'task/version-tags-phase3-server' into dev Human 17 days ago
sha256:4669620efda9ff41c55bdefd1f7bfe1c239d468428744c84ead9957e5a003a53 merge: rescue snapshot-recovery hardening (c00aa21d) into d… Opus 4.8 minor 30 days ago
sha256:a59da49c4611b970fc4b6ae48678ce4943261c213a07ddbd73ce9201df869b4a fix: remove false-positive proposal_comments index drop fro… Sonnet 4.6 patch 34 days ago
sha256:0a240d6dbff234f07d98a28a4a9a68db702f3f9ff9260196f24219bdb1c0b6f3 feat: render markdown mists as HTML with heading anchor links Sonnet 4.6 patch 35 days ago
sha256:24a7d47486ebc4ebd1832830580e177ec6f877b48dced8c000e198cdec4ce9d6 Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 36 days ago
sha256:b9ff931d147e0114a1f17060f415b89ed551c170a91ff226c70437aa5c85f9ee Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 36 days ago
sha256:d1122d21e73471879b460037b22c0b50fded7c423444a176f248428f75dac39c Merge 'task/fix-issue-pagination-cursor' into 'dev' — propo… Human 36 days ago
sha256:01e18975e73d2b3cd5b6db7929c895bef9aa6e0d4391dc5b2adfc548b41318dd Merge 'feat/adding-debug-logs-to-staging' into 'dev' — prop… Human 36 days ago
sha256:6b1949fc2797ca4c1936a637a4cbfec828ef56cf52398a2e74ca3c4f494e728f fix: use wire_bytes not mpack_bytes_raw in compute_object_b… Sonnet 4.6 patch 48 days ago
sha256:b99f2455dc346966d040133f5203297e6e3ef5803a93728a2c30568d0a0f7583 rename: delta_add → delta_upsert across wire format, models… Sonnet 4.6 patch 50 days ago