Compare commits

..

3 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
11 changed files with 28 additions and 16 deletions

4
sdk/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/sdk",
"version": "0.3.112",
"version": "0.3.113",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/sdk",
"version": "0.3.112",
"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.112",
"version": "0.3.113",
"description": "",
"main": "dist/src/index.js",
"exports": {

View File

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

View File

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

View File

@@ -957,7 +957,7 @@ class TamperState(TypedDict):
pass
TYPES_VERSION = "0.3.104"
TYPES_VERSION = "0.3.105"
class AirPurifier:
@@ -1859,6 +1859,9 @@ class EndpointManager:
class ClusterManager:
def getClusterAddress(self) -> str:
pass
def getClusterMode(self) -> Any | Any:
pass

View File

@@ -2722,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.134.1",
"version": "0.136.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/server",
"version": "0.134.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.104",
"@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.104",
"resolved": "https://registry.npmjs.org/@scrypted/types/-/types-0.3.104.tgz",
"integrity": "sha512-aFqB9mDmKoKLGF6O3+N71V+fPeMkIO2xC+2/oUF/xOvhG0D9fmQwTaV2gJtwVZJwx/ZgWGU85dIWqmxP8YfcDg==",
"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.135.0",
"version": "0.137.0",
"description": "",
"dependencies": {
"@scrypted/ffmpeg-static": "^6.1.0-build3",
"@scrypted/node-pty": "^1.0.22",
"@scrypted/types": "^0.3.104",
"@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,7 +110,7 @@ export class ClusterForkService {
labels: worker.labels,
forks: [...worker.forks] as ClusterFork[],
mode: worker.mode,
address: worker.address,
address: removeIPv4EmbeddedIPv6(worker.address),
};
}
return ret;