Deploy builds the develop engine, installing its toolchain once
The app host had no Rust toolchain, so Revelar showed "engine missing". The deploy now installs rustup, the wasm32 target and the pinned wasm-bindgen CLI in the deploy user's home the first time, then builds the engine. Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
This commit is contained in:
1 parent
adb557290c
commit
0cd5119581
1 file changed
+23
-4
+23
-4
@@ -56,15 +56,34 @@ deploy_api() {
|
||||
wait_for_version "http://127.0.0.1:${API_PORT}/health" "$sha"
|
||||
}
|
||||
|
||||
# Rust + wasm32 target + the wasm-bindgen CLI the engine pins, in the deploy user's home (no root, no system
|
||||
# packages). Idempotent: after the first run it only checks versions.
|
||||
ensure_wasm_toolchain() {
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
log "installing the Rust toolchain for the develop engine (once)"
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path >/dev/null || return 1
|
||||
fi
|
||||
rustup target list --installed 2>/dev/null | grep -qx wasm32-unknown-unknown || rustup target add wasm32-unknown-unknown || return 1
|
||||
local want have
|
||||
want="$(sed -n 's/^wasm-bindgen = "=\(.*\)"/\1/p' engine/wasm/Cargo.toml)"
|
||||
have="$(wasm-bindgen --version 2>/dev/null | awk '{print $2}')"
|
||||
if [[ "$have" != "$want" ]]; then
|
||||
log "installing wasm-bindgen-cli $want (once)"
|
||||
cargo install wasm-bindgen-cli --version "$want" --locked >/dev/null || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
deploy_app() {
|
||||
local sha="$1" release="$WEB_ROOT/releases/$1"
|
||||
node_install
|
||||
rm -rf apps/app/dist # never publish a stale build
|
||||
# The develop module's engine (WASM). Without the Rust toolchain the app still deploys; Revelar says the engine is missing.
|
||||
if command -v cargo >/dev/null 2>&1 && command -v wasm-bindgen >/dev/null 2>&1; then
|
||||
infra/engine/build-wasm.sh
|
||||
# The develop module's engine (WASM). The toolchain installs itself the first time (a few minutes, once). If that
|
||||
# fails, the app still deploys and Revelar says the engine is missing.
|
||||
if ensure_wasm_toolchain; then
|
||||
infra/engine/build-wasm.sh || log "WARNING: the develop engine did not build"
|
||||
else
|
||||
log "WARNING: cargo/wasm-bindgen not found: the develop engine is not rebuilt"
|
||||
log "WARNING: no Rust/wasm toolchain (needs curl and a C compiler): the develop engine is not built"
|
||||
fi
|
||||
VITE_APP_VERSION="$sha" pnpm --filter "@photoreport/app..." build
|
||||
mkdir -p "$release"
|
||||
|
||||
Reference in new issue
Block a user