Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Unit Tests (vitest)
permissions:
contents: read

on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/unit_tests.yaml'
- 'lib/**'
- 'test/unit/**'
- 'vitest.config.ts'
- 'tsconfig*.json'
- 'package.json'
- 'package-lock.json'

jobs:
unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm run test:unit
52 changes: 10 additions & 42 deletions docker-compose-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,7 @@ services:
container_name: devicehub-processor
env_file:
- scripts/variables.env
command: stf processor --name processor --connect-app-dealer tcp://devicehub-triproxy-app:7160 --connect-dev-dealer tcp://devicehub-triproxy-dev:7260
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-reaper:
build: .
image: vkcom/devicehub
container_name: devicehub-reaper
env_file:
- scripts/variables.env
command: stf reaper --name reaper001 --connect-push tcp://devicehub-triproxy-dev:7270 --connect-sub tcp://devicehub-triproxy-dev:7250 --heartbeat-timeout 30000
command: stf processor --name processor --connect-proxy tcp://devicehub-proxy:7110 --bind-router "tcp://*:7160" --heartbeat-timeout 30000
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand Down Expand Up @@ -160,41 +147,22 @@ services:
container_name: devicehub-storage-temp
env_file:
- scripts/variables.env
command: stf storage-temp --port 3000 --save-dir /tmp --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-triproxy-app:
build: .
image: vkcom/devicehub
container_name: devicehub-triproxy-app
env_file:
- scripts/variables.env
command: stf triproxy app001 --bind-pub "tcp://*:7150" --bind-dealer "tcp://*:7160" --bind-pull "tcp://*:7170"
ports:
- "7150:7150"
- "7160:7160"
- "7170:7170"
command: stf storage-temp --port 3000 --save-dir /tmp --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-triproxy-dev:
devicehub-proxy:
build: .
image: vkcom/devicehub
container_name: devicehub-triproxy-dev
container_name: devicehub-proxy
env_file:
- scripts/variables.env
command: stf triproxy --name dev001 --bind-pub "tcp://*:7250" --bind-dealer "tcp://*:7260" --bind-pull "tcp://*:7270"
command: stf proxy proxy001 --bind-router "tcp://*:7110"
ports:
- "7250:7250"
- "7260:7260"
- "7270:7270"
- "7110:7110"
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -207,7 +175,7 @@ services:
container_name: devicehub-websocket
env_file:
- scripts/variables.env
command: stf websocket --port 3000 --storage-url http://devicehub-storage-temp:3000/ --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --connect-sub-dev tcp://devicehub-triproxy-dev:7250 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --secret=${STF_SECRET}
command: stf websocket --port 3000 --storage-url http://devicehub-storage-temp:3000/ --connect-proxy tcp://devicehub-proxy:7110 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -220,7 +188,7 @@ services:
container_name: devicehub-api
env_file:
- scripts/variables.env
command: stf api --port 3000 --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --connect-sub-dev tcp://devicehub-triproxy-dev:7250 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --secret=${STF_SECRET}
command: stf api --port 3000 --connect-proxy tcp://devicehub-proxy:7110 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -233,7 +201,7 @@ services:
container_name: devicehub-api-groups-engine
env_file:
- scripts/variables.env
command: stf groups-engine --connect-push tcp://devicehub-triproxy-app:7170 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --connect-sub tcp://devicehub-triproxy-app:7150
command: stf groups-engine --connect-proxy tcp://devicehub-proxy:7110
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -252,7 +220,7 @@ services:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
command: stf provider --name devicehub-provider --adb-host host.docker.internal --no-cleanup --connect-sub tcp://devicehub-triproxy-dev:7250 --connect-push tcp://devicehub-triproxy-dev:7270 --storage-url http://devicehub-storage-plugin-apk:3000/ --public-ip ${STF_DOMAIN} --min-port=12010 --max-port=12100 --heartbeat-interval 10000 --screen-ws-url-pattern "wss://${STF_DOMAIN}:${STF_PORT}/d/devicehub-provider/<%= publicPort %>/" --secret=${STF_SECRET}
command: stf provider --name devicehub-provider --adb-host host.docker.internal --no-cleanup --connect-processor tcp://devicehub-processor:7160 --storage-url http://devicehub-storage-plugin-apk:3000/ --public-ip ${STF_DOMAIN} --min-port=12010 --max-port=12100 --heartbeat-interval 10000 --screen-ws-url-pattern "wss://${STF_DOMAIN}:${STF_PORT}/d/devicehub-provider/<%= publicPort %>/" --secret=${STF_SECRET}
networks:
devicehub:
devicehub-ssl:
Expand Down
52 changes: 10 additions & 42 deletions docker-compose-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,7 @@ services:
container_name: devicehub-processor
env_file:
- scripts/variables.env
command: stf processor --name processor --connect-app-dealer tcp://devicehub-triproxy-app:7160 --connect-dev-dealer tcp://devicehub-triproxy-dev:7260
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-reaper:
build: .
image: vkcom/devicehub
container_name: devicehub-reaper
env_file:
- scripts/variables.env
command: stf reaper --name reaper001 --connect-push tcp://devicehub-triproxy-dev:7270 --connect-sub tcp://devicehub-triproxy-dev:7250 --heartbeat-timeout 30000
command: stf processor --name processor --connect-proxy tcp://devicehub-proxy:7110 --bind-router "tcp://*:7160" --heartbeat-timeout 30000
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand Down Expand Up @@ -176,41 +163,22 @@ services:
container_name: devicehub-storage-temp
env_file:
- scripts/variables.env
command: stf storage-temp --port 3000 --save-dir /tmp --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-triproxy-app:
build: .
image: vkcom/devicehub
container_name: devicehub-triproxy-app
env_file:
- scripts/variables.env
command: stf triproxy app001 --bind-pub "tcp://*:7150" --bind-dealer "tcp://*:7160" --bind-pull "tcp://*:7170"
ports:
- "7150:7150"
- "7160:7160"
- "7170:7170"
command: stf storage-temp --port 3000 --save-dir /tmp --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
restart: unless-stopped
networks:
devicehub:
devicehub-triproxy-dev:
devicehub-proxy:
build: .
image: vkcom/devicehub
container_name: devicehub-triproxy-dev
container_name: devicehub-proxy
env_file:
- scripts/variables.env
command: stf triproxy --name dev001 --bind-pub "tcp://*:7250" --bind-dealer "tcp://*:7260" --bind-pull "tcp://*:7270"
command: stf proxy proxy001 --bind-router "tcp://*:7110"
ports:
- "7250:7250"
- "7260:7260"
- "7270:7270"
- "7110:7110"
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -223,7 +191,7 @@ services:
container_name: devicehub-websocket
env_file:
- scripts/variables.env
command: stf websocket --port 3000 --storage-url http://devicehub-storage-temp:3000/ --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --connect-sub-dev tcp://devicehub-triproxy-dev:7250 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --secret=${STF_SECRET}
command: stf websocket --port 3000 --storage-url http://devicehub-storage-temp:3000/ --connect-proxy tcp://devicehub-proxy:7110 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -236,7 +204,7 @@ services:
container_name: devicehub-api
env_file:
- scripts/variables.env
command: stf api --port 3000 --connect-sub tcp://devicehub-triproxy-app:7150 --connect-push tcp://devicehub-triproxy-app:7170 --connect-sub-dev tcp://devicehub-triproxy-dev:7250 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --secret=${STF_SECRET}
command: stf api --port 3000 --connect-proxy tcp://devicehub-proxy:7110 --secret=${STF_SECRET}
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -249,7 +217,7 @@ services:
container_name: devicehub-api-groups-engine
env_file:
- scripts/variables.env
command: stf groups-engine --connect-push tcp://devicehub-triproxy-app:7170 --connect-push-dev tcp://devicehub-triproxy-dev:7270 --connect-sub tcp://devicehub-triproxy-app:7150
command: stf groups-engine --connect-proxy tcp://devicehub-proxy:7110
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand All @@ -270,7 +238,7 @@ services:
adbd:
condition: service_healthy
restart: unless-stopped
command: stf provider --name devicehub-provider --adb-host adbd --no-cleanup --connect-sub tcp://devicehub-triproxy-dev:7250 --connect-push tcp://devicehub-triproxy-dev:7270 --storage-url http://devicehub-storage-plugin-apk:3000/ --public-ip ${STF_DOMAIN} --min-port=12010 --max-port=12100 --heartbeat-interval 10000 --screen-ws-url-pattern "wss://${STF_DOMAIN}:${STF_PORT}/d/devicehub-provider/<%= publicPort %>/" --secret=${STF_SECRET}
command: stf provider --name devicehub-provider --adb-host adbd --no-cleanup --connect-processor tcp://devicehub-processor:7160 --storage-url http://devicehub-storage-plugin-apk:3000/ --public-ip ${STF_DOMAIN} --min-port=12010 --max-port=12100 --heartbeat-interval 10000 --screen-ws-url-pattern "wss://${STF_DOMAIN}:${STF_PORT}/d/devicehub-provider/<%= publicPort %>/" --secret=${STF_SECRET}
networks:
devicehub:
devicehub-ssl:
Expand Down
36 changes: 1 addition & 35 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,10 @@ export default tseslint.config(
'@typescript-eslint': tseslint.plugin,
ascii: {
rules: {
'no-non-ascii': {
meta: {
type: 'problem',
docs: { description: 'Disallow any non-ASCII character anywhere in the file' },
schema: [],
messages: {
nonAscii: 'Non-ASCII character U+{{code}} found.',
},
},
create(context) {
// ESLint 9 exposes SourceCode at context.sourceCode
const sourceCode = context.sourceCode ?? context.getSourceCode?.();
return {
Program() {
const text = sourceCode.text ?? sourceCode.getText();
for (let i = 0; i < text.length; i++) {
const cp = text.codePointAt(i);
if (cp > 0x7f) {
const loc = sourceCode.getLocFromIndex(i);
context.report({
loc: { start: loc, end: { line: loc.line, column: loc.column + 1 } },
messageId: 'nonAscii',
data: { code: cp.toString(16).toUpperCase().padStart(4, '0') },
});
// Skip the second half of a surrogate pair
if (cp > 0xffff) i++;
}
}
},
};
},
},
'no-non-ascii': 0,
},
},
},
rules: {
'ascii/no-non-ascii': 'error',
},
},
{
files: ['lib/**/*.js'],
Expand Down
10 changes: 2 additions & 8 deletions helm/devicehub-api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,8 @@ spec:
- api
- --port
- "3000"
- --connect-sub
- tcp://devicehub-triproxy-app:7150
- --connect-push
- tcp://devicehub-triproxy-app:7170
- --connect-sub-dev
- tcp://devicehub-triproxy-dev:7250
- --connect-push-dev
- tcp://devicehub-triproxy-dev:7270
- --connect-proxy
- tcp://devicehub-proxy:7110
- --secret=
envFrom:
- configMapRef:
Expand Down
10 changes: 2 additions & 8 deletions helm/devicehub-api-groups-engine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ spec:
- args:
- stf
- groups-engine
- --connect-sub
- tcp://devicehub-triproxy-app:7150
- --connect-push
- tcp://devicehub-triproxy-app:7170
- --connect-sub-dev
- tcp://devicehub-triproxy-dev:7250
- --connect-push-dev
- tcp://devicehub-triproxy-dev:7270
- --connect-proxy
- tcp://devicehub-proxy:7110
envFrom:
- configMapRef:
name: scripts-variables-env
Expand Down
29 changes: 16 additions & 13 deletions helm/devicehub-processor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ metadata:
labels:
io.kompose.service: devicehub-processor
name: devicehub-processor
# NOTE: helm manifests are kompose-generated and were long unmaintained; this
# is a structural migration to the proxy/processor topology and has NOT been
# validated against a live cluster. Multiple processor replicas each need their
# own device-facing ROUTER identity/endpoint (providers connect per-processor
# via --connect-processor), which a single Service cannot fan out; running more
# than one processor here requires a StatefulSet + headless service. Kept at 1.
spec:
replicas: 3
replicas: 1
selector:
matchLabels:
io.kompose.service: devicehub-processor
Expand All @@ -26,21 +32,18 @@ spec:
- processor
- --name
- processor
- --connect-app-dealer
- tcp://devicehub-triproxy-app:7160
- --connect-dev-dealer
- tcp://devicehub-triproxy-dev:7260
- --connect-sub
- tcp://devicehub-triproxy-app:7150
- --connect-push
- tcp://devicehub-triproxy-app:7170
- --connect-sub-dev
- tcp://devicehub-triproxy-dev:7250
- --connect-push-dev
- tcp://devicehub-triproxy-dev:7270
- --connect-proxy
- tcp://devicehub-proxy:7110
- --bind-router
- tcp://*:7160
- --heartbeat-timeout
- "30000"
envFrom:
- configMapRef:
name: scripts-variables-env
image: vkcom/devicehub
name: devicehub-processor
ports:
- containerPort: 7160
protocol: TCP
restartPolicy: Always
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ metadata:
kompose.cmd: kompose -f ../docker-compose-prod.yaml convert
kompose.version: 1.36.0 (HEAD)
labels:
io.kompose.service: devicehub-triproxy-app
name: devicehub-triproxy-app
io.kompose.service: devicehub-processor
name: devicehub-processor
spec:
ports:
- name: "7150"
port: 7150
targetPort: 7150
- name: "7160"
port: 7160
targetPort: 7160
- name: "7170"
port: 7170
targetPort: 7170
selector:
io.kompose.service: devicehub-triproxy-app
io.kompose.service: devicehub-processor
Loading
Loading