refactor: share portainer ingress env
This commit is contained in:
@@ -30,6 +30,19 @@ x-common-env: &common-env
|
||||
MYSQL_USERNAME: ${MYSQL_USERNAME:-}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-}
|
||||
|
||||
x-identity-mysql-env: &identity-mysql-env
|
||||
VEHICLE_IDENTITY_STORE: ${VEHICLE_IDENTITY_STORE:-mysql}
|
||||
VEHICLE_IDENTITY_MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-}
|
||||
VEHICLE_IDENTITY_MYSQL_USERNAME: ${MYSQL_USERNAME:-}
|
||||
VEHICLE_IDENTITY_MYSQL_PASSWORD: ${MYSQL_PASSWORD:-}
|
||||
|
||||
x-redis-session-env: &redis-session-env
|
||||
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:
|
||||
image: crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com/oneos/gb32960-ingest-app:${LINGNIU_IMAGE_VERSION:?set LINGNIU_IMAGE_VERSION}
|
||||
@@ -37,7 +50,10 @@ services:
|
||||
restart: unless-stopped
|
||||
mem_limit: ${GB32960_MEM_LIMIT:-768m}
|
||||
environment:
|
||||
<<: *common-env
|
||||
<<:
|
||||
- *common-env
|
||||
- *identity-mysql-env
|
||||
- *redis-session-env
|
||||
HTTP_PORT: 20100
|
||||
GB32960_PORT: 32960
|
||||
KAFKA_CONSUMER_ENABLED: "false"
|
||||
@@ -47,15 +63,6 @@ services:
|
||||
GB32960_PLATFORM_PWD_HYUNDAI: ${GB32960_PLATFORM_PWD_HYUNDAI:-}
|
||||
GB32960_PLATFORM_IP_HYUNDAI: ${GB32960_PLATFORM_IP_HYUNDAI:-}
|
||||
GB32960_TLS_ENABLED: ${GB32960_TLS_ENABLED:-false}
|
||||
VEHICLE_IDENTITY_STORE: ${VEHICLE_IDENTITY_STORE:-mysql}
|
||||
VEHICLE_IDENTITY_MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-}
|
||||
VEHICLE_IDENTITY_MYSQL_USERNAME: ${MYSQL_USERNAME:-}
|
||||
VEHICLE_IDENTITY_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:-}
|
||||
ports:
|
||||
- "${GB32960_HTTP_PORT:-20100}:20100"
|
||||
- "${GB32960_TCP_PORT:-32960}:32960"
|
||||
@@ -70,20 +77,14 @@ services:
|
||||
restart: unless-stopped
|
||||
mem_limit: ${JT808_MEM_LIMIT:-768m}
|
||||
environment:
|
||||
<<: *common-env
|
||||
<<:
|
||||
- *common-env
|
||||
- *identity-mysql-env
|
||||
- *redis-session-env
|
||||
HTTP_PORT: 20400
|
||||
JT808_PORT: 808
|
||||
KAFKA_CONSUMER_ENABLED: "false"
|
||||
KAFKA_NODE_ID: ${KAFKA_NODE_ID_JT808:-jt808-ingest-portainer}
|
||||
VEHICLE_IDENTITY_STORE: ${VEHICLE_IDENTITY_STORE:-mysql}
|
||||
VEHICLE_IDENTITY_MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-}
|
||||
VEHICLE_IDENTITY_MYSQL_USERNAME: ${MYSQL_USERNAME:-}
|
||||
VEHICLE_IDENTITY_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:-}
|
||||
ports:
|
||||
- "${JT808_HTTP_PORT:-20400}:20400"
|
||||
- "${JT808_TCP_PORT:-808}:808"
|
||||
@@ -98,16 +99,14 @@ services:
|
||||
restart: unless-stopped
|
||||
mem_limit: ${YUTONG_MQTT_MEM_LIMIT:-512m}
|
||||
environment:
|
||||
<<: *common-env
|
||||
<<:
|
||||
- *common-env
|
||||
- *identity-mysql-env
|
||||
HTTP_PORT: 20500
|
||||
YUTONG_MQTT_ENABLED: ${YUTONG_MQTT_ENABLED:-false}
|
||||
YUTONG_MQTT_AUTO_STARTUP: ${YUTONG_MQTT_AUTO_STARTUP:-true}
|
||||
KAFKA_CONSUMER_ENABLED: "false"
|
||||
KAFKA_NODE_ID: ${KAFKA_NODE_ID_MQTT:-yutong-mqtt-portainer}
|
||||
VEHICLE_IDENTITY_STORE: ${VEHICLE_IDENTITY_STORE:-mysql}
|
||||
VEHICLE_IDENTITY_MYSQL_JDBC_URL: ${MYSQL_JDBC_URL:-}
|
||||
VEHICLE_IDENTITY_MYSQL_USERNAME: ${MYSQL_USERNAME:-}
|
||||
VEHICLE_IDENTITY_MYSQL_PASSWORD: ${MYSQL_PASSWORD:-}
|
||||
YUTONG_MQTT_ENDPOINT_NAME: ${YUTONG_MQTT_ENDPOINT_NAME:-yutong}
|
||||
YUTONG_MQTT_URI: ${YUTONG_MQTT_URI:-}
|
||||
YUTONG_MQTT_TOPIC: "${YUTONG_MQTT_TOPIC:-#}"
|
||||
|
||||
@@ -150,6 +150,37 @@ class PortainerComposeResourceLimitsTest {
|
||||
.doesNotContain("REDIS_PASSWORD");
|
||||
}
|
||||
|
||||
@Test
|
||||
void ingestAppsReuseSharedIdentityAndRedisEnvironmentAnchors() throws IOException {
|
||||
String compose = Files.readString(repositoryRoot().resolve("deploy/portainer/docker-compose.yml"));
|
||||
String gb32960Service = serviceBlock(compose, "gb32960-ingest-app");
|
||||
String jt808Service = serviceBlock(compose, "jt808-ingest-app");
|
||||
String mqttService = serviceBlock(compose, "yutong-mqtt-app");
|
||||
|
||||
assertThat(compose)
|
||||
.contains("x-identity-mysql-env: &identity-mysql-env")
|
||||
.contains("x-redis-session-env: &redis-session-env");
|
||||
assertThat(gb32960Service)
|
||||
.contains("- *identity-mysql-env")
|
||||
.contains("- *redis-session-env");
|
||||
assertThat(jt808Service)
|
||||
.contains("- *identity-mysql-env")
|
||||
.contains("- *redis-session-env");
|
||||
assertThat(mqttService)
|
||||
.contains("- *identity-mysql-env")
|
||||
.doesNotContain("- *redis-session-env");
|
||||
|
||||
assertThat(gb32960Service + jt808Service + mqttService)
|
||||
.doesNotContain("VEHICLE_IDENTITY_MYSQL_JDBC_URL")
|
||||
.doesNotContain("VEHICLE_IDENTITY_MYSQL_USERNAME")
|
||||
.doesNotContain("VEHICLE_IDENTITY_MYSQL_PASSWORD")
|
||||
.doesNotContain("REDIS_HOST")
|
||||
.doesNotContain("REDIS_PORT")
|
||||
.doesNotContain("REDIS_DATABASE")
|
||||
.doesNotContain("REDIS_USERNAME")
|
||||
.doesNotContain("REDIS_PASSWORD");
|
||||
}
|
||||
|
||||
@Test
|
||||
void moduleDataFlowShowsSplitProductionAppsInsteadOfDeletedBootstrapAll() throws IOException {
|
||||
String moduleDataFlow = Files.readString(repositoryRoot().resolve("docs/module-data-flow.html"));
|
||||
@@ -202,7 +233,10 @@ class PortainerComposeResourceLimitsTest {
|
||||
if (start < 0) {
|
||||
throw new IllegalArgumentException("common env block not found");
|
||||
}
|
||||
int end = compose.indexOf("\nservices:\n", start);
|
||||
int end = compose.indexOf("\nx-identity-mysql-env:", start);
|
||||
if (end < 0) {
|
||||
end = compose.indexOf("\nservices:\n", start);
|
||||
}
|
||||
if (end < 0) {
|
||||
throw new IllegalArgumentException("services block not found");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user