Compare commits

..

7 Commits

Author SHA1 Message Date
Koushik Dutta
df10c4e5f2 server: fixup address, make it available on cluster manager 2025-02-05 12:08:50 -08:00
Koushik Dutta
7c51bb420e postbeta 2025-02-05 11:51:38 -08:00
Koushik Dutta
367eafff5c postrelease 2025-02-05 11:51:26 -08:00
Koushik Dutta
adcdd18497 server: add cluster worker address 2025-02-05 11:51:07 -08:00
Koushik Dutta
a95b77fe26 sdk: add cluster worker address 2025-02-05 11:49:26 -08:00
Koushik Dutta
3ff75f0fde postbeta 2025-02-05 08:01:46 -08:00
Koushik Dutta
eecd38d271 postrelease 2025-02-05 08:01:39 -08:00
11 changed files with 30 additions and 15 deletions

4
sdk/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/sdk",
"version": "0.3.111",
"version": "0.3.113",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/sdk",
"version": "0.3.111",
"version": "0.3.113",
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.26.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/sdk",
"version": "0.3.111",
"version": "0.3.113",
"description": "",
"main": "dist/src/index.js",
"exports": {

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/types",
"version": "0.3.103",
"version": "0.3.105",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/types",
"version": "0.3.103",
"version": "0.3.105",
"license": "ISC"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/types",
"version": "0.3.103",
"version": "0.3.105",
"description": "",
"main": "dist/index.js",
"author": "",

View File

@@ -467,6 +467,7 @@ class ClusterForkInterfaceOptions(TypedDict):
class ClusterWorker(TypedDict):
address: str
forks: list[ClusterFork]
id: str
labels: list[str]
@@ -956,7 +957,7 @@ class TamperState(TypedDict):
pass
TYPES_VERSION = "0.3.103"
TYPES_VERSION = "0.3.105"
class AirPurifier:
@@ -1858,6 +1859,9 @@ class EndpointManager:
class ClusterManager:
def getClusterAddress(self) -> str:
pass
def getClusterMode(self) -> Any | Any:
pass

View File

@@ -2713,6 +2713,7 @@ export interface ClusterWorker {
labels: string[];
forks: ClusterFork[];
mode: 'server' | 'client';
address: string;
}
export interface ClusterManager {
@@ -2721,6 +2722,7 @@ export interface ClusterManager {
* Returns undefined if this is not a cluster worker.
*/
getClusterWorkerId(): string;
getClusterAddress(): string;
getClusterMode(): 'server' | 'client' | undefined;
getClusterWorkers(): Promise<Record<string, ClusterWorker>>;
}

View File

@@ -1,18 +1,18 @@
{
"name": "@scrypted/server",
"version": "0.132.1",
"version": "0.136.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/server",
"version": "0.132.1",
"version": "0.136.1",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {
"@scrypted/ffmpeg-static": "^6.1.0-build3",
"@scrypted/node-pty": "^1.0.22",
"@scrypted/types": "^0.3.100",
"@scrypted/types": "^0.3.105",
"adm-zip": "^0.5.16",
"body-parser": "^1.20.3",
"cookie-parser": "^1.4.7",
@@ -557,9 +557,9 @@
}
},
"node_modules/@scrypted/types": {
"version": "0.3.100",
"resolved": "https://registry.npmjs.org/@scrypted/types/-/types-0.3.100.tgz",
"integrity": "sha512-s/07QCxjMWqODgWj2UpLehzeo2cGFrCA9X8mvpG3owT/+q+sb8v/UUcw9TLHGSN6yIriNhceg3i9WO07kEIT6A==",
"version": "0.3.105",
"resolved": "https://registry.npmjs.org/@scrypted/types/-/types-0.3.105.tgz",
"integrity": "sha512-OHHia1JXybJ9L8p14b+x81Kviv2LR38oyDFffh3K8jLwsgNmY/DSmDh6r59rfK5U13D8x2TdcfCpR26DY7kgOw==",
"license": "ISC"
},
"node_modules/@types/adm-zip": {

View File

@@ -1,11 +1,11 @@
{
"name": "@scrypted/server",
"version": "0.132.3",
"version": "0.137.0",
"description": "",
"dependencies": {
"@scrypted/ffmpeg-static": "^6.1.0-build3",
"@scrypted/node-pty": "^1.0.22",
"@scrypted/types": "^0.3.100",
"@scrypted/types": "^0.3.105",
"adm-zip": "^0.5.16",
"body-parser": "^1.20.3",
"cookie-parser": "^1.4.7",

View File

@@ -243,6 +243,9 @@ class ClusterManager(scrypted_python.scrypted_sdk.types.ClusterManager):
def getClusterMode(self) -> Any | Any:
return os.getenv("SCRYPTED_CLUSTER_MODE", None)
def getClusterAddress(self) -> str:
return os.getenv("SCRYPTED_CLUSTER_ADDRESS", None)
def getClusterWorkerId(self) -> str:
return self.remote.clusterSetup.clusterWorkerId

View File

@@ -15,6 +15,10 @@ export class ClusterManagerImpl implements ClusterManager {
return this.clusterWorkerId;
}
getClusterAddress(): string {
return process.env.SCRYPTED_CLUSTER_ADDRESS;
}
getClusterMode(): 'server' | 'client' | undefined {
return this.clusterMode;
}

View File

@@ -5,6 +5,7 @@ import type { RuntimeWorkerOptions } from "../plugin/runtime/runtime-worker";
import { RpcPeer } from "../rpc";
import type { ScryptedRuntime } from "../runtime";
import type { ClusterForkOptions, ClusterForkParam, ClusterForkResultInterface, PeerLiveness, RunningClusterWorker } from "../scrypted-cluster-main";
import { removeIPv4EmbeddedIPv6 } from "../ip";
class WrappedForkResult implements ClusterForkResultInterface {
[RpcPeer.PROPERTY_PROXY_PROPERTIES] = {
@@ -109,6 +110,7 @@ export class ClusterForkService {
labels: worker.labels,
forks: [...worker.forks] as ClusterFork[],
mode: worker.mode,
address: removeIPv4EmbeddedIPv6(worker.address),
};
}
return ret;