gabriel / musehub public
entrypoint.sh bash
68 lines 2.5 KB Hotspot Cold
Raw
sha256:de0006978cb066c122f0557ad42e0f2c015079b998ce210bd2144580572fc0c2 fix(deploy): per-IP limits key on the visitor, not the Dock… Opus 5.5 patch 1 day ago
1 #!/bin/sh
2 set -e
3
4 # /tmp/devpkgs is a writable site-packages directory for dev bind-mount installs.
5 # It's added to PYTHONPATH so packages installed here are importable.
6 DEVPKGS=/tmp/devpkgs
7 mkdir -p "$DEVPKGS"
8 export PYTHONPATH="$DEVPKGS${PYTHONPATH:+:$PYTHONPATH}"
9
10 # Install the muse package if the dev volume mount is present.
11 # Copy to /tmp first so setuptools can write egg-info without hitting the
12 # read-only bind-mount.
13 if [ -f /muse/pyproject.toml ]; then
14 echo "Muse volume detected — installing muse..."
15 mkdir -p /tmp/muse-install
16 tar -C /muse --exclude='./.muse' -cf - . | tar -xf - -C /tmp/muse-install
17 pip install /tmp/muse-install --target "$DEVPKGS" --no-deps --quiet 2>/dev/null || true
18 rm -rf /tmp/muse-install
19 fi
20
21 # Install the muse_contracts package if the dev volume mount is present.
22 # Provides shared cross-repo type contracts (IssueRecord, ProposalRecord, etc.).
23 # Copy to /tmp first so setuptools can write egg-info without hitting the
24 # read-only bind-mount.
25 if [ -f /src/contracts/pyproject.toml ]; then
26 echo "Contracts volume detected — installing muse_contracts..."
27 cp -r /src/contracts /tmp/muse-contracts-install
28 pip install /tmp/muse-contracts-install --target "$DEVPKGS" --no-deps --quiet 2>/dev/null || true
29 rm -rf /tmp/muse-contracts-install
30 fi
31
32 # If a command was passed (e.g., "alembic upgrade head" from the deploy script),
33 # run it directly without starting the server.
34 if [ $# -gt 0 ]; then
35 exec "$@"
36 fi
37
38 # Blue-green deploys run migrations as a one-off before starting the new slot,
39 # so the new container starts clean without re-running them.
40 # Set SKIP_MIGRATIONS=1 in the new container to skip this step.
41 if [ "${SKIP_MIGRATIONS:-0}" = "1" ]; then
42 echo "SKIP_MIGRATIONS=1 — skipping alembic (already run by deploy script)"
43 else
44 echo "Running database migrations..."
45 alembic upgrade head
46 fi
47
48 echo "Starting background worker..."
49 python3 -m musehub.worker &
50
51 echo "Starting MuseHub..."
52 if [ -f /tls/localhost.crt ] && [ -f /tls/localhost.key ]; then
53 echo "TLS cert found — starting uvicorn with HTTPS"
54 exec uvicorn musehub.main:app \
55 --host 0.0.0.0 \
56 --port 1337 \
57 --proxy-headers \
58 --ssl-certfile /tls/localhost.crt \
59 --ssl-keyfile /tls/localhost.key \
60 --workers "${UVICORN_WORKERS:-4}"
61 else
62 echo "No TLS cert — starting uvicorn with HTTP/1.1 cleartext"
63 exec uvicorn musehub.main:app \
64 --host 0.0.0.0 \
65 --port 1337 \
66 --proxy-headers \
67 --workers "${UVICORN_WORKERS:-4}"
68 fi
File History 11 commits
sha256:de0006978cb066c122f0557ad42e0f2c015079b998ce210bd2144580572fc0c2 fix(deploy): per-IP limits key on the visitor, not the Dock… Opus 5.5 patch 1 day ago
sha256:0e417fd1f8f54348dd85a8773fec7ca16c21f464b4478fd995fd0ea191a80090 fix(deploy): web containers run no background job worker; j… Opus 5.5 2 days ago
sha256:044de408d0372d370ea49a41a825babf82999cca72d95ee4cd79e4de13155ace feat: wire up push intel jobs and start background worker Sonnet 4.6 minor ⚠ 149 days ago
sha256:4aed3d8601c8dd3ed37074de35f11f4a9699a0a4b99d43727048fd3f8e6fd13d chore: doc sweep, ignore wrangler build state, misc fixes Sonnet 4.6 minor ⚠ 174 days ago
sha256:1200582a657e45c2915b8e496d86a70ad89b1e13ec8841ffeaa4fc81407a5095 fix: zlib encoding, fetch/objects endpoint, proxy-headers, … Sonnet 4.6 minor ⚠ 203 days ago
sha256:fa09ac42f4681dbbae97a4988180b9bb7e4a29f1eee55eadd349fb09d85dfb2a chore: replace hypercorn with uvicorn; delete hypercorn tests Sonnet 4.6 minor ⚠ 206 days ago
sha256:a8dd5ec7048c629796e5bb765e1042e3897d5a6645337afe865d2831fcf016fc feat(deploy): Phase 8 — replace grpc_pass with proxy_pass f… Sonnet 4.6 minor ⚠ 207 days ago
sha256:b9f257889475f17486cbcb35204fffff0341adb3426e33a81c9e09041399ea8b feat: switch production to hypercorn h2c + nginx grpc_pass … Sonnet 4.6 minor ⚠ 208 days ago
sha256:04d6e943fc57b6439d1b39cd0aaeb003f8cd0796cb399ad1f5053a12c38d9d71 feat(local-dev): HTTP/2 via hypercorn + self-signed TLS cert Sonnet 4.6 minor ⚠ 208 days ago
sha256:8c68179f2340d9946ee2287f39fda69f30993a9765dcb5806ab3c3388ccc10c4 fix: bind-mount muse into container and install into devpkg… Sonnet 4.6 minor ⚠ 209 days ago
sha256:a88854503673dcad22463307411e1cc28e8c62b99ef5c8194ca642f1f99d101b chore: swap port to 1337 (was 10003) Sonnet 4.6 minor ⚠ 209 days ago