29 lines
853 B
Bash
29 lines
853 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||
|
|
cd "$ROOT"
|
||
|
|
|
||
|
|
HOST="${MEMIND_PROD_HOST:-john@58.38.22.103}"
|
||
|
|
REMOTE_ROOT="${MEMIND_PROD_ROOT:-/Users/john/Project/Memind}"
|
||
|
|
BUNDLE=".runtime/portal/wechat-mp.bundle.mjs"
|
||
|
|
|
||
|
|
echo "[deploy-wechat-mp] build bundle"
|
||
|
|
node scripts/build-wechat-mp-runtime.mjs
|
||
|
|
|
||
|
|
if [[ ! -f "${BUNDLE}" ]]; then
|
||
|
|
echo "missing bundle: ${BUNDLE}" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "[deploy-wechat-mp] upload ${BUNDLE} -> ${HOST}:${REMOTE_ROOT}/wechat-mp.bundle.mjs"
|
||
|
|
scp "${BUNDLE}" "${HOST}:${REMOTE_ROOT}/wechat-mp.bundle.mjs"
|
||
|
|
|
||
|
|
echo "[deploy-wechat-mp] restart portal"
|
||
|
|
ssh "${HOST}" 'launchctl kickstart -k "gui/$(id -u)/cn.tkmind.memind-portal"'
|
||
|
|
|
||
|
|
echo "[deploy-wechat-mp] health check"
|
||
|
|
ssh "${HOST}" 'curl -s -o /dev/null -w "portal=%{http_code}\n" http://127.0.0.1:8081/api/status'
|
||
|
|
|
||
|
|
echo "[deploy-wechat-mp] done"
|