-
Notifications
You must be signed in to change notification settings - Fork 12
Change scripts and tasks to use mise #4193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
backspace
wants to merge
45
commits into
main
Choose a base branch
from
mise-tasks-cs-10177
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+810
−607
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
7cfd967
Replace Volta with mise
backspace 5542190
Update more references
backspace 80dbdf2
Change Actions version
backspace 03ba46c
Add Mise tasks
backspace a1fc0b7
Update some package.json scripts
backspace f5a656d
Fix environment variables when deployed
backspace e06dc0e
Merge remote-tracking branch 'origin/main' into mise-10007
backspace dd8a7f5
Add empty commit
backspace f7828cf
Merge branch 'mise-10007' into mise-tasks-cs-10177
backspace 3276d58
Fix environment mode
backspace 298f57c
Merge remote-tracking branch 'origin/main' into mise-10007
backspace 2b5d4b0
Merge branch 'mise-10007' into mise-tasks-cs-10177
backspace ec790fd
Restore env vars script
backspace fabad74
Fix startup of icons server
backspace 9db4103
Merge remote-tracking branch 'origin/main' into mise-tasks-cs-10177
backspace 3bf303d
Remove superseded scripts
backspace 5bc7244
Fix environment mode icons server
backspace 9cfc80b
Merge remote-tracking branch 'origin/main' into mise-tasks-cs-10177
backspace e43a9aa
Fix all script
backspace 980a16f
Fix waiting for host
backspace 9a9b179
Merge remote-tracking branch 'origin/main' into mise-tasks-cs-10177
backspace 18fc711
Add icons to Matrix test startup
backspace 64ff1cb
Fix lint error
backspace ee4157c
Migrate more services and tasks
backspace 52363cb
Extract some setup for host
backspace 31ffeed
Extract slug calculation
backspace aa09cf7
Update README
backspace 9480166
Remove documentation of legacy approaches
backspace 2880c08
Move more tasks and services
backspace 6f3fc1c
Merge remote-tracking branch 'origin/main' into mise-tasks-cs-10177
backspace d4fdd62
Rename environment script and add task
backspace 3ec26bf
Remove unsupported frontmatter
backspace e3504f6
Fix environment script root
backspace fdaba8f
Extract duplication from dev startup scripts
backspace b1fe73d
Fix ellipses
backspace 4d1498f
Remove redundant package.json scripts
backspace e946256
Change how Ember is found
backspace 609dc01
Add handling for host startup failures
backspace 6d0a354
Add HOST_URL fallback for DEFAULT_HOST_URL
backspace aae839a
Add startup option in ensure-pg script
backspace 685635e
Add handling for abandoning BOXEL_ENVIRONMENT
backspace c633a5f
Fix naming in prerender wait logging
backspace e4f7dc3
Fix quotes in README commands
backspace 86dc10e
Remove duplicate Postgres startups
backspace a621dd0
Merge remote-tracking branch 'origin/main' into mise-tasks-cs-10177
backspace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start full dev stack (realm server, workers, test realms)" | ||
| #MISE dir="packages/realm-server" | ||
|
|
||
| . "$(cd "$(dirname "$0")" && pwd)/lib/dev-common.sh" | ||
|
|
||
| WAIT_ON_TIMEOUT=2400000 NODE_NO_WARNINGS=1 start-server-and-test \ | ||
| 'run-p -ln start:pg start:matrix start:smtp start:prerender-dev start:prerender-manager-dev start:worker-development start:development' \ | ||
| "$PHASE1_URLS" \ | ||
| 'run-p -ln start:worker-test start:test-realms' \ | ||
| "$NODE_TEST_REALM_READY" \ | ||
| 'wait' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start host app + full dev stack (host must be ready before realm server)" | ||
| #MISE dir="packages/realm-server" | ||
|
|
||
| # Add node_modules/.bin to PATH (mise run bypasses pnpm which normally does this) | ||
| # MISE dir is packages/realm-server, so ../.. is repo root | ||
| PATH="$(pwd)/../../node_modules/.bin:$(pwd)/node_modules/.bin:$PATH" | ||
|
|
||
| . "$(cd "$(dirname "$0")" && pwd)/lib/dev-common.sh" | ||
|
|
||
| # Start host app in background and wait for it before launching the rest. | ||
| # start-server-and-test v1.x only supports 2 server phases (5 args), so we | ||
| # start the host manually and use wait-on to gate readiness. | ||
| pnpm --filter @cardstack/host start & | ||
| HOST_PID=$! | ||
| cleanup_host() { | ||
| kill "$HOST_PID" >/dev/null 2>&1 || true | ||
| } | ||
| trap cleanup_host EXIT INT TERM | ||
|
|
||
| HOST_TIMEOUT=120 | ||
| ELAPSED=0 | ||
| echo "Waiting for host app at ${HOST_URL} (timeout: ${HOST_TIMEOUT}s)…" | ||
| while true; do | ||
| if ! kill -0 "$HOST_PID" 2>/dev/null; then | ||
| echo "ERROR: Host app process died." >&2 | ||
| exit 1 | ||
| fi | ||
| if [ "$(curl -s -o /dev/null -w '%{http_code}' "$HOST_URL" 2>/dev/null)" = "200" ]; then | ||
| break | ||
| fi | ||
| sleep 2 | ||
| ELAPSED=$((ELAPSED + 2)) | ||
| if [ "$ELAPSED" -ge "$HOST_TIMEOUT" ]; then | ||
| echo "ERROR: Host app did not become ready within ${HOST_TIMEOUT}s." >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
| echo "Host app is ready." | ||
|
|
||
| WAIT_ON_TIMEOUT=2400000 NODE_NO_WARNINGS=1 start-server-and-test \ | ||
| 'run-p -ln start:pg start:matrix start:smtp start:prerender-dev start:prerender-manager-dev start:worker-development start:development' \ | ||
| "$PHASE1_URLS" \ | ||
| 'run-p -ln start:worker-test start:test-realms' \ | ||
| "$NODE_TEST_REALM_READY" \ | ||
| 'wait' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start dev stack without optional realms (experiments, catalog, homepage, submission)" | ||
| #MISE dir="packages/realm-server" | ||
|
|
||
| READY_PATH="_readiness-check?acceptHeader=application%2Fvnd.api%2Bjson" | ||
| BASE_REALM_READY="http-get://${REALM_BASE_URL#http://}/base/${READY_PATH}" | ||
| NODE_TEST_REALM_READY="http-get://${REALM_TEST_URL#http://}/node-test/${READY_PATH}" | ||
|
|
||
| WAIT_ON_TIMEOUT=900000 \ | ||
| SKIP_EXPERIMENTS=true \ | ||
| SKIP_CATALOG=true \ | ||
| SKIP_BOXEL_HOMEPAGE=true \ | ||
| SKIP_SUBMISSION=true \ | ||
| NODE_NO_WARNINGS=1 \ | ||
| start-server-and-test \ | ||
| 'run-p -ln start:pg start:prerender-dev start:prerender-manager-dev start:matrix start:smtp start:worker-development start:development' \ | ||
| "${BASE_REALM_READY}|http-get://${REALM_BASE_URL#http://}/software-factory/${READY_PATH}|${MATRIX_URL_VAL}|http://localhost:5001|${ICONS_URL}" \ | ||
| 'run-p -ln start:worker-test start:test-realms' \ | ||
| "${NODE_TEST_REALM_READY}" \ | ||
| 'wait' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start dev stack without starting Matrix/SMTP (expects them already running)" | ||
| #MISE dir="packages/realm-server" | ||
|
|
||
| READY_PATH="_readiness-check?acceptHeader=application%2Fvnd.api%2Bjson" | ||
| BASE_REALM_READY="http-get://${REALM_BASE_URL#http://}/base/${READY_PATH}" | ||
| EXPERIMENTS_READY="http-get://${REALM_BASE_URL#http://}/experiments/${READY_PATH}" | ||
| NODE_TEST_REALM_READY="http-get://${REALM_TEST_URL#http://}/node-test/${READY_PATH}" | ||
|
|
||
| WAIT_ON_TIMEOUT=900000 SKIP_BOXEL_HOMEPAGE=true NODE_NO_WARNINGS=1 start-server-and-test \ | ||
| 'run-p start:pg start:prerender-dev start:prerender-manager-dev start:worker-development start:development' \ | ||
| "${BASE_REALM_READY}|${EXPERIMENTS_READY}|${MATRIX_URL_VAL}|http://localhost:5001|${ICONS_URL}" \ | ||
| 'run-p start:worker-test start:test-realms' \ | ||
| "${NODE_TEST_REALM_READY}" \ | ||
| 'wait' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/sh | ||
| #MISE description="Ensure per-environment database exists" | ||
| #MISE depends=["infra:ensure-pg"] | ||
|
|
||
| # In standard mode the database is always 'boxel' — nothing to create. | ||
| [ -z "$BOXEL_ENVIRONMENT" ] && exit 0 | ||
|
|
||
| DB_SUFFIX="${1:-$ENV_SLUG}" | ||
| DB_NAME="boxel_${DB_SUFFIX}" | ||
|
|
||
| echo "Ensuring database '${DB_NAME}' exists…" | ||
|
|
||
| if docker exec boxel-pg psql -U postgres -lqt | cut -d \| -f 1 | grep -qw "$DB_NAME"; then | ||
| echo "Database '${DB_NAME}' already exists." | ||
| else | ||
| docker exec boxel-pg createdb -U postgres "$DB_NAME" | ||
| echo "Created database '${DB_NAME}'." | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/sh | ||
| #MISE description="Ensure PostgreSQL is running and ready" | ||
|
|
||
| # Start the container if needed. Multiple tasks may call this concurrently, | ||
| # so handle the race: docker run can fail if another process already created | ||
| # the container — that's fine, we just ensure it's started. | ||
| if [ -z "$(docker ps -f name=boxel-pg --all --format '{{.Names}}')" ]; then | ||
| echo "Starting new boxel-pg container on port ${PGPORT:-5435}..." | ||
| docker run --name boxel-pg -e POSTGRES_HOST_AUTH_METHOD=trust -p "${PGPORT:-5435}":5432 -d postgres:16.3 >/dev/null 2>&1 || true | ||
| fi | ||
| # Ensure the container is running (handles both the race case and stopped containers) | ||
| docker start boxel-pg >/dev/null 2>&1 || true | ||
|
|
||
| # Wait for readiness | ||
| COUNT=0 | ||
| MAX_ATTEMPTS=10 | ||
|
|
||
| while ! docker exec boxel-pg pg_isready -U postgres >/dev/null 2>&1; do | ||
| if [ $COUNT -eq 0 ]; then | ||
| echo "Waiting for postgres" | ||
| fi | ||
| if [ $COUNT -eq $MAX_ATTEMPTS ]; then | ||
| echo "Failed to detect postgres after $MAX_ATTEMPTS attempts." | ||
| exit 1 | ||
| fi | ||
| COUNT=$((COUNT + 1)) | ||
| printf '.' | ||
| sleep 5 | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/bin/sh | ||
| #MISE description="Ensure Synapse is running and users are registered" | ||
| #MISE dir="packages/matrix" | ||
|
|
||
| pnpm assert-synapse-running | ||
|
|
||
| # In environment mode, register users once per fresh Synapse data dir. | ||
| if [ -n "$BOXEL_ENVIRONMENT" ]; then | ||
| MARKER="./synapse-data-${ENV_SLUG}/.users-registered" | ||
| if [ ! -f "$MARKER" ]; then | ||
| echo "First start for environment — registering users…" | ||
| pnpm register-all && touch "$MARKER" | ||
| else | ||
| echo "Users already registered for this environment, skipping." | ||
| fi | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/bin/sh | ||
| #MISE description="Ensure Traefik is running (env mode only)" | ||
|
|
||
| [ -z "$BOXEL_ENVIRONMENT" ] && exit 0 | ||
|
|
||
| REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" | ||
| sh "$REPO_ROOT/scripts/start-traefik.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start the Matrix admin console (port 8080)" | ||
| #MISE dir="packages/matrix" | ||
|
|
||
| exec ts-node --transpileOnly ./scripts/admin-console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/sh | ||
| #MISE description="Start the Matrix Synapse server" | ||
| #MISE dir="packages/matrix" | ||
|
|
||
| exec sh scripts/start-synapse.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/sh | ||
| #MISE description="Stop the Matrix admin console" | ||
|
|
||
| docker stop synapse-admin && docker rm synapse-admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/sh | ||
| #MISE description="Stop the PostgreSQL docker container" | ||
|
|
||
| docker stop boxel-pg >/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/sh | ||
| #MISE description="Stop the Matrix Synapse server" | ||
| #MISE dir="packages/matrix" | ||
|
|
||
| exec ts-node --transpileOnly ./scripts/synapse.ts stop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/sh | ||
| #MISE description="Wait for prerender manager to be ready" | ||
|
|
||
| URL="${1:-${PRERENDER_MGR_URL}}" | ||
| TRIMMED_URL="${URL%/}/" | ||
| TIMEOUT_SECONDS=1500 | ||
| START_TIME=$(date +%s) | ||
|
|
||
| echo "Waiting for prerender manager at ${TRIMMED_URL}" | ||
|
|
||
| while ! curl -sf "$TRIMMED_URL" >/dev/null 2>&1; do | ||
| CURRENT_TIME=$(date +%s) | ||
| ELAPSED=$((CURRENT_TIME - START_TIME)) | ||
| if [ "$ELAPSED" -ge "$TIMEOUT_SECONDS" ]; then | ||
| echo "Timed out waiting for prerender manager after ${TIMEOUT_SECONDS}s" | ||
| exit 1 | ||
| fi | ||
| sleep 1 | ||
| done | ||
|
|
||
| echo "Prerender manager is ready" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/sh | ||
| # Shared setup for dev and dev-all mise tasks. | ||
| # Sourced (not executed) — sets variables and bootstraps infra. | ||
| # Expects to run with MISE dir=packages/realm-server. | ||
|
|
||
| READY_PATH="_readiness-check?acceptHeader=application%2Fvnd.api%2Bjson" | ||
|
|
||
| # Phase 1 readiness URLs | ||
| BASE_REALM_READY="http-get://${REALM_BASE_URL#http://}/base/${READY_PATH}" | ||
| SKILLS_READY="http-get://${REALM_BASE_URL#http://}/skills/${READY_PATH}" | ||
| PHASE1_URLS="${BASE_REALM_READY}|${SKILLS_READY}" | ||
|
|
||
| if [ -z "${SKIP_CATALOG:-}" ]; then | ||
| PHASE1_URLS="${PHASE1_URLS}|http-get://${REALM_BASE_URL#http://}/catalog/${READY_PATH}" | ||
| fi | ||
| if [ -z "${SKIP_BOXEL_HOMEPAGE:-}" ]; then | ||
| PHASE1_URLS="${PHASE1_URLS}|http-get://${REALM_BASE_URL#http://}/boxel-homepage/${READY_PATH}" | ||
| fi | ||
| if [ -z "${SKIP_EXPERIMENTS:-}" ]; then | ||
| PHASE1_URLS="${PHASE1_URLS}|http-get://${REALM_BASE_URL#http://}/experiments/${READY_PATH}" | ||
| fi | ||
| PHASE1_URLS="${PHASE1_URLS}|http-get://${REALM_BASE_URL#http://}/software-factory/${READY_PATH}" | ||
|
|
||
| PHASE1_URLS="${PHASE1_URLS}|${MATRIX_URL_VAL}|http://localhost:5001|${ICONS_URL}" | ||
|
|
||
| # Phase 2 readiness URL | ||
| NODE_TEST_REALM_READY="http-get://${REALM_TEST_URL#http://}/node-test/${READY_PATH}" | ||
|
|
||
| # In environment mode, bootstrap infra before starting services | ||
| if [ -n "$BOXEL_ENVIRONMENT" ]; then | ||
| ./scripts/start-pg.sh | ||
| echo "Waiting for Postgres to accept connections…" | ||
| until docker exec boxel-pg pg_isready -U postgres >/dev/null 2>&1; do sleep 1; done | ||
| REPO_ROOT="$(cd "../.." && pwd)" | ||
| "$REPO_ROOT/scripts/ensure-branch-db.sh" | ||
| echo "Running database migrations…" | ||
| pnpm migrate | ||
| ./scripts/start-matrix.sh | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.