gabriel / musehub public
entrypoint.sh bash
65 lines 2.4 KB
Raw
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor ⚠ breaking 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 MuseHub..."
49 if [ -f /tls/localhost.crt ] && [ -f /tls/localhost.key ]; then
50 echo "TLS cert found — starting uvicorn with HTTPS"
51 exec uvicorn musehub.main:app \
52 --host 0.0.0.0 \
53 --port 1337 \
54 --proxy-headers \
55 --ssl-certfile /tls/localhost.crt \
56 --ssl-keyfile /tls/localhost.key \
57 --workers "${UVICORN_WORKERS:-4}"
58 else
59 echo "No TLS cert — starting uvicorn with HTTP/1.1 cleartext"
60 exec uvicorn musehub.main:app \
61 --host 0.0.0.0 \
62 --port 1337 \
63 --proxy-headers \
64 --workers "${UVICORN_WORKERS:-4}"
65 fi
File History 1 commit
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor 1 day ago