deploy: add launchctl templates for active apps
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
# macOS launchctl 本机部署模板
|
||||
|
||||
本目录用于把本机 32960/JT808/history 三个服务的启动方式仓库化。模板面向当前生产验证链路:
|
||||
本目录用于把本机生产验证服务的启动方式仓库化。模板面向当前生产验证链路:
|
||||
|
||||
- `gb32960-ingest-app`: TCP `32960`,HTTP `20100`
|
||||
- `jt808-ingest-app`: TCP `808`,HTTP `20400`
|
||||
- `yutong-mqtt-app`: HTTP `20500`
|
||||
- `vehicle-history-app`: HTTP `20200`
|
||||
- `vehicle-analytics-app`: HTTP `20300`
|
||||
|
||||
`vehicle-history-app` 的热历史查询只依赖 Kafka 与 TDengine:RAW 帧的 `parsedJson`、`metadataJson`、`rawUri` 已进入 TDengine `raw_frames`。GB32960/JT808 接入服务可以继续保留 `SINK_ARCHIVE_PATH` 作为原始 `.bin` 冷备,history 本机模板不再要求共享 archive root。
|
||||
|
||||
@@ -30,11 +32,19 @@ export VEHICLE_IDENTITY_MYSQL_JDBC_URL='jdbc:mysql://<mysql-host>:3306/vehicle_i
|
||||
export VEHICLE_IDENTITY_MYSQL_USERNAME='<mysql-user>'
|
||||
export VEHICLE_IDENTITY_MYSQL_PASSWORD='<mysql-password>'
|
||||
export VEHICLE_IDENTITY_MYSQL_REFRESH_INTERVAL='60s'
|
||||
export MYSQL_JDBC_URL="$VEHICLE_IDENTITY_MYSQL_JDBC_URL"
|
||||
export MYSQL_USERNAME="$VEHICLE_IDENTITY_MYSQL_USERNAME"
|
||||
export MYSQL_PASSWORD="$VEHICLE_IDENTITY_MYSQL_PASSWORD"
|
||||
export YUTONG_MQTT_ENABLED='false'
|
||||
export YUTONG_MQTT_URI=''
|
||||
export YUTONG_MQTT_TOPIC='#'
|
||||
export YUTONG_MQTT_USERNAME=''
|
||||
export YUTONG_MQTT_PASSWORD=''
|
||||
|
||||
mkdir -p "$HOME/Library/LaunchAgents" "$PROJECT_ROOT/data"
|
||||
mkdir -p /tmp/lingniu-gb32960-live /tmp/lingniu-jt808-live /tmp/lingniu-history-live
|
||||
mkdir -p /tmp/lingniu-gb32960-live /tmp/lingniu-jt808-live /tmp/lingniu-yutong-mqtt-live /tmp/lingniu-vehicle-history-live /tmp/lingniu-vehicle-analytics-live
|
||||
|
||||
for service in gb32960 jt808 vehicle-history; do
|
||||
for service in gb32960 jt808 yutong-mqtt vehicle-history vehicle-analytics; do
|
||||
sed \
|
||||
-e "s#__PROJECT_ROOT__#$PROJECT_ROOT#g" \
|
||||
-e "s#__JAVA_BIN__#$JAVA_BIN#g" \
|
||||
@@ -46,6 +56,14 @@ for service in gb32960 jt808 vehicle-history; do
|
||||
-e "s#__VEHICLE_IDENTITY_MYSQL_USERNAME__#$VEHICLE_IDENTITY_MYSQL_USERNAME#g" \
|
||||
-e "s#__VEHICLE_IDENTITY_MYSQL_PASSWORD__#$VEHICLE_IDENTITY_MYSQL_PASSWORD#g" \
|
||||
-e "s#__VEHICLE_IDENTITY_MYSQL_REFRESH_INTERVAL__#$VEHICLE_IDENTITY_MYSQL_REFRESH_INTERVAL#g" \
|
||||
-e "s#__MYSQL_JDBC_URL__#$MYSQL_JDBC_URL#g" \
|
||||
-e "s#__MYSQL_USERNAME__#$MYSQL_USERNAME#g" \
|
||||
-e "s#__MYSQL_PASSWORD__#$MYSQL_PASSWORD#g" \
|
||||
-e "s#__YUTONG_MQTT_ENABLED__#$YUTONG_MQTT_ENABLED#g" \
|
||||
-e "s#__YUTONG_MQTT_URI__#$YUTONG_MQTT_URI#g" \
|
||||
-e "s#__YUTONG_MQTT_TOPIC__#$YUTONG_MQTT_TOPIC#g" \
|
||||
-e "s#__YUTONG_MQTT_USERNAME__#$YUTONG_MQTT_USERNAME#g" \
|
||||
-e "s#__YUTONG_MQTT_PASSWORD__#$YUTONG_MQTT_PASSWORD#g" \
|
||||
"deploy/local/launchctl/com.lingniu.${service}.plist.template" \
|
||||
> "$HOME/Library/LaunchAgents/com.lingniu.${service}.plist"
|
||||
done
|
||||
@@ -59,6 +77,8 @@ history 消费者会按协议和 raw/event 自动拆分 consumer group。设置
|
||||
- `vehicle-history-live-gb32960-raw`
|
||||
- `vehicle-history-live-jt808-event`
|
||||
- `vehicle-history-live-jt808-raw`
|
||||
- `vehicle-history-live-yutong-mqtt-event`
|
||||
- `vehicle-history-live-yutong-mqtt-raw`
|
||||
|
||||
本地模板与 ECS 生产口径一致,身份绑定只使用 MySQL。启动前必须提供 `VEHICLE_IDENTITY_MYSQL_*` 连接参数;服务会自动创建 `vehicle_identity_binding` 和 `vehicle_identity_binding_registration` 两张表:前者只保存 `plate`、`vin`,后者保存注册字段;服务按刷新周期用注册表里的车牌关联 VIN,后续 raw/event 会带真实 VIN。
|
||||
|
||||
@@ -67,9 +87,11 @@ history 消费者会按协议和 raw/event 自动拆分 consumer group。设置
|
||||
```bash
|
||||
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.gb32960.plist"
|
||||
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.jt808.plist"
|
||||
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.yutong-mqtt.plist"
|
||||
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.vehicle-history.plist"
|
||||
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.vehicle-analytics.plist"
|
||||
|
||||
launchctl list | rg 'com.lingniu.(gb32960|jt808|vehicle-history)'
|
||||
launchctl list | rg 'com.lingniu.(gb32960|jt808|yutong-mqtt|vehicle-history|vehicle-analytics)'
|
||||
```
|
||||
|
||||
替换 jar 前先停止服务,避免 KeepAlive 在 jar 拷贝中途拉起半包:
|
||||
@@ -77,7 +99,9 @@ launchctl list | rg 'com.lingniu.(gb32960|jt808|vehicle-history)'
|
||||
```bash
|
||||
launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.gb32960.plist" || true
|
||||
launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.jt808.plist" || true
|
||||
launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.yutong-mqtt.plist" || true
|
||||
launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.vehicle-history.plist" || true
|
||||
launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.lingniu.vehicle-analytics.plist" || true
|
||||
```
|
||||
|
||||
## 验证地址
|
||||
@@ -89,13 +113,21 @@ curl -sS http://127.0.0.1:20100/actuator/health/readiness
|
||||
curl -sS http://127.0.0.1:20400/actuator/health
|
||||
curl -sS http://127.0.0.1:20400/actuator/health/liveness
|
||||
curl -sS http://127.0.0.1:20400/actuator/health/readiness
|
||||
curl -sS http://127.0.0.1:20500/actuator/health
|
||||
curl -sS http://127.0.0.1:20500/actuator/health/liveness
|
||||
curl -sS http://127.0.0.1:20500/actuator/health/readiness
|
||||
curl -sS http://127.0.0.1:20200/actuator/health
|
||||
curl -sS http://127.0.0.1:20200/actuator/health/liveness
|
||||
curl -sS http://127.0.0.1:20200/actuator/health/readiness
|
||||
curl -sS http://127.0.0.1:20300/actuator/health
|
||||
curl -sS http://127.0.0.1:20300/actuator/health/liveness
|
||||
curl -sS http://127.0.0.1:20300/actuator/health/readiness
|
||||
```
|
||||
|
||||
Swagger:
|
||||
|
||||
- GB32960 ingest: `http://127.0.0.1:20100/swagger-ui/index.html`
|
||||
- JT808 ingest: `http://127.0.0.1:20400/swagger-ui/index.html`
|
||||
- Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html`
|
||||
- History query: `http://127.0.0.1:20200/swagger-ui/index.html`
|
||||
- Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html`
|
||||
|
||||
Reference in New Issue
Block a user