58 lines
2.1 KiB
Markdown
58 lines
2.1 KiB
Markdown
# Deployment
|
|
|
|
## Build
|
|
|
|
Run from repository root:
|
|
|
|
```bash
|
|
cd vehicle-data-platform
|
|
pnpm --dir apps/web install
|
|
pnpm run web:build
|
|
cd apps/api
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o ../../dist/platform-api ./cmd/platform-api
|
|
```
|
|
|
|
## ECS Paths
|
|
|
|
```text
|
|
/opt/lingniu-vehicle-platform/current
|
|
/opt/lingniu-vehicle-platform/releases
|
|
/opt/lingniu-vehicle-platform/env/platform.env
|
|
```
|
|
|
|
## Environment
|
|
|
|
```text
|
|
HTTP_ADDR=:20300
|
|
STATIC_DIR=/opt/lingniu-vehicle-platform/current/web
|
|
MYSQL_DSN=lingniu_vehicle:***@tcp(rm-bp179zbv481rnw3e2.mysql.rds.aliyuncs.com:3306)/lingniu_vehicle_data?parseTime=true&loc=Local
|
|
REDIS_ADDR=r-bp1u741kij7e51i481.redis.rds.aliyuncs.com:6379
|
|
REDIS_USERNAME=lingniu_vehicle
|
|
REDIS_PASSWORD=***
|
|
REDIS_DB=50
|
|
TDENGINE_DRIVER=taosWS
|
|
TDENGINE_DSN=root:***@ws(172.17.111.57:6041)/
|
|
TDENGINE_DATABASE=lingniu_vehicle_ts
|
|
CAPACITY_CHECK_BIN=/opt/lingniu-go-native/current/capacity-check
|
|
AUTH_TOKEN=***
|
|
REQUEST_TIMEOUT_MS=5000
|
|
AMAP_WEB_JS_KEY=***
|
|
AMAP_SECURITY_JS_CODE=***
|
|
AMAP_SECURITY_SERVICE_HOST=/_AMapService
|
|
# Optional reserved server-side key for AMap REST/track services.
|
|
AMAP_API_KEY=***
|
|
PLATFORM_RELEASE=platform-YYYYMMDDHHMMSS
|
|
```
|
|
|
|
`AMAP_WEB_JS_KEY` is served to the browser through `/app-config.js` so the same static build can be reused across environments. For production, set both `AMAP_SECURITY_JS_CODE` and `AMAP_SECURITY_SERVICE_HOST=/_AMapService`; the API service keeps the security code on the server and proxies AMap requests with `jscode` appended. Only omit `AMAP_SECURITY_SERVICE_HOST` for controlled debugging where exposing `AMAP_SECURITY_JS_CODE` to the browser is acceptable. `AMAP_API_KEY` is reserved for backend-only AMap service APIs such as geocoding, route planning, geofence, or trajectory service integration.
|
|
|
|
`PLATFORM_RELEASE` is surfaced by `/api/ops/health.runtime.platformRelease` so operators can confirm which ECS release is currently active after a deployment.
|
|
|
|
## Health
|
|
|
|
```bash
|
|
curl -fsS http://127.0.0.1:20300/api/ops/health
|
|
curl -fsS 'http://127.0.0.1:20300/api/vehicles?limit=5'
|
|
curl -fsS http://127.0.0.1:20300/app-config.js
|
|
```
|