Files
Vijay Budhram c556dcb4b1 feat(dev): speed up local stack startup with a fast build path
Because:
 - `yarn start mza` was slow: the start tasks pulled the full production
   build (including tsc) on every boot, though dev servers compile from
   source at runtime.

This commit:
 - Adds a `build-fast` Nx target that skips `build-ts` for app services
   while still building dist-loaded libs, and routes `yarn start mza` and
   `yarn restart mza` through it via FXA_BUILD_TARGET=build-fast.
 - Drops `build` from the `start`/`restart` target dependencies; the build
   now runs explicitly in pm2-all.sh (full build by default), so `yarn
   start` still does a full build and CI, which calls `build` directly, is
   unaffected.
 - Hardens local startup: Docker daemon preflight, labeled URL checks with
   curl timeouts, a non-fatal redis readiness gate, and a db-patcher
   expected-count derived from the migrations layout.
 - Parallelizes the fxa-shared ESM/CJS tsc build to cut critical-path time.
 - Fixes the l10n-gettext-extract workflow to read .nvmrc from the
   checked-out fxa-code/ path.
2026-06-12 12:54:12 -04:00

29 lines
933 B
Bash
Executable File

#!/bin/bash
# Wait for the redis container to accept connections before app services boot,
# so a cold start doesn't produce a burst of ioredis connection errors.
# Non-fatal: ioredis reconnects on its own, so a slow redis only delays steady
# state rather than failing the stack.
# Authenticate when REDIS_PASSWORD is set (redis.sh starts redis with
# --requirepass); otherwise an authed redis replies NOAUTH and we'd wait the
# full timeout and warn falsely.
AUTH_ARGS=()
if [ -n "${REDIS_PASSWORD:-}" ]; then
AUTH_ARGS=(--no-auth-warning -a "$REDIS_PASSWORD")
fi
RETRY=30
echo -e "\nChecking for redis..."
for i in $(seq 1 "$RETRY"); do
REPLY=$(docker exec redis-server redis-cli "${AUTH_ARGS[@]}" ping 2>/dev/null)
if echo "$REPLY" | grep -q PONG; then
echo "✅ redis responded in ${i}s"
exit 0
fi
sleep 1
done
echo "⚠️ redis did not respond after ${RETRY}s; continuing (services will retry)."
exit 0