66 lines
1.2 KiB
Bash
Executable File
66 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
LOCAL_DIR="$ROOT_DIR"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
用法:
|
|
./deploy.sh start [--skip-build] [--infra-only] [--rebuild]
|
|
./deploy.sh build [service...]
|
|
./deploy.sh restart [--rebuild] <service>
|
|
./deploy.sh check
|
|
./deploy.sh publish-nacos
|
|
|
|
说明:
|
|
当前仓库只保留本地部署和本地联调能力。
|
|
如果第一个参数是 `--skip-build` 或 `--infra-only`,会默认转给 `start`。
|
|
EOF
|
|
}
|
|
|
|
run_local_script() {
|
|
local script_name="$1"
|
|
shift
|
|
exec "$LOCAL_DIR/$script_name" "$@"
|
|
}
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
case "$1" in
|
|
--skip-build|--infra-only)
|
|
run_local_script start_local_services.sh "$@"
|
|
;;
|
|
start)
|
|
shift
|
|
run_local_script start_local_services.sh "$@"
|
|
;;
|
|
build)
|
|
shift
|
|
run_local_script build_local_backend.sh "$@"
|
|
;;
|
|
restart)
|
|
shift
|
|
run_local_script restart_local_service.sh "$@"
|
|
;;
|
|
check)
|
|
shift
|
|
run_local_script check_local_services.sh "$@"
|
|
;;
|
|
publish-nacos)
|
|
shift
|
|
run_local_script publish_local_nacos_configs.sh "$@"
|
|
;;
|
|
-h|--help|help)
|
|
usage
|
|
;;
|
|
*)
|
|
echo "unknown command: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|