diff --git a/deploy/portainer/docker-compose.yml b/deploy/portainer/docker-compose.yml index 6fce99e5..a89af335 100644 --- a/deploy/portainer/docker-compose.yml +++ b/deploy/portainer/docker-compose.yml @@ -29,6 +29,11 @@ x-common-env: &common-env MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-} MYSQL_USERNAME: ${MYSQL_USERNAME:-} MYSQL_PASSWORD: ${MYSQL_PASSWORD:-} + REDIS_HOST: ${REDIS_HOST:-r-bp1u741kij7e51i481pd.redis.rds.aliyuncs.com} + REDIS_PORT: ${REDIS_PORT:-6379} + REDIS_DATABASE: ${REDIS_DATABASE:-50} + REDIS_USERNAME: ${REDIS_USERNAME:-} + REDIS_PASSWORD: ${REDIS_PASSWORD:-} services: gb32960-ingest-app: @@ -167,11 +172,6 @@ services: MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-} MYSQL_USERNAME: ${MYSQL_USERNAME:-} MYSQL_PASSWORD: ${MYSQL_PASSWORD:-} - REDIS_HOST: ${REDIS_HOST:-} - REDIS_PORT: ${REDIS_PORT:-6379} - REDIS_DATABASE: ${REDIS_DATABASE:-50} - REDIS_USERNAME: ${REDIS_USERNAME:-} - REDIS_PASSWORD: ${REDIS_PASSWORD:-} ports: - "${VEHICLE_ANALYTICS_HTTP_PORT:-20300}:20300" networks: diff --git a/docs/operations/gb32960-service-split-runbook.md b/docs/operations/gb32960-service-split-runbook.md index a5b87e78..89d3b7c0 100644 --- a/docs/operations/gb32960-service-split-runbook.md +++ b/docs/operations/gb32960-service-split-runbook.md @@ -40,6 +40,8 @@ Authorization failures are rejected before the Kafka durability boundary and can - Java 25 and Maven available on PATH. - Local Kafka reachable at `127.0.0.1:9092`, plus Kafka CLI tools such as `kafka-topics` and optionally `kafka-console-consumer`. +- Production GB32960/JT808 session state uses Redis by default. For local + one-process smoke tests without Redis, set `SESSION_STORE=memory` explicitly. - No repository-local Kafka bootstrap script or compose file was found during Task 8 verification on 2026-06-23. If your shell needs an explicit JDK: @@ -54,12 +56,13 @@ export PATH="$JAVA_HOME/bin:/opt/homebrew/bin:$PATH" From the repository root: ```bash -mvn -pl :gb32960-ingest-app,:vehicle-history-app,:vehicle-analytics-app -am package -Dmaven.test.skip=true +mvn -pl :gb32960-ingest-app,:jt808-ingest-app,:vehicle-history-app,:vehicle-analytics-app -am package -Dmaven.test.skip=true ``` Expected result: `BUILD SUCCESS` and these runnable jars: - `modules/apps/gb32960-ingest-app/target/gb32960-ingest-app.jar` +- `modules/apps/jt808-ingest-app/target/jt808-ingest-app.jar` - `modules/apps/vehicle-history-app/target/vehicle-history-app.jar` - `modules/apps/vehicle-analytics-app/target/vehicle-analytics-app.jar` @@ -71,12 +74,15 @@ Run these only after Kafka is reachable at `127.0.0.1:9092`: kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.raw.gb32960.v1 --partitions 12 --replication-factor 1 kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.event.gb32960.v1 --partitions 12 --replication-factor 1 kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.dlq.gb32960.v1 --partitions 3 --replication-factor 1 +kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.raw.jt808.v1 --partitions 12 --replication-factor 1 +kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.event.jt808.v1 --partitions 12 --replication-factor 1 +kafka-topics --bootstrap-server 127.0.0.1:9092 --create --if-not-exists --topic vehicle.dlq.jt808.v1 --partitions 3 --replication-factor 1 ``` Optional sanity check: ```bash -kafka-topics --bootstrap-server 127.0.0.1:9092 --list | grep -E 'vehicle\.(raw|event|dlq)\.gb32960\.v1' +kafka-topics --bootstrap-server 127.0.0.1:9092 --list | grep -E 'vehicle\.(raw|event|dlq)\.(gb32960|jt808)\.v1' ``` ## Start Split Services Locally @@ -89,10 +95,22 @@ GB32960 ingest: KAFKA_BROKERS=127.0.0.1:9092 \ GB32960_PORT=32960 \ HTTP_PORT=20100 \ +SESSION_STORE=memory \ java --sun-misc-unsafe-memory-access=allow \ -jar modules/apps/gb32960-ingest-app/target/gb32960-ingest-app.jar ``` +JT808 ingest: + +```bash +KAFKA_BROKERS=127.0.0.1:9092 \ +JT808_PORT=808 \ +HTTP_PORT=20400 \ +SESSION_STORE=memory \ +java --sun-misc-unsafe-memory-access=allow \ + -jar modules/apps/jt808-ingest-app/target/jt808-ingest-app.jar +``` + Vehicle history: ```bash @@ -120,6 +138,7 @@ To enable the latest-state API in analytics, also set `VEHICLE_STATE_ENABLED=tru ```bash curl -sS http://127.0.0.1:20100/actuator/health +curl -sS http://127.0.0.1:20400/actuator/health curl -sS http://127.0.0.1:20200/actuator/health curl -sS http://127.0.0.1:20300/actuator/health ``` diff --git a/modules/apps/gb32960-ingest-app/src/main/resources/application.yml b/modules/apps/gb32960-ingest-app/src/main/resources/application.yml index 700a3bd2..dd0301b6 100644 --- a/modules/apps/gb32960-ingest-app/src/main/resources/application.yml +++ b/modules/apps/gb32960-ingest-app/src/main/resources/application.yml @@ -17,6 +17,13 @@ spring: threads: virtual: enabled: true + data: + redis: + host: ${REDIS_HOST:127.0.0.1} + port: ${REDIS_PORT:6379} + username: ${REDIS_USERNAME:} + password: ${REDIS_PASSWORD:} + database: ${REDIS_DATABASE:50} server: port: ${HTTP_PORT:20100} diff --git a/modules/apps/gb32960-ingest-app/src/test/java/com/lingniu/ingest/gb32960app/Gb32960IngestAppDefaultsTest.java b/modules/apps/gb32960-ingest-app/src/test/java/com/lingniu/ingest/gb32960app/Gb32960IngestAppDefaultsTest.java index 86ff593a..c86e40c1 100644 --- a/modules/apps/gb32960-ingest-app/src/test/java/com/lingniu/ingest/gb32960app/Gb32960IngestAppDefaultsTest.java +++ b/modules/apps/gb32960-ingest-app/src/test/java/com/lingniu/ingest/gb32960app/Gb32960IngestAppDefaultsTest.java @@ -20,6 +20,9 @@ class Gb32960IngestAppDefaultsTest { "spring.config.import[0]", "optional:nacos:${spring.application.name}.${NACOS_CONFIG_FILE_EXTENSION:yml}?group=${NACOS_GROUP:DEFAULT_GROUP}&refreshEnabled=${NACOS_REFRESH_ENABLED:true}") .containsEntry("spring.cloud.nacos.config.server-addr", "${NACOS_SERVER_ADDR:127.0.0.1:8848}") + .containsEntry("spring.data.redis.host", "${REDIS_HOST:127.0.0.1}") + .containsEntry("spring.data.redis.port", "${REDIS_PORT:6379}") + .containsEntry("spring.data.redis.database", "${REDIS_DATABASE:50}") .containsEntry("lingniu.ingest.gb32960.enabled", true) .containsEntry("lingniu.ingest.gb32960.server.enabled", true) .containsEntry("lingniu.ingest.gb32960.port", "${GB32960_PORT:32960}") diff --git a/modules/apps/jt808-ingest-app/src/main/resources/application.yml b/modules/apps/jt808-ingest-app/src/main/resources/application.yml index 7d6f5832..b1db5729 100644 --- a/modules/apps/jt808-ingest-app/src/main/resources/application.yml +++ b/modules/apps/jt808-ingest-app/src/main/resources/application.yml @@ -17,6 +17,13 @@ spring: threads: virtual: enabled: true + data: + redis: + host: ${REDIS_HOST:127.0.0.1} + port: ${REDIS_PORT:6379} + username: ${REDIS_USERNAME:} + password: ${REDIS_PASSWORD:} + database: ${REDIS_DATABASE:50} server: port: ${HTTP_PORT:20400} diff --git a/modules/apps/jt808-ingest-app/src/test/java/com/lingniu/ingest/jt808app/Jt808IngestAppDefaultsTest.java b/modules/apps/jt808-ingest-app/src/test/java/com/lingniu/ingest/jt808app/Jt808IngestAppDefaultsTest.java index 7b833f64..4f888099 100644 --- a/modules/apps/jt808-ingest-app/src/test/java/com/lingniu/ingest/jt808app/Jt808IngestAppDefaultsTest.java +++ b/modules/apps/jt808-ingest-app/src/test/java/com/lingniu/ingest/jt808app/Jt808IngestAppDefaultsTest.java @@ -20,6 +20,9 @@ class Jt808IngestAppDefaultsTest { "spring.config.import[0]", "optional:nacos:${spring.application.name}.${NACOS_CONFIG_FILE_EXTENSION:yml}?group=${NACOS_GROUP:DEFAULT_GROUP}&refreshEnabled=${NACOS_REFRESH_ENABLED:true}") .containsEntry("spring.cloud.nacos.config.server-addr", "${NACOS_SERVER_ADDR:127.0.0.1:8848}") + .containsEntry("spring.data.redis.host", "${REDIS_HOST:127.0.0.1}") + .containsEntry("spring.data.redis.port", "${REDIS_PORT:6379}") + .containsEntry("spring.data.redis.database", "${REDIS_DATABASE:50}") .containsEntry("server.port", "${HTTP_PORT:20400}") .containsEntry("lingniu.ingest.jt808.enabled", true) .containsEntry("lingniu.ingest.jt808.port", "${JT808_PORT:808}")