@platforma-sdk/bootstrap 2.8.5 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/compose-backend.yaml +0 -7
- package/dist/cmd-opts.d.ts +9 -0
- package/dist/cmd-opts.d.ts.map +1 -1
- package/dist/commands/start/docker/s3.d.ts +7 -4
- package/dist/commands/start/docker/s3.d.ts.map +1 -1
- package/dist/commands/start/docker.d.ts +2 -0
- package/dist/commands/start/docker.d.ts.map +1 -1
- package/dist/core.d.ts +14 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +737 -644
- package/dist/index.mjs.map +1 -1
- package/dist/templates/compose.d.ts +11 -0
- package/dist/templates/compose.d.ts.map +1 -0
- package/package.json +4 -2
package/dist/cmd-opts.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export declare const ImageFlag: {
|
|
|
8
8
|
export declare const VersionFlag: {
|
|
9
9
|
version: OptionFlag<string | undefined, CustomOptions>;
|
|
10
10
|
};
|
|
11
|
+
export declare const ArchFlag: {
|
|
12
|
+
arch: OptionFlag<string | undefined, CustomOptions>;
|
|
13
|
+
};
|
|
11
14
|
export declare const LicenseFlags: {
|
|
12
15
|
license: OptionFlag<string | undefined, CustomOptions>;
|
|
13
16
|
'license-file': OptionFlag<string | undefined, CustomOptions>;
|
|
@@ -27,6 +30,12 @@ export declare const S3AddressesFlags: {
|
|
|
27
30
|
export declare const StorageFlag: {
|
|
28
31
|
storage: OptionFlag<string | undefined, CustomOptions>;
|
|
29
32
|
};
|
|
33
|
+
export declare const MinioPresignHostFlag: {
|
|
34
|
+
"minio-presign-host": BooleanFlag<boolean>;
|
|
35
|
+
};
|
|
36
|
+
export declare const MountFlag: {
|
|
37
|
+
mount: OptionFlag<string[] | undefined, CustomOptions>;
|
|
38
|
+
};
|
|
30
39
|
export declare const PlLogFileFlag: {
|
|
31
40
|
"pl-log-file": OptionFlag<string | undefined, CustomOptions>;
|
|
32
41
|
};
|
package/dist/cmd-opts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd-opts.d.ts","sourceRoot":"","sources":["../src/cmd-opts.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,WAAW;;CAOvB,CAAC;AAEF,eAAO,MAAM,SAAS;;CAIrB,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;CASxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CA8B1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;CAY5B,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAIxB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,UAAU;;CAItB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAI5B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAI7B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAMrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cmd-opts.d.ts","sourceRoot":"","sources":["../src/cmd-opts.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,WAAW;;CAOvB,CAAC;AAEF,eAAO,MAAM,SAAS;;CAIrB,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAQpB,CAAA;AAED,eAAO,MAAM,YAAY;;;CASxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CA8B1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;CAY5B,CAAC;AAEF,eAAO,MAAM,WAAW;;CAIvB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAIhC,CAAC;AAEF,eAAO,MAAM,SAAS;;CAKrB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAIxB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAIzB,CAAC;AAEF,eAAO,MAAM,UAAU;;CAItB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAIlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CASjC,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAI5B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAI3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAI7B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAMrB,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
import { OptionFlag, CustomOptions
|
|
2
|
+
import { BooleanFlag, OptionFlag, CustomOptions } from '@oclif/core/interfaces';
|
|
3
3
|
export default class S3 extends Command {
|
|
4
4
|
static description: string;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
+
"minio-presign-host": BooleanFlag<boolean>;
|
|
8
|
+
storage: OptionFlag<string | undefined, CustomOptions>;
|
|
9
|
+
mount: OptionFlag<string[] | undefined, CustomOptions>;
|
|
10
|
+
license: OptionFlag<string | undefined, CustomOptions>;
|
|
11
|
+
'license-file': OptionFlag<string | undefined, CustomOptions>;
|
|
7
12
|
'auth-ldap-default-dn': OptionFlag<string | undefined, CustomOptions>;
|
|
8
13
|
'auth-ldap-server': OptionFlag<string | undefined, CustomOptions>;
|
|
9
14
|
'auth-htpasswd-file': OptionFlag<string | undefined, CustomOptions>;
|
|
10
15
|
'auth-enabled': BooleanFlag<boolean>;
|
|
11
|
-
|
|
12
|
-
'license-file': OptionFlag<string | undefined, CustomOptions>;
|
|
13
|
-
storage: OptionFlag<string | undefined, CustomOptions>;
|
|
16
|
+
arch: OptionFlag<string | undefined, CustomOptions>;
|
|
14
17
|
version: OptionFlag<string | undefined, CustomOptions>;
|
|
15
18
|
image: OptionFlag<string | undefined, CustomOptions>;
|
|
16
19
|
'grpc-port': OptionFlag<number | undefined, CustomOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/docker/s3.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtC,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,OAAO;IACrC,OAAgB,WAAW,SAAkE;IAE7F,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK
|
|
1
|
+
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/docker/s3.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtC,MAAM,CAAC,OAAO,OAAO,EAAG,SAAQ,OAAO;IACrC,OAAgB,WAAW,SAAkE;IAE7F,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK;;;;;;;;;;;;;;;;;;;;MAcnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
|
|
@@ -8,12 +8,14 @@ export default class Docker extends Command {
|
|
|
8
8
|
'storage-work': OptionFlag<string | undefined, CustomOptions>;
|
|
9
9
|
'storage-primary': OptionFlag<string | undefined, CustomOptions>;
|
|
10
10
|
storage: OptionFlag<string | undefined, CustomOptions>;
|
|
11
|
+
mount: OptionFlag<string[] | undefined, CustomOptions>;
|
|
11
12
|
license: OptionFlag<string | undefined, CustomOptions>;
|
|
12
13
|
'license-file': OptionFlag<string | undefined, CustomOptions>;
|
|
13
14
|
'auth-ldap-default-dn': OptionFlag<string | undefined, CustomOptions>;
|
|
14
15
|
'auth-ldap-server': OptionFlag<string | undefined, CustomOptions>;
|
|
15
16
|
'auth-htpasswd-file': OptionFlag<string | undefined, CustomOptions>;
|
|
16
17
|
'auth-enabled': BooleanFlag<boolean>;
|
|
18
|
+
arch: OptionFlag<string | undefined, CustomOptions>;
|
|
17
19
|
version: OptionFlag<string | undefined, CustomOptions>;
|
|
18
20
|
image: OptionFlag<string | undefined, CustomOptions>;
|
|
19
21
|
'grpc-port': OptionFlag<number | undefined, CustomOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../src/commands/start/docker.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,OAAgB,WAAW,SAAkE;IAE7F,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../src/commands/start/docker.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOtC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,OAAgB,WAAW,SAAkE;IAE7F,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK;;;;;;;;;;;;;;;;;;;;;;MAgBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
|
package/dist/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChildProcess, SpawnSyncReturns } from 'child_process';
|
|
1
|
+
import { ChildProcess, SpawnSyncReturns } from 'node:child_process';
|
|
2
2
|
import { default as winston } from 'winston';
|
|
3
3
|
import * as plCfg from './templates/pl-config';
|
|
4
|
-
import * as types from './templates/types';
|
|
4
|
+
import type * as types from './templates/types';
|
|
5
5
|
export default class Core {
|
|
6
6
|
private readonly logger;
|
|
7
7
|
constructor(logger: winston.Logger);
|
|
@@ -22,23 +22,34 @@ export default class Core {
|
|
|
22
22
|
startDockerS3(localRoot: string, options?: {
|
|
23
23
|
image?: string;
|
|
24
24
|
version?: string;
|
|
25
|
+
platformOverride?: string;
|
|
25
26
|
logLevel?: string;
|
|
26
27
|
auth?: types.authOptions;
|
|
27
28
|
license?: string;
|
|
28
29
|
licenseFile?: string;
|
|
29
30
|
grpcPort?: number;
|
|
30
31
|
grpcAddr?: string;
|
|
32
|
+
presignHost?: string;
|
|
31
33
|
monitoringPort?: number;
|
|
32
34
|
monitoringAddr?: string;
|
|
33
35
|
debugPort?: number;
|
|
34
36
|
debugAddr?: string;
|
|
37
|
+
customMounts?: {
|
|
38
|
+
hostPath: string;
|
|
39
|
+
containerPath?: string;
|
|
40
|
+
}[];
|
|
35
41
|
}): void;
|
|
36
42
|
startDocker(localRoot: string, options?: {
|
|
37
43
|
primaryStorageURL?: string;
|
|
38
44
|
workStoragePath?: string;
|
|
39
45
|
libraryStorageURL?: string;
|
|
46
|
+
customMounts?: {
|
|
47
|
+
hostPath: string;
|
|
48
|
+
containerPath?: string;
|
|
49
|
+
}[];
|
|
40
50
|
image?: string;
|
|
41
51
|
version?: string;
|
|
52
|
+
platformOverride?: string;
|
|
42
53
|
logLevel?: string;
|
|
43
54
|
auth?: types.authOptions;
|
|
44
55
|
license?: string;
|
|
@@ -53,7 +64,7 @@ export default class Core {
|
|
|
53
64
|
stop(): void;
|
|
54
65
|
cleanup(): void;
|
|
55
66
|
mergeLicenseEnvs(flags: {
|
|
56
|
-
license?: string;
|
|
67
|
+
'license'?: string;
|
|
57
68
|
'license-file'?: string;
|
|
58
69
|
}): void;
|
|
59
70
|
initAuthDriversList(flags: {
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var nr=Object.defineProperty;var cr=(a,e,r)=>e in a?nr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var P=(a,e,r)=>cr(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@oclif/core"),$=require("node:os"),l=require("node:fs"),g=require("node:path"),T=require("node:child_process"),V=require("winston"),lr=require("node:crypto"),C=require("readline-sync"),or=require("node:fs/promises"),dr=require("node:stream"),F=require("zod"),gr=require("decompress"),X=require("yaml"),Z=require("@milaboratories/pl-local"),ur=require("node:https"),fr=require("tar");function We(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const r in a)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(a,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>a[r]})}}return e.default=a,Object.freeze(e)}const E=We(or),mr=We(fr),D={"log-level":f.Flags.string({description:"logging level",default:"info",options:["error","warn","info","debug"],required:!1})},qe={image:f.Flags.string({description:"use custom docker image to run platforma"})},ee={version:f.Flags.string({description:"use custom platforma release (official docker image or binary package)"})},Je={arch:f.Flags.string({description:"override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor)",options:["amd64","arm64"]})},re={license:f.Flags.string({description:'pass a license code. The license can be got from "https://licensing.milaboratories.com".'}),"license-file":f.Flags.file({exists:!0,description:"specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."})},te={"grpc-port":f.Flags.integer({description:"port for Platforma Backend gRPC API. Default is 6345",env:"PLATFORMA_GRPC_PORT"}),"grpc-listen":f.Flags.string({description:"full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",env:"PLATFORMA_GRPC_LISTEN"}),"monitoring-port":f.Flags.integer({description:"port for Platforma Backend monitoring API. Default is 9090",env:"PLATFORMA_MONITORING_PORT"}),"monitoring-listen":f.Flags.string({description:"full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",env:"PLATFORMA_MONITORING_LISTEN"}),"debug-port":f.Flags.integer({description:"port for Platforma Backend debug API. Default is 9091",env:"PLATFORMA_DEBUG_PORT"}),"debug-listen":f.Flags.string({description:"full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",env:"PLATFORMA_DEBUG_LISTEN"})},hr={"s3-address-port":f.Flags.integer({description:"port that S3 will listen, default is 9000",default:9e3,env:"PLATFORMA_S3_PORT"}),"s3-console-address-port":f.Flags.integer({description:"port that a console of S3 will listen, default is 9001",default:9001,env:"PLATFORMA_S3_CONSOLE_PORT"})},ae={storage:f.Flags.string({description:"specify path on host to be used as storage for all Platforma Backend data"})},yr={"minio-presign-host":f.Flags.boolean({description:"use 'minio' host instead of 'localhost' in presign URLs"})},ze={mount:f.Flags.string({multiple:!0,description:"things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"})},He={"pl-log-file":f.Flags.file({description:"specify path for Platforma Backend log file"})},Ye={"pl-workdir":f.Flags.file({description:"specify working directory for Platforma Backend process"})},Ke={"pl-binary":f.Flags.file({description:"start given Platforma Backend binary instead of automatically downloaded version"})},Ve={"pl-sources":f.Flags.file({description:"path to pl repository root: build Platforma Backend from sources and start the resulting binary"})},Qe={config:f.Flags.string({description:"use custom Platforma Backend config"})};f.Flags.file({description:"specify path on host to be used as 'primary' storage"});const he={"storage-work":f.Flags.file({description:"specify path on host to be used as 'work' storage"})};f.Flags.file({description:"specify path on host to be used as 'library' storage"});const ye={"storage-primary":f.Flags.string({description:`specify 'primary' storage destination URL.
|
|
2
2
|
file:/path/to/dir for directory on local FS
|
|
3
3
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
4
4
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
5
|
-
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`})},
|
|
5
|
+
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`})},Pe={"storage-library":f.Flags.string({description:`specify 'library' storage destination URL.
|
|
6
6
|
file:/path/to/dir for directory on local FS
|
|
7
7
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
8
8
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
9
|
-
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`})},
|
|
10
|
-
`).map((c
|
|
11
|
-
`);return`${(
|
|
12
|
-
`);return r.length<=1?"":r[1].trim()}catch{return""}}const
|
|
9
|
+
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`})},Pr={"auth-enabled":f.Flags.boolean({description:"enable authorization"})},br={"auth-htpasswd-file":f.Flags.file({description:"path to .htpasswd file with Platforma users (static user DB auth source)"})},vr={"auth-ldap-server":f.Flags.string({description:"address of LDAP server to use for auth in Platforma (auth source)"})},wr={"auth-ldap-default-dn":f.Flags.string({description:"DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"})},se={...Pr,...br,...vr,...wr};function kr(a){return C.question(`${a} [y/N] `).toLowerCase()==="y"}function Y(a){throw new Error("this should never happen")}function N(a="debug"){return V.createLogger({level:a,format:V.format.printf(({level:e,message:r})=>{const t=" ".repeat(e.length+2);if(typeof r!="string"){const n=JSON.stringify(r);throw Error(`logger message ${n} is not a string`)}const s=r.split(`
|
|
10
|
+
`).map((n,c)=>c===0?n:t+n).join(`
|
|
11
|
+
`);return`${(n=>V.format.colorize().colorize(n,n))(e)}: ${s}`}),transports:[new V.transports.Console({stderrLevels:["error","warn","info","debug"],handleExceptions:!0})]})}function Sr(a){return lr.randomBytes(Math.ceil(a/2)).toString("hex").slice(0,a)}function pr(a){return a.startsWith("~")?g.join($.homedir(),a.slice(1)):a}function Q(a,e){l.existsSync(a)||(l.mkdirSync(a,{recursive:!0}),e!=null&&e.mode&&l.chmodSync(a,e.mode))}function Ar(a){try{if($.platform()!=="win32")return T.execSync(`ps -p ${a} -o comm=`,{encoding:"utf8"}).trim();const e=`wmic process where processid=${a} get Caption`,r=T.execSync(e,{encoding:"utf8"}).split(`
|
|
12
|
+
`);return r.length<=1?"":r[1].trim()}catch{return""}}const ne=["Python"],Xe=["Tengo","Python"],Rr=F.z.union([F.z.literal("Tengo"),F.z.literal("Python")]),Lr=F.z.object({npmOrgName:F.z.string().min(1),orgName:F.z.string().min(1),blockName:F.z.string().min(1),softwarePlatforms:F.z.array(Rr).refine(a=>new Set(a).size===a.length,{message:"Must be an array of unique software platforms"})});async function _r(a){const{npmOrgName:e,orgName:r,blockName:t,softwarePlatforms:s}=$r(),i=g.join(process.cwd(),t);a.info("Downloading boilerplate code..."),await Or("https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip","platforma-block-boilerplate-main",i);const n=Xe.filter(o=>s.indexOf(o)<0),c=ne.length==n.length;a.info(`Keep platforms '${s}', remove: '${n}'. Will remove all platforms? ${c}`);for(const o of n)await Fr(i,o);c&&await Tr(i),a.info("Replace everything in the template with provided options..."),Er(i,[{from:/@platforma-open(?!.*runenv-python-3)/g,to:`@${e}`},{from:/my-org/g,to:r},{from:/block-boilerplate/g,to:t}])}function $r(){let a=C.question('Write an organization name for npm. Default is "platforma-open": ');a===""&&(a="platforma-open");const e=C.question('Write an organization name, e.g. "my-org": '),r=C.question('Write a name of the block, e.g. "hello-world": '),t=C.keyInYN("Create package for block's software?");let s=["Tengo"];if(t)for(;s.length<Xe.length;){const i=C.keyInSelect(ne,"Choose software platform:");if(i<0)break;s.push(ne[i])}return s=Array.from(new Set(s)).sort(),Lr.parse({npmOrgName:a,orgName:e,blockName:r,softwarePlatforms:s})}async function Or(a,e,r){const s=await(await fetch(a)).blob(),i=await E.mkdtemp(g.join($.tmpdir(),"create-repo")),n=g.join(i,"packed-repo.zip"),c=dr.Writable.toWeb(l.createWriteStream(n));await s.stream().pipeTo(c);const o=g.join(i,"unpacked-repo");await E.mkdir(o),await gr(n,o),await E.cp(g.join(o,e),r,{recursive:!0})}async function Fr(a,e){const r=e.toLowerCase();await B(g.join(a,"ui","src","pages","MainPage.vue"),new RegExp(`.*${r}Message.*\\n\\n`,"g")),await B(g.join(a,"model","src","index.ts"),new RegExp(`.*${r}Message.*\\n\\n`,"g")),await B(g.join(a,"workflow","src","main.tpl.tengo"),new RegExp(`.*${r}.*exec.builder.*[\\s\\S]*?\\n\\n`,"g")),await B(g.join(a,"workflow","src","main.tpl.tengo"),new RegExp(`.*${r}Message.*\\n`,"g")),await B(g.join(a,"workflow","src","wf.test.ts"),new RegExp(`.*${r}Message.*\\n.*expect.*\\n\\n`,"g")),await E.rm(g.join(a,"software",`src_${r}`),{recursive:!0}),await be(g.join(a,"software","package.json"),t=>{const s=JSON.parse(t);return delete s["block-software"].artifacts[`hello-${r}-artifact`],delete s["block-software"].entrypoints[`hello-world-${r}`],JSON.stringify(s,null,2)})}async function Tr(a){await E.rm(g.join(a,"software"),{recursive:!0}),await be(g.join(a,"workflow","package.json"),e=>{const r=JSON.parse(e);return delete r.dependencies["@platforma-open/my-org.block-boilerplate.software"],JSON.stringify(r,null,2)}),await B(g.join(a,"pnpm-workspace.yaml"),/.*- software$\n/gm)}async function Er(a,e){const r=await Dr(a);for(const{from:t,to:s}of e)for(const i of r)await Ze(i,t,s)}async function Dr(a){return(await E.readdir(a,{withFileTypes:!0,recursive:!0})).filter(r=>r.isFile()).map(r=>g.join(r.parentPath,r.name))}async function be(a,e){const r=await E.readFile(a),t=e(r.toString());await E.writeFile(a,t)}async function Ze(a,e,r){return await be(a,t=>t.replaceAll(e,r))}async function B(a,e){return await Ze(a,e,"")}const j=class j extends f.Command{async run(){const{flags:e}=await this.parse(j),r=N(e["log-level"]);await _r(r)}};P(j,"description","Helps to create a new block by downloading a block's template."),P(j,"examples",["<%= name %>"]),P(j,"flags",{...D});let ce=j;function er(...a){return g.resolve(__dirname,"..",...a)}function O(...a){return er("assets",...a)}function Nr(){return l.readdirSync(O()).filter(e=>e.startsWith("compose-")&&e.endsWith(".yaml")).map(e=>O(e))}function Ir(...a){return l.readFileSync(er(...a))}function ie(a){return a||(a=Z.getDefaultPlVersion()),`quay.io/milaboratories/platforma:${a}`}const I=class I{constructor(e){P(this,"state",{lastRun:void 0,isActive:!1});P(this,"filePath");P(this,"dirPath");e=e??g.resolve($.homedir(),".config","pl-bootstrap");const r=g.join(e,"state.json");this.dirPath=e,this.filePath=r,l.existsSync(e)||l.mkdirSync(e,{recursive:!0}),l.existsSync(r)&&(this.state=JSON.parse(Ir(r).toString()))}static getInstance(){return I.instance||(I.instance=new I),I.instance}path(...e){return g.join(this.dirPath,...e)}data(...e){return this.path("data",...e)}binaries(...e){return this.path("binaries",...e)}writeState(){l.writeFileSync(this.filePath,JSON.stringify(this.state))}get isActive(){var e,r;return this.state.isActive?this.state.isActive:(r=(e=this.state.lastRun)==null?void 0:e.process)!=null&&r.pid?this.isValidPID:!1}get isValidPID(){var r,t;if(!((t=(r=this.state.lastRun)==null?void 0:r.process)!=null&&t.pid))return!1;const e=Ar(this.state.lastRun.process.pid);return e==="platforma"||e.endsWith("/platforma")||e.endsWith("\\platforma")}set isActive(e){this.state.isActive=e,this.writeState()}get lastRun(){return this.state.lastRun}set lastRun(e){this.state.lastRun=e,this.writeState()}};P(I,"instance");let le=I;const d=le.getInstance();function je(a,e,r,t){var s;return d.lastRun={...d.lastRun,mode:"docker",cmd:"docker",args:e,workdir:r.cwd,envs:r.env,docker:{...(s=d.lastRun)==null?void 0:s.docker,...t}},rr(a,"docker",e,r)}function xr(a,e,r,t,s){var n;d.lastRun={...d.lastRun,mode:"process",cmd:e,args:r,workdir:t.cwd,envs:t.env,process:{...(n=d.lastRun)==null?void 0:n.process,...s}};const i=Cr(a,e,r,t);return d.lastRun.process={...d.lastRun.process,pid:i.pid},i}function Mr(a,e){if(!d.lastRun)throw new Error("no previous run info found: this is the first run after package installation");return e={cwd:d.lastRun.workdir,env:{...d.lastRun.envs,...e.env},...e},rr(a,d.lastRun.cmd,d.lastRun.args,e)}function Cr(a,e,r,t){a.debug(`Running:
|
|
13
13
|
env: ${JSON.stringify(t.env)}
|
|
14
14
|
cmd: ${JSON.stringify([e,...r])}
|
|
15
|
-
wd: ${t.cwd}`),t.env={...process.env,...t.env},a.debug(" spawning child process");const s=
|
|
15
|
+
wd: ${t.cwd}`),t.env={...process.env,...t.env},a.debug(" spawning child process");const s=T.spawn(e,r,t);var i=!1;const n=()=>{s.kill("SIGINT"),i=!0};return a.debug(" setting up signal handler"),process.on("SIGINT",n),s.on("close",c=>{process.removeListener("SIGINT",n),i&&process.exit(c)}),s}function rr(a,e,r,t){return a.debug(`Running:
|
|
16
16
|
env: ${JSON.stringify(t.env)}
|
|
17
17
|
cmd: ${JSON.stringify([e,...r])}
|
|
18
|
-
wd: ${t.cwd}`),t.env={...process.env,...t.env},
|
|
18
|
+
wd: ${t.cwd}`),t.env={...process.env,...t.env},T.spawnSync(e,r,t)}function Ge(a,e,r){if(!r||r.size==0){l.copyFileSync(a,e);return}const t=l.readFileSync(a,{encoding:"utf-8"}),s=X.parse(t.toString());if(!s.services)throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);for(const i of Object.keys(s.services))r.has(i)||delete s.services[i];for(const[i,n]of r.entries()){const c=s.services[i];if(!c)throw new Error(`docker compose '${a}' has no declaration of service '${i}'`);if(n.platform&&(c.platform=n.platform),n.envs){c.environment||(c.environment=[]);for(let o=0;o<((c==null?void 0:c.environment.length)??0);){const u=c.environment[o].split("=")[0];if(n.envs[u]){const b=c.environment.pop();b&&c.environment.length!==o&&(c.environment[o]=b)}else o++}for(const[o,m]of Object.entries(n.envs))c.environment.push(`${o}=${m}`)}if(n.mounts){c.volumes||(c.volumes=[]);for(const o of n.mounts)c.volumes.push(`${o.hostPath}:${o.containerPath}`)}}l.writeFileSync(e,X.stringify(s))}function Br(a){return{id:a,type:"S3",indexCachePeriod:"0s",endpoint:"",region:"",presignEndpoint:"",bucketName:"",createBucket:!1,forcePathStyle:!1,key:"",secret:"",keyPrefix:"",accessPrefixes:[],uploadKeyPrefix:""}}function tr(a){return{id:a,type:"FS",indexCachePeriod:"0s",rootPath:""}}function M(a,e,r){a=pr(a);const t=new URL(a,`file:${e}`);switch(t.protocol){case"s3:":var n=t.hostname,s=t.searchParams.get("region");return{...r,type:"S3",bucketName:n,region:s};case"s3e:":var i=t.pathname.split("/").slice(1),n=i[0],c=i.length>1?i[1]:"";return{...r,type:"S3",endpoint:`http://${t.host}/`,bucketName:n,keyPrefix:c,region:t.searchParams.get("region"),key:t.username?`static:${t.username}`:"",secret:t.password?`static:${t.password}`:""};case"s3es:":var i=t.pathname.split("/").slice(1),n=i[0],c=i.length>1?i[1]:"";return{...r,type:"S3",endpoint:`https://${t.host}/`,bucketName:n,keyPrefix:c,region:t.searchParams.get("region"),key:t.username?`static:${t.username}`:"",secret:t.password?`static:${t.password}`:""};case"file:":return{type:"FS",rootPath:t.pathname};default:throw new Error(`storage protocol '${t.protocol}' is not supported`)}}function jr(a,e){var h,y,L,w,k,R,A,S,p,ve,we,ke,Se,pe,Ae,Re,Le,_e,$e,Oe,Fe,Te,Ee,De,Ne,Ie,xe,Me,Ce,Be;const r=(e==null?void 0:e.localRoot)??d.data("local-custom"),t={level:((h=e==null?void 0:e.log)==null?void 0:h.level)??"info",path:((y=e==null?void 0:e.log)==null?void 0:y.path)??`${r}/logs/platforma.log`},s={listen:((L=e==null?void 0:e.grpc)==null?void 0:L.listen)??"localhost:6345",tls:{enable:K((k=(w=e==null?void 0:e.grpc)==null?void 0:w.tls)==null?void 0:k.enable,!1),clientAuthMode:((A=(R=e==null?void 0:e.grpc)==null?void 0:R.tls)==null?void 0:A.clientAuthMode)??"NoAuth",certFile:((p=(S=e==null?void 0:e.grpc)==null?void 0:S.tls)==null?void 0:p.certFile)??`${r}/certs/tls.cert`,keyFile:((we=(ve=e==null?void 0:e.grpc)==null?void 0:ve.tls)==null?void 0:we.keyFile)??`${r}/certs/tls.key`,...(ke=e==null?void 0:e.grpc)==null?void 0:ke.tls}},i={auth:{enabled:((pe=(Se=e==null?void 0:e.core)==null?void 0:Se.auth)==null?void 0:pe.enabled)??!1,drivers:((Re=(Ae=e==null?void 0:e.core)==null?void 0:Ae.auth)==null?void 0:Re.drivers)??[{driver:"jwt",key:a},{driver:"htpasswd",path:`${r}/users.htpasswd`}]},db:{path:`${r}/db`}},n=Ue("main",`${r}/storages/main`,"main-bucket",(Le=e==null?void 0:e.storages)==null?void 0:Le.primary);var c;switch(($e=(_e=e==null?void 0:e.storages)==null?void 0:_e.work)==null?void 0:$e.type){case void 0:case"FS":c=tr("work"),c.rootPath=((Fe=(Oe=e==null?void 0:e.storages)==null?void 0:Oe.work)==null?void 0:Fe.rootPath)??`${r}/storages/work`,c.indexCachePeriod=((Ee=(Te=e==null?void 0:e.storages)==null?void 0:Te.work)==null?void 0:Ee.indexCachePeriod)??"1m";break;default:throw new Error("work storage MUST have 'FS' type as it is used for working directories management")}const m=Ue("library",`${r}/storages/library`,"library-bucket",(De=e==null?void 0:e.storages)==null?void 0:De.library),u={enabled:K((Ne=e==null?void 0:e.monitoring)==null?void 0:Ne.enabled,!0),listen:((Ie=e==null?void 0:e.monitoring)==null?void 0:Ie.listen)??"127.0.0.1:9090"},b={enabled:K((xe=e==null?void 0:e.debug)==null?void 0:xe.enabled,!0),listen:((Me=e==null?void 0:e.debug)==null?void 0:Me.listen)??"127.0.0.1:9091"},v={value:((Ce=e==null?void 0:e.license)==null?void 0:Ce.value)??"",file:((Be=e==null?void 0:e.license)==null?void 0:Be.file)??""};return{localRoot:r,license:v,log:t,grpc:s,core:i,monitoring:u,debug:b,storages:{primary:n,work:c,library:m},hacks:{libraryDownloadable:!0}}}function Ue(a,e,r,t){var s;switch(t==null?void 0:t.type){case void 0:case"FS":s=tr(a),s.rootPath=(t==null?void 0:t.rootPath)??e;break;case"S3":s=Br(a),s.endpoint=(t==null?void 0:t.endpoint)??"http://localhost:9000",s.presignEndpoint=(t==null?void 0:t.presignEndpoint)??"http://localhost:9000",s.bucketName=(t==null?void 0:t.bucketName)??r,s.createBucket=K(t==null?void 0:t.createBucket,!0),s.forcePathStyle=K(t==null?void 0:t.forcePathStyle,!0),s.key=(t==null?void 0:t.key)??"",s.secret=(t==null?void 0:t.secret)??"",s.keyPrefix=(t==null?void 0:t.keyPrefix)??"",s.accessPrefixes=(t==null?void 0:t.accessPrefixes)??[""],s.uploadKeyPrefix=(t==null?void 0:t.uploadKeyPrefix)??"";break;default:throw Y(),new Error("unknown storage type")}return s}function Gr(a){const e=a.monitoring.enabled?"":" disabled",r=a.debug.enabled?"":" disabled",t=a.hacks.libraryDownloadable?"true":"false";var s=a.license.value;return a.license.file!=""&&(s=l.readFileSync(a.license.file).toString().trimEnd()),`
|
|
19
19
|
license:
|
|
20
20
|
value: '${a.license.value}'
|
|
21
21
|
file: '${a.license.file}'
|
|
@@ -89,24 +89,24 @@ controllers:
|
|
|
89
89
|
packagesRoot: '${a.localRoot}/packages'
|
|
90
90
|
|
|
91
91
|
workflows: {}
|
|
92
|
-
`}function K(a,e){return a===void 0?e:a}const
|
|
92
|
+
`}function K(a,e){return a===void 0?e:a}const Ur=["linux","macos","windows"];function Wr(a){const e=$.platform();switch(e){case"darwin":return"macos";case"linux":return"linux";case"win32":return"windows";default:throw new Error(`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: `+JSON.stringify(Ur))}}const qr=["amd64","arm64"];function ar(a){const e=$.arch();switch(e){case"arm64":return"arm64";case"x64":return"amd64";default:throw new Error(`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: `+JSON.stringify(qr))}}function Jr(a,e){const r=(e==null?void 0:e.version)??Z.getDefaultPlVersion(),t=(e==null?void 0:e.showProgress)??process.stdout.isTTY,s=`pl-${r}-${ar()}.tgz`,i=(e==null?void 0:e.downloadURL)??`https://cdn.platforma.bio/software/pl/${Wr()}/${s}`,n=(e==null?void 0:e.saveTo)??d.binaries(s);if(l.existsSync(n))return a.info(`Platforma Backend archive download skipped: '${n}' already exists`),Promise.resolve(n);l.mkdirSync(g.dirname(n),{recursive:!0}),a.info(`Downloading Platforma Backend archive:
|
|
93
93
|
URL: ${i}
|
|
94
|
-
Save to: ${
|
|
94
|
+
Save to: ${n}`);const c=ur.get(i);return new Promise((o,m)=>{c.on("response",u=>{if(!u.statusCode){const y=new Error("failed to download archive: no HTTP status code in response from server");c.destroy(),m(y);return}if(u.statusCode!==200){const y=new Error(`failed to download archive: ${u.statusCode} ${u.statusMessage}`);c.destroy(),m(y);return}const b=parseInt(u.headers["content-length"]||"0",10);let v=0;const h=l.createWriteStream(n);u.pipe(h),u.on("data",y=>{v+=y.length;const L=v/b*100;t&&process.stdout.write(` downloading: ${L.toFixed(2)}%\r`)}),u.on("error",y=>{l.unlinkSync(n),a.error(`Failed to download Platforma Binary: ${y.message}`),c.destroy(),m(y)}),h.on("finish",()=>{h.close(),a.info(" ... download done."),c.destroy(),o(n)})})})}function zr(a,e){a.debug("extracting archive...");const r=(e==null?void 0:e.version)??Z.getDefaultPlVersion();a.debug(` version: '${r}'`);const t=`${ir({version:r})}.tgz`,s=(e==null?void 0:e.archivePath)??d.binaries(t);a.debug(` archive path: '${s}'`);const i=(e==null?void 0:e.extractTo)??Yr(s);if(a.debug(` target dir: '${i}'`),l.existsSync(i))return a.info(`Platforma Backend binaries unpack skipped: '${i}' exists`),i;if(!l.existsSync(s)){const n=`Platforma Backend binary archive not found at '${s}'`;throw a.error(n),new Error(n)}return l.existsSync(i)||(a.debug(` creating target dir '${i}'`),l.mkdirSync(i,{recursive:!0})),a.info(`Unpacking Platforma Backend archive:
|
|
95
95
|
Archive: ${s}
|
|
96
|
-
Target dir: ${i}`),
|
|
97
|
-
${
|
|
98
|
-
${
|
|
99
|
-
${
|
|
96
|
+
Target dir: ${i}`),mr.x({file:s,cwd:i,gzip:!0,sync:!0}),a.info(" ... unpack done."),i}function sr(a,e){return Jr(a,e).then(r=>zr(a,{archivePath:r}))}function ir(a){return`pl-${(a==null?void 0:a.version)??Z.getDefaultPlVersion()}-${ar()}`}function Hr(a,...e){return d.binaries(ir({version:a}),...e)}function Yr(a){const e=a.lastIndexOf(".");return e===-1?a:a.slice(0,e)}class x{constructor(e){this.logger=e}startLast(){const e=Mr(this.logger,{stdio:"inherit"});H(e,"failed to bring back Platforma Backend in the last started configuration")}startLocal(e){var o,m,u,b,v,h,y,L,w,k;const r=(e==null?void 0:e.binaryPath)??Hr(e==null?void 0:e.version,"binaries","platforma");let t=e==null?void 0:e.configPath;const s=(e==null?void 0:e.workdir)??(t?process.cwd():d.path());e!=null&&e.primaryURL&&(e.configOptions={...e.configOptions,storages:{...(o=e.configOptions)==null?void 0:o.storages,primary:M(e.primaryURL,s,(u=(m=e.configOptions)==null?void 0:m.storages)==null?void 0:u.primary)}}),e!=null&&e.libraryURL&&(e.configOptions={...e.configOptions,storages:{...(b=e.configOptions)==null?void 0:b.storages,library:M(e.libraryURL,s,(h=(v=e.configOptions)==null?void 0:v.storages)==null?void 0:h.library)}});const i=jr(this.getLastJwt(),e==null?void 0:e.configOptions);this.logger.debug(" checking license..."),this.checkLicense((L=(y=e==null?void 0:e.configOptions)==null?void 0:y.license)==null?void 0:L.value,(k=(w=e==null?void 0:e.configOptions)==null?void 0:w.license)==null?void 0:k.file);const n=[`${i.localRoot}/packages`,`${i.localRoot}/packages-local`,`${i.localRoot}/blocks-local`];i.storages.primary.type==="FS"&&n.push(i.storages.primary.rootPath),i.storages.library.type==="FS"&&(n.push(i.storages.library.rootPath),i.hacks.libraryDownloadable=!1),i.storages.work.type==="FS"&&n.push(i.storages.work.rootPath),this.logger.debug(" creating pl state directories...");for(const R of n)l.existsSync(R)||(this.logger.debug(` '${R}'`),l.mkdirSync(R,{recursive:!0}));for(const R of i.core.auth.drivers)R.driver==="htpasswd"&&(l.existsSync(R.path)||(this.logger.debug(` installing default 'users.htpasswd' to ${R.path}...`),l.copyFileSync(O("users.htpasswd"),R.path)));t||(t=g.join(i.localRoot,"config.yaml"),this.logger.debug(` rendering configuration '${t}'...`),l.writeFileSync(t,Gr(i)));const c=this.renderRunInfo({configPath:t,dbPath:i.core.db.path,apiAddr:i.grpc.listen,logPath:i.log.path,primary:i.storages.primary,work:i.storages.work,library:i.storages.library});return this.logger.info(`Starting platforma:
|
|
97
|
+
${c}`),xr(this.logger,r,["-config",t],{cwd:s,stdio:"inherit"},{storagePath:i.localRoot})}startLocalS3(e){var s;this.logger.debug("starting platforma in 'local s3' mode...");const r=(e==null?void 0:e.minioPort)??9e3,t=(s=e==null?void 0:e.configOptions)==null?void 0:s.localRoot;return this.startMinio({minioPort:r,minioConsolePort:e==null?void 0:e.minioConsolePort,storage:t?g.join(t,"minio"):void 0}),this.startLocal({...e,primaryURL:(e==null?void 0:e.primaryURL)??`s3e://testuser:testpassword@localhost:${r}/main-bucket/?region=no-region`,libraryURL:(e==null?void 0:e.libraryURL)??`s3e://testuser:testpassword@localhost:${r}/library-bucket/?region=no-region`})}startMinio(e){this.logger.debug(" starting minio...");const r=O("compose-backend.yaml"),t=e!=null&&e.version?`:${e.version}`:"";this.logger.debug(` minio version: ${t}`);const s=(e==null?void 0:e.image)??`quay.io/minio/minio${t}`;this.logger.debug(` minio image: ${s}`);const i=(e==null?void 0:e.storage)??d.data("minio");Q(i,{mode:"0775"});const n=d.data("stub");Q(n);const c=(e==null?void 0:e.minioPort)??9e3,o=(e==null?void 0:e.minioConsolePort)??9001,m={MINIO_IMAGE:s,MINIO_STORAGE:g.resolve(i),MINIO_PORT:c.toString(),MINIO_CONSOLE_PORT:o.toString(),PL_DATA_DB_ROOT:n,PL_DATA_PRIMARY_ROOT:n,PL_DATA_LIBRARY_ROOT:n,PL_DATA_WORKDIR_ROOT:n,PL_DATA_PACKAGE_ROOT:n,PL_IMAGE:"scratch"};this.logger.debug(" spawning child 'docker' process...");const u=T.spawnSync("docker",["compose",`--file=${r}`,"up","--detach","--remove-orphans","--pull=missing","minio"],{env:{...process.env,...m},stdio:"inherit"});H(u,"failed to start MinIO service in docker")}buildPlatforma(e){const r=g.resolve(e.repoRoot,"cmd","platforma"),t=e.binPath??g.join($.tmpdir(),"platforma-local-build");this.logger.info("Building Platforma Backend binary from sources"),this.logger.info(` sources path: ${e.repoRoot}`),this.logger.info(` binary path: ${t}`);const s=T.spawnSync("go",["build","-o",t,"."],{cwd:r,stdio:"inherit"});return H(s,"failed to build platforma binary from sources using 'go build' command"),t}startDockerS3(e,r){const t=O("compose-backend.yaml"),s=(r==null?void 0:r.image)??ie(r==null?void 0:r.version);this.checkLicense(r==null?void 0:r.license,r==null?void 0:r.licenseFile);const i=(...A)=>g.join(e,...A),n=A=>{const S=i(A);return Q(S,{mode:"0775"}),S},c=i("logs","platforma.log");l.existsSync(c)||(l.mkdirSync(g.dirname(c),{recursive:!0}),l.writeFileSync(c,""));const o=(r==null?void 0:r.presignHost)??"localhost",m=M("s3e://testuser:testpassword@minio:9000/main-bucket");if(m.type!=="S3")throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");m.presignEndpoint=`http://${o}:9000`;const u=M("s3e://testuser:testpassword@minio:9000/library-bucket");if(u.type!=="S3")throw new Error(`${u.type} storage type is not supported for library storage`);u.presignEndpoint=`http://${o}:9000`;const b=n("db"),v=n("work"),h=i("users.htpasswd");l.existsSync(h)||l.copyFileSync(O("users.htpasswd"),h);const y=i("compose.yaml");l.existsSync(y)&&this.logger.info(`replacing docker compose file ${y}`);const L=[];for(const A of(r==null?void 0:r.customMounts)??[])L.push({hostPath:A.hostPath,containerPath:A.containerPath??A.hostPath});Ge(t,y,new Map([["minio",{}],["backend",{platform:r==null?void 0:r.platformOverride,mounts:L}]]));const w={MINIO_IMAGE:"quay.io/minio/minio",MINIO_STORAGE:n("minio"),PL_IMAGE:s,PL_AUTH_HTPASSWD_PATH:h,PL_LICENSE:r==null?void 0:r.license,PL_LICENSE_FILE:r==null?void 0:r.licenseFile,PL_LOG_LEVEL:(r==null?void 0:r.logLevel)??"info",PL_LOG_DIR:g.dirname(c),PL_LOG_ROTATION_ENABLED:"true",PL_DATA_DB_ROOT:b,PL_DATA_PRIMARY_ROOT:n("primary"),PL_DATA_LIBRARY_ROOT:n("library"),PL_DATA_WORKDIR_ROOT:v,PL_DATA_PACKAGE_ROOT:n("packages"),...this.configureDockerStorage("primary",m),...this.configureDockerStorage("library",u)};if(r!=null&&r.grpcAddr&&(w.PL_GRPC_ADDR=r.grpcAddr),r!=null&&r.grpcPort&&(w.PL_GRPC_PORT=r.grpcPort.toString()),r!=null&&r.monitoringAddr&&(w.PL_MONITORING_ADDR=r.monitoringAddr),r!=null&&r.monitoringPort&&(w.PL_MONITORING_PORT=r.monitoringPort.toString()),r!=null&&r.debugAddr&&(w.PL_DEBUG_ADDR=r.debugAddr),r!=null&&r.debugPort&&(w.PL_DEBUG_PORT=r.debugPort.toString()),r!=null&&r.auth&&(r.auth.enabled&&(w.PL_AUTH_ENABLED="true"),r.auth.drivers)){for(const A of r.auth.drivers)A.driver==="htpasswd"&&(w.PL_AUTH_HTPASSWD_PATH=g.resolve(A.path),A.path="/etc/platforma/users.htpasswd");w.PL_AUTH_DRIVERS=JSON.stringify(r.auth.drivers)}const k=je(this.logger,["compose",`--file=${y}`,"up","--detach","--remove-orphans","--pull=missing","minio","backend"],{env:w,stdio:"inherit"},{plImage:s,composePath:y});H(k,"failed to start Platforma Backend in Docker"),d.isActive=!0;const R=this.renderRunInfo({apiPort:r==null?void 0:r.grpcPort,apiAddr:r==null?void 0:r.grpcAddr,logPath:c,primary:m,work:{type:"FS",rootPath:v},library:u,dbPath:b});this.logger.info(`Started platforma:
|
|
98
|
+
${R}`)}startDocker(e,r){const t=O("compose-backend.yaml"),s=(r==null?void 0:r.image)??ie(r==null?void 0:r.version);this.checkLicense(r==null?void 0:r.license,r==null?void 0:r.licenseFile);const i=(...S)=>g.join(e,...S),n=S=>{const p=i(S);return Q(p,{mode:"0775"}),p},c=i("logs","platforma.log");l.existsSync(c)||(l.mkdirSync(g.dirname(c),{recursive:!0}),l.writeFileSync(c,""));const o=n("db"),m=n("primary"),u=n("library"),b=n("work"),v=i("users.htpasswd");l.existsSync(v)||l.copyFileSync(O("users.htpasswd"),v);const h=i("compose.yaml");l.existsSync(h)&&this.logger.info(`replacing docker compose file ${h}`);const y=[];for(const S of(r==null?void 0:r.customMounts)??[])y.push({hostPath:S.hostPath,containerPath:S.containerPath??S.hostPath});this.logger.debug(`Rendering docker compose file '${h}' using '${t}' as base template`),Ge(t,h,new Map([["backend",{platform:r==null?void 0:r.platformOverride,mounts:y}]]));const L=M((r==null?void 0:r.primaryStorageURL)??`file:${m}`,"."),w=M((r==null?void 0:r.libraryStorageURL)??`file:${u}`,"."),k={MINIO_IMAGE:"quay.io/minio/minio",MINIO_STORAGE:n("minio"),PL_IMAGE:s,PL_AUTH_HTPASSWD_PATH:v,PL_LICENSE:r==null?void 0:r.license,PL_LICENSE_FILE:r==null?void 0:r.licenseFile,PL_LOG_LEVEL:"info",PL_LOG_DIR:g.dirname(c),PL_LOG_ROTATION_ENABLED:"true",PL_DATA_DB_ROOT:o,PL_DATA_PRIMARY_ROOT:m,PL_DATA_LIBRARY_ROOT:u,PL_DATA_WORKDIR_ROOT:b,PL_DATA_PACKAGE_ROOT:n("packages"),...this.configureDockerStorage("primary",L),...this.configureDockerStorage("library",w)};if(r!=null&&r.grpcAddr&&(k.PL_GRPC_ADDR=r.grpcAddr),r!=null&&r.grpcPort&&(k.PL_GRPC_PORT=r.grpcPort.toString()),r!=null&&r.monitoringAddr&&(k.PL_MONITORING_ADDR=r.monitoringAddr),r!=null&&r.monitoringPort&&(k.PL_MONITORING_PORT=r.monitoringPort.toString()),r!=null&&r.debugAddr&&(k.PL_DEBUG_ADDR=r.debugAddr),r!=null&&r.debugPort&&(k.PL_DEBUG_PORT=r.debugPort.toString()),r!=null&&r.auth&&(r.auth.enabled&&(k.PL_AUTH_ENABLED="true"),r.auth.drivers)){for(const S of r.auth.drivers)S.driver==="htpasswd"&&(k.PL_AUTH_HTPASSWD_PATH=g.resolve(S.path),S.path="/etc/platforma/users.htpasswd");k.PL_AUTH_DRIVERS=JSON.stringify(r.auth.drivers)}const R=je(this.logger,["compose",`--file=${h}`,"up","--detach","--remove-orphans","--pull=missing"],{env:k,stdio:"inherit"},{plImage:s,composePath:h,primaryPath:m,workPath:b,libraryPath:u});H(R,"failed to start Platforma Backend in Docker"),d.isActive=!0;const A=this.renderRunInfo({apiPort:r==null?void 0:r.grpcPort,apiAddr:r==null?void 0:r.grpcAddr,logPath:c,primary:L,work:{type:"FS",rootPath:b},library:w,dbPath:o});this.logger.info(`Started platforma:
|
|
99
|
+
${A}`)}stop(){if(!d.isActive){console.log("no running service detected");return}const e=d.lastRun;switch(e.mode){case"docker":{const r=T.spawnSync("docker",["compose","--file",e.docker.composePath,"down"],{env:{...process.env,...e.envs},stdio:"inherit"});d.isActive=!1,r.status!==0&&process.exit(r.status);return}case"process":{d.isValidPID&&process.kill(e.process.pid),d.isActive=!1;return}default:Y(e.mode)}}cleanup(){var c,o,m,u,b,v,h,y,L,w,k,R,A,S;const e=["last command run cache ('pl-service start' shorthand will stop working until next full start command call)","'platforma' docker compose service containers and volumes"],r=d.data(),t=[r];if((o=(c=d.lastRun)==null?void 0:c.docker)!=null&&o.primaryPath){const p=(u=(m=d.lastRun)==null?void 0:m.docker)==null?void 0:u.primaryPath;p.startsWith(r)||t.push(p)}if((v=(b=d.lastRun)==null?void 0:b.docker)!=null&&v.workPath){const p=(y=(h=d.lastRun)==null?void 0:h.docker)==null?void 0:y.workPath;p.startsWith(r)||t.push(p)}if((w=(L=d.lastRun)==null?void 0:L.process)!=null&&w.storagePath){const p=(R=(k=d.lastRun)==null?void 0:k.process)==null?void 0:R.storagePath;p.startsWith(r)||t.push(p)}const s=t.length>0?` - storages (you'll loose all projects and calculation results stored in service instances):
|
|
100
100
|
- ${t.join(`
|
|
101
|
-
- `)}`:""
|
|
101
|
+
- `)}`:"",i=`
|
|
102
102
|
You are going to reset the state of platforma service
|
|
103
103
|
Things to be removed:
|
|
104
104
|
- ${e.join(`
|
|
105
105
|
- `)}
|
|
106
106
|
${s}
|
|
107
|
-
`;if(this.logger.warn(i),!
|
|
108
|
-
If you want to remove all downloaded platforma binaries, delete '${
|
|
109
|
-
`)}mergeLicenseEnvs(e){e.license===void 0&&((process.env.MI_LICENSE??"")!=""?e.license=process.env.MI_LICENSE:(process.env.PL_LICENSE??"")!=""&&(e.license=process.env.PL_LICENSE)),e["license-file"]===void 0&&e.license===void 0&&((process.env.MI_LICENSE_FILE??"")!=""?e["license-file"]=process.env.MI_LICENSE_FILE:(process.env.PL_LICENSE_FILE??"")!=""?e["license-file"]=process.env.PL_LICENSE_FILE:
|
|
107
|
+
`;if(this.logger.warn(i),!kr("Are you sure?")){this.logger.info("Reset action was canceled");return}const n=new Set(Nr());(S=(A=d.lastRun)==null?void 0:A.docker)!=null&&S.composePath&&n.add(d.lastRun.docker.composePath);for(const p of n)this.logger.info(`Destroying docker compose '${p}'`),this.destroyDocker(p,ie());for(const p of t)this.logger.info(`Destroying '${p}'`),l.rmSync(p,{recursive:!0,force:!0});this.logger.info(`Destroying state dir '${d.path()}'`),l.rmSync(d.path(),{recursive:!0,force:!0}),this.logger.info(`
|
|
108
|
+
If you want to remove all downloaded platforma binaries, delete '${d.binaries()}' dir manually
|
|
109
|
+
`)}mergeLicenseEnvs(e){e.license===void 0&&((process.env.MI_LICENSE??"")!=""?e.license=process.env.MI_LICENSE:(process.env.PL_LICENSE??"")!=""&&(e.license=process.env.PL_LICENSE)),e["license-file"]===void 0&&e.license===void 0&&((process.env.MI_LICENSE_FILE??"")!=""?e["license-file"]=process.env.MI_LICENSE_FILE:(process.env.PL_LICENSE_FILE??"")!=""?e["license-file"]=process.env.PL_LICENSE_FILE:l.existsSync(g.resolve($.homedir(),".pl.license"))&&(e["license-file"]=g.resolve($.homedir(),".pl.license")))}initAuthDriversList(e,r){const t=[];if(e["auth-htpasswd-file"]&&t.push({driver:"htpasswd",path:g.resolve(r,e["auth-htpasswd-file"])}),!!e["auth-ldap-server"]!=!!e["auth-ldap-default-dn"])throw new Error("LDAP auth settings require both 'server' and 'default DN' options to be set");if(e["auth-ldap-server"]&&t.push({driver:"ldap",serverUrl:e["auth-ldap-server"],defaultDN:e["auth-ldap-default-dn"]}),t.length!==0)return[{driver:"jwt",key:this.getLastJwt()},...t]}getLastJwt(){const e=d.path("auth.jwt"),r="utf-8";let t="";return l.existsSync(e)&&(t=l.readFileSync(e,{encoding:r})),t==""&&(t=Sr(64),l.writeFileSync(e,t,{encoding:r})),t}destroyDocker(e,r){const t=d.data("stub"),s=T.spawnSync("docker",["compose","--file",e,"down","--volumes","--remove-orphans"],{env:{...process.env,PL_IMAGE:"scratch",PL_DATA_DB_ROOT:t,PL_DATA_PRIMARY_ROOT:t,PL_DATA_LIBRARY_ROOT:t,PL_DATA_WORKDIR_ROOT:t,PL_DATA_PACKAGE_ROOT:t,MINIO_IMAGE:"scratch",MINIO_STORAGE:t},stdio:"inherit"});s.status!==0&&process.exit(s.status)}checkLicense(e,r){if(!(e!==void 0&&e!="")&&!(r!==void 0&&r!=""))throw this.logger.error(`A license for Platforma Backend must be set.
|
|
110
110
|
|
|
111
111
|
You can provide the license directly using the '--license' flag
|
|
112
112
|
or use the '--license-file' flag if the license is stored in a file.
|
|
@@ -116,6 +116,6 @@ Alternatively, you can set it via the environment variables 'MI_LICENSE' or 'PL_
|
|
|
116
116
|
The license file can also be set with the variables 'MI_LICENSE_FILE' or 'PL_LICENSE_FILE',
|
|
117
117
|
or stored in '$HOME/.pl.license'.
|
|
118
118
|
|
|
119
|
-
You can obtain the license from "https://licensing.milaboratories.com".`),new Error("The license was not provided.")}configureDockerStorage(e,r){const t={},s=r.type;switch(e=e.toUpperCase(),s){case"S3":return t[`PL_DATA_${e}_TYPE`]="S3",t[`PL_DATA_${e}_S3_BUCKET`]=r.bucketName,r.endpoint&&(t[`PL_DATA_${e}_S3_ENDPOINT`]=r.endpoint),r.presignEndpoint&&(t[`PL_DATA_${e}_S3_PRESIGN_ENDPOINT`]=r.presignEndpoint),r.region&&(t[`PL_DATA_${e}_S3_REGION`]=r.region),r.key&&(t[`PL_DATA_${e}_S3_KEY`]=r.key),r.secret&&(t[`PL_DATA_${e}_S3_SECRET`]=r.secret),t;case"FS":return t[`PL_DATA_${e}_TYPE`]="FS",t;default:Y()}return{}}renderRunInfo(e,r=10){var
|
|
120
|
-
`)}readComposeFile(e){const r=
|
|
119
|
+
You can obtain the license from "https://licensing.milaboratories.com".`),new Error("The license was not provided.")}configureDockerStorage(e,r){const t={},s=r.type;switch(e=e.toUpperCase(),s){case"S3":return t[`PL_DATA_${e}_TYPE`]="S3",t[`PL_DATA_${e}_S3_BUCKET`]=r.bucketName,r.endpoint&&(t[`PL_DATA_${e}_S3_ENDPOINT`]=r.endpoint),r.presignEndpoint&&(t[`PL_DATA_${e}_S3_PRESIGN_ENDPOINT`]=r.presignEndpoint),r.region&&(t[`PL_DATA_${e}_S3_REGION`]=r.region),r.key&&(t[`PL_DATA_${e}_S3_KEY`]=r.key),r.secret&&(t[`PL_DATA_${e}_S3_SECRET`]=r.secret),t;case"FS":return t[`PL_DATA_${e}_TYPE`]="FS",t;default:Y()}return{}}renderRunInfo(e,r=10){var c,o;const t=[],s=m=>m.padStart(r," ");switch(e.configPath&&t.push(`${s("config")}: ${e.configPath}`),e.apiAddr?t.push(`${s("API")}: ${e.apiAddr}`):e.apiPort?t.push(`${s("API")}: 127.0.0.1:${e.apiPort.toString()}`):t.push(`${s("API")}: 127.0.0.1:6345`),e.logPath&&t.push(`${s("log")}: ${e.logPath}`),(c=e.primary)==null?void 0:c.type){case void 0:break;case"FS":t.push(`${s("primary")}: ${e.primary.rootPath}`);break;case"S3":t.push(`${s("primary")}: S3 at '${e.primary.endpoint??"AWS"}', bucket '${e.primary.bucketName}', prefix: '${e.primary.keyPrefix??""}'`);break;default:Y()}switch((o=e.library)==null?void 0:o.type){case void 0:break;case"FS":t.push(`${s("library")}: ${e.library.rootPath}`);break;case"S3":t.push(`${s("library")}: S3 at '${e.library.endpoint??"AWS"}', bucket '${e.library.bucketName}', prefix: '${e.library.keyPrefix??""}'`);break;default:Y()}return e.work&&t.push(`${s("workdirs")}: ${e.work.rootPath}`),e.dbPath&&t.push(`${s("db")}: ${e.dbPath}`),t.join(`
|
|
120
|
+
`)}readComposeFile(e){const r=l.readFileSync(e);return X.parse(r.toString())}writeComposeFile(e,r){l.writeFileSync(e,X.stringify(r))}}function H(a,e){if(a.error)throw a.error;const r=e??"failed to run command";if(a.status!==0)throw new Error(`${r}, process exited with code '${a.status}'`)}const G=class G extends f.Command{async run(){const{flags:e}=await this.parse(G),r=N(e["log-level"]);new x(r).cleanup()}};P(G,"description","Clear service state (forget last run command, destroy docker services, volumes and so on)"),P(G,"examples",["<%= config.bin %> <%= command.id %>"]),P(G,"flags",{...D});let oe=G;const U=class U extends f.Command{async run(){const{flags:e}=await this.parse(U),r=N(e["log-level"]);new x(r).startLast()}};P(U,"description","Start last run service configuraiton"),P(U,"examples",["<%= config.bin %> <%= command.id %>"]),P(U,"flags",{...D});let de=U;const W=class W extends f.Command{async run(){const{flags:e}=await this.parse(W),r=N(e["log-level"]);new x(r).stop()}};P(W,"description","Stop platforma service"),P(W,"examples",["<%= config.bin %> <%= command.id %>"]),P(W,"flags",{...D});let ge=W;const q=class q extends f.Command{async run(){const{flags:e}=await this.parse(q),r=N(e["log-level"]),t=new x(r);t.mergeLicenseEnvs(e);const s=e["auth-enabled"],i=s?{enabled:s,drivers:t.initAuthDriversList(e,".")}:void 0,n=e.storage?g.join(".",e.storage):d.data("docker"),c=[];for(const m of e.mount??[])c.push({hostPath:m});const o=e.arch?`linux/${e.arch}`:void 0;t.startDocker(n,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:o,customMounts:c,license:e.license,licenseFile:e["license-file"],auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]})}};P(q,"description","Run platforma backend service with 'FS' primary storage type"),P(q,"examples",["<%= config.bin %> <%= command.id %>"]),P(q,"flags",{...D,...te,...qe,...ee,...Je,...se,...re,...ze,...ae,...ye,...he,...Pe});let ue=q;const J=class J extends f.Command{async run(){const{flags:e}=await this.parse(J),r=N(e["log-level"]),t=new x(r);t.mergeLicenseEnvs(e);const s=e["pl-workdir"]??".",i=e.storage?g.join(s,e.storage):d.data("local"),n=e["pl-log-file"]?g.join(s,e["pl-log-file"]):void 0,c=t.initAuthDriversList(e,s),o=e["auth-enabled"]??c!==void 0;var m=e["pl-binary"];e["pl-sources"]&&(m=t.buildPlatforma({repoRoot:e["pl-sources"]}));var u="127.0.0.1:6345";e["grpc-listen"]?u=e["grpc-listen"]:e["grpc-port"]&&(u=`127.0.0.1:${e["grpc-port"]}`);var b="127.0.0.1:9090";e["monitoring-listen"]?b=e["monitoring-listen"]:e["monitoring-port"]&&(b=`127.0.0.1:${e["monitoring-port"]}`);var v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const h={binaryPath:m,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:u},monitoring:{listen:b},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:n},localRoot:i,core:{auth:{enabled:o,drivers:c}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};h.binaryPath?t.startLocal(h):sr(r,{version:e.version}).then(()=>t.startLocal(h)).catch(function(y){r.error(y.message)})}};P(J,"description","Run Platforma Backend service as local process on current host (no docker container)"),P(J,"examples",["<%= config.bin %> <%= command.id %>"]),P(J,"flags",{...D,...ee,...te,...Ke,...Ve,...Qe,...re,...ae,...ye,...he,...Pe,...He,...Ye,...se});let fe=J;var _;let Kr=(_=class extends f.Command{async run(){const{flags:e}=await this.parse(_),r=N(e["log-level"]),t=new x(r);t.mergeLicenseEnvs(e);const s=e["auth-enabled"],i=s?{enabled:s,drivers:t.initAuthDriversList(e,".")}:void 0,n=e.storage?g.join(".",e.storage):d.data("docker-s3"),c=[];for(const u of e.mount??[])c.push({hostPath:u});const o=e.arch?`linux/${e.arch}`:void 0,m=e["minio-presign-host"]?"minio":"localhost";t.startDockerS3(n,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:o,customMounts:c,auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"],presignHost:m})}},P(_,"description","Run platforma backend service with 'S3' primary storage type"),P(_,"examples",["<%= config.bin %> <%= command.id %>"]),P(_,"flags",{...D,...te,...qe,...ee,...Je,...se,...re,...ze,...ae,...yr}),_);const z=class z extends f.Command{async run(){const{flags:e}=await this.parse(z),r=N(e["log-level"]),t=new x(r);t.mergeLicenseEnvs(e);const s=e["pl-workdir"]??".",i=e.storage?g.join(s,e.storage):d.data("local-s3"),n=e["pl-log-file"]?g.join(s,e["pl-log-file"]):void 0,c=t.initAuthDriversList(e,s),o=e["auth-enabled"]??c!==void 0;var m=e["pl-binary"];e["pl-sources"]&&(m=t.buildPlatforma({repoRoot:e["pl-sources"]}));var u="127.0.0.1:6345";e["grpc-listen"]?u=e["grpc-listen"]:e["grpc-port"]&&(u=`127.0.0.1:${e["grpc-port"]}`);var b="127.0.0.1:9090";e["monitoring-listen"]?b=e["monitoring-listen"]:e["monitoring-port"]&&(b=`127.0.0.1:${e["monitoring-port"]}`);var v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const h={binaryPath:m,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-address-port"],minioConsolePort:e["s3-console-address-port"],configOptions:{grpc:{listen:u},monitoring:{listen:b},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:n},localRoot:i,core:{auth:{enabled:o,drivers:c}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};h.binaryPath?t.startLocalS3(h):sr(r,{version:e.version}).then(()=>t.startLocalS3(h)).catch(function(y){r.error(y.message)})}};P(z,"description","Run Platforma Backend service as local process on current host (no docker container)"),P(z,"examples",["<%= config.bin %> <%= command.id %>"]),P(z,"flags",{...D,...ee,...te,...hr,...Ke,...Ve,...Qe,...re,...ae,...ye,...he,...Pe,...He,...Ye,...se});let me=z;const Vr={"create-block":ce,reset:oe,start:de,stop:ge,"start:docker":ue,"start:local":fe,"start:docker:s3":Kr,"start:local:s3":me};exports.COMMANDS=Vr;
|
|
121
121
|
//# sourceMappingURL=index.js.map
|