gabriel / musehub public
entrypoint.sh bash
44 lines 1.6 KB
Raw
sha256:a10adeeb7a0169cb9900f9806ed7a973047258abb6283724fe55e8eb68ff3f0a init: musehub initial commit Human 171 days ago
1 #!/bin/sh
2 set -e
3
4 # Install the muse package if the dev volume mount is present.
5 # This lets the server-side release analysis service import muse.plugins.code.
6 if [ -f /muse/pyproject.toml ]; then
7 echo "Muse volume detected — installing muse in editable mode..."
8 pip install -e /muse --quiet --root-user-action=ignore 2>/dev/null || true
9 fi
10
11 # Install the muse_contracts package if the dev volume mount is present.
12 # Provides shared cross-repo type contracts (IssueRecord, ProposalRecord, etc.).
13 # Copy to /tmp first so setuptools can write egg-info without hitting the
14 # read-only bind-mount.
15 if [ -f /src/contracts/pyproject.toml ]; then
16 echo "Contracts volume detected — installing muse_contracts..."
17 cp -r /src/contracts /tmp/muse-contracts-install
18 pip install /tmp/muse-contracts-install --quiet --root-user-action=ignore 2>/dev/null || true
19 rm -rf /tmp/muse-contracts-install
20 fi
21
22 # If a command was passed (e.g., "alembic upgrade head" from the deploy script),
23 # run it directly without starting the server.
24 if [ $# -gt 0 ]; then
25 exec "$@"
26 fi
27
28 # Blue-green deploys run migrations as a one-off before starting the new slot,
29 # so the new container starts clean without re-running them.
30 # Set SKIP_MIGRATIONS=1 in the new container to skip this step.
31 if [ "${SKIP_MIGRATIONS:-0}" = "1" ]; then
32 echo "SKIP_MIGRATIONS=1 — skipping alembic (already run by deploy script)"
33 else
34 echo "Running database migrations..."
35 alembic upgrade head
36 fi
37
38 echo "Starting MuseHub..."
39 exec uvicorn musehub.main:app \
40 --host 0.0.0.0 \
41 --port 10003 \
42 --workers "${UVICORN_WORKERS:-4}" \
43 --proxy-headers \
44 --forwarded-allow-ips='*'
File History 1 commit
sha256:a10adeeb7a0169cb9900f9806ed7a973047258abb6283724fe55e8eb68ff3f0a init: musehub initial commit Human 171 days ago