@platforma-sdk/bootstrap 3.1.7 → 3.1.9
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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`})},Rr={"auth-enabled":u.Flags.boolean({description:"enable authorization"})},Er={"auth-htpasswd-file":u.Flags.file({description:"path to .htpasswd file with Platforma users (static user DB auth source)"})},Tr={"auth-ldap-server":u.Flags.string({description:"address of LDAP server to use for auth in Platforma (auth source)"})},Dr={"auth-ldap-default-dn":u.Flags.string({description:"DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"})},B={...Rr,...Er,...Tr,...Dr};function xr(a){return Q.question(`${a} [y/N] `).toLowerCase()==="y"}function U(a){throw new Error("this should never happen")}function A(a="debug"){return de.createLogger({level:a,format:de.format.printf(({level:e,message:t})=>{const r=" ".repeat(e.length+2);if(typeof t!="string"){const i=JSON.stringify(t);throw Error(`logger message ${i} is not a string`)}const n=t.split(`
|
|
10
10
|
`).map((i,c)=>c===0?i:r+i).join(`
|
|
11
11
|
`);return`${(i=>de.format.colorize().colorize(i,i))(e)}: ${n}`}),transports:[new de.transports.Console({stderrLevels:["error","warn","info","debug"],handleExceptions:!0})]})}function _r(a){return Sr.randomBytes(Math.ceil(a/2)).toString("hex").slice(0,a)}function Nr(a){return a.startsWith("~")?h.join(D.homedir(),a.slice(1)):a}function ke(a,e){m.existsSync(a)||(m.mkdirSync(a,{recursive:!0}),e!=null&&e.mode&&m.chmodSync(a,e.mode))}function Cr(a){try{if(D.platform()!=="win32")return ne.execSync(`ps -p ${a} -o comm=`,{encoding:"utf8"}).trim();const e=`wmic process where processid=${a} get Caption`,t=ne.execSync(e,{encoding:"utf8"}).split(`
|
|
12
|
-
`);return t.length<=1?"":t[1].trim()}catch{return""}}function Mr(a){const e=ne.execSync(`docker compose ls --filter name=${a} --format json`,{encoding:"utf8"}).trim(),t=JSON.parse(e);for(const r of t)if(r.Name===a)return r}const Ae=["Python"],hr=["Tengo","Python"],jr=x.z.union([x.z.literal("Tengo"),x.z.literal("Python")]),Br=x.z.object({npmOrgName:x.z.string().min(1),orgName:x.z.string().min(1,{message:"Organization name must be provided"}),blockName:x.z.string().min(1,{message:"Block name must be provided"}),softwarePlatforms:x.z.array(jr).refine(a=>new Set(a).size===a.length,{message:"Must be an array of unique software platforms"})});async function Ur(a){const{npmOrgName:e,orgName:t,blockName:r,softwarePlatforms:n}=Gr(),s=h.join(process.cwd(),r);a.info("Downloading boilerplate code..."),await qr("https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip","platforma-block-boilerplate-main",s);const i=hr.filter(o=>n.indexOf(o)<0),c=Ae.length==i.length;a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);for(const o of i)await Jr(s,o);c&&await Hr(s),a.info("Replace everything in the template with provided options..."),Wr(s,[{from:/@platforma-open(?!.*runenv-python-3)/g,to:`@${e}`},{from:/my-org/g,to:t},{from:/block-boilerplate/g,to:r}])}function Gr(){let a=Q.question('Write an organization name for npm. Default is "platforma-open": ');a===""&&(a="platforma-open");
|
|
12
|
+
`);return t.length<=1?"":t[1].trim()}catch{return""}}function Mr(a){const e=ne.execSync(`docker compose ls --filter name=${a} --format json`,{encoding:"utf8"}).trim(),t=JSON.parse(e);for(const r of t)if(r.Name===a)return r}const Ae=["Python"],hr=["Tengo","Python"],jr=x.z.union([x.z.literal("Tengo"),x.z.literal("Python")]),Br=x.z.object({npmOrgName:x.z.string().min(1),orgName:x.z.string().min(1,{message:"Organization name must be provided"}),blockName:x.z.string().min(1,{message:"Block name must be provided"}),softwarePlatforms:x.z.array(jr).refine(a=>new Set(a).size===a.length,{message:"Must be an array of unique software platforms"})});async function Ur(a){const{npmOrgName:e,orgName:t,blockName:r,softwarePlatforms:n}=Gr(),s=h.join(process.cwd(),r);a.info("Downloading boilerplate code..."),await qr("https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip","platforma-block-boilerplate-main",s);const i=hr.filter(o=>n.indexOf(o)<0),c=Ae.length==i.length;a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);for(const o of i)await Jr(s,o);c&&await Hr(s),a.info("Replace everything in the template with provided options..."),Wr(s,[{from:/@platforma-open(?!.*runenv-python-3)/g,to:`@${e}`},{from:/my-org/g,to:t},{from:/block-boilerplate/g,to:r}])}function Gr(){let a=Q.question('Write an organization name for npm. Default is "platforma-open": ');a===""&&(a="platforma-open");let e="";for(;e.length<1;)e=Q.question('Write an organization name, e.g. "my-org": ');let t="";for(;t.length<1;)t=Q.question('Write a name of the block, e.g. "hello-world": ');const r=Q.keyInYN("Create package for block's software?");let n=["Tengo"];if(r)for(;n.length<hr.length;){const i=Q.keyInSelect(Ae,"Choose software platform:");if(i<0)break;n.push(Ae[i])}n=Array.from(new Set(n)).sort();const s=Br.safeParse({npmOrgName:a,orgName:e,blockName:t,softwarePlatforms:n});if(!s.success&&s.error.issues.length)throw new Error(s.error.issues.map(i=>i.message).join("; "));return s.data}async function qr(a,e,t){const n=await(await fetch(a)).blob(),s=await _.mkdtemp(h.join(D.tmpdir(),"create-repo")),i=h.join(s,"packed-repo.zip"),c=Lr.Writable.toWeb(m.createWriteStream(i));await n.stream().pipeTo(c);const o=h.join(s,"unpacked-repo");await _.mkdir(o),await Ar(i,o),await _.cp(h.join(o,e),t,{recursive:!0})}async function Jr(a,e){const t=e.toLowerCase();await X(h.join(a,"ui","src","pages","MainPage.vue"),new RegExp(`.*${t}Message.*\\n\\n`,"g")),await X(h.join(a,"model","src","index.ts"),new RegExp(`.*${t}Message.*\\n\\n`,"g")),await X(h.join(a,"workflow","src","main.tpl.tengo"),new RegExp(`.*${t}.*exec.builder.*[\\s\\S]*?\\n\\n`,"g")),await X(h.join(a,"workflow","src","main.tpl.tengo"),new RegExp(`.*${t}Message.*\\n`,"g")),await X(h.join(a,"workflow","src","wf.test.ts"),new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`,"g")),await _.rm(h.join(a,"software",`src_${t}`),{recursive:!0}),await je(h.join(a,"software","package.json"),r=>{const n=JSON.parse(r);return delete n["block-software"].artifacts[`hello-${t}-artifact`],delete n["block-software"].entrypoints[`hello-world-${t}`],JSON.stringify(n,null,2)})}async function Hr(a){await _.rm(h.join(a,"software"),{recursive:!0}),await je(h.join(a,"workflow","package.json"),e=>{const t=JSON.parse(e);return delete t.dependencies["@platforma-open/my-org.block-boilerplate.software"],JSON.stringify(t,null,2)}),await X(h.join(a,"pnpm-workspace.yaml"),/.*- software$\n/gm)}async function Wr(a,e){const t=await zr(a);for(const{from:r,to:n}of e)for(const s of t)await yr(s,r,n)}async function zr(a){return(await _.readdir(a,{withFileTypes:!0,recursive:!0})).filter(t=>t.isFile()).map(t=>h.join(t.parentPath,t.name))}async function je(a,e){const t=await _.readFile(a),r=e(t.toString());await _.writeFile(a,r)}async function yr(a,e,t){return await je(a,r=>r.replaceAll(e,t))}async function X(a,e){return await yr(a,e,"")}const Z=class Z extends u.Command{async run(){const{flags:e}=await this.parse(Z),t=A(e["log-level"]);await Ur(t)}};l(Z,"description","Helps to create a new block by downloading a block's template."),l(Z,"examples",["<%= name %>"]),l(Z,"flags",{...L});let Ie=Z;function br(...a){return h.resolve(__dirname,"..",...a)}function V(...a){return br("assets",...a)}function Se(...a){return m.readFileSync(br(...a))}function lr(a){return a||(a=ue.getDefaultPlVersion()),`quay.io/milaboratories/platforma:${a}`}const G=class G{constructor(e){l(this,"state",{currentInstance:""});l(this,"filePath");l(this,"dirPath");e=e??h.resolve(D.homedir(),".config","pl-bootstrap");const t=h.join(e,"state.json");this.dirPath=e,this.filePath=t,m.existsSync(e)||m.mkdirSync(e,{recursive:!0}),m.existsSync(t)&&(this.state=JSON.parse(Se(t).toString()))}static getStateInstance(){return G.instance||(G.instance=new G),G.instance}path(...e){return h.join(this.dirPath,...e)}instanceDir(e,...t){return e?this.path("data",e,...t):this.path("data")}binaries(...e){return this.path("binaries",...e)}writeState(){m.writeFileSync(this.filePath,JSON.stringify(this.state))}get instanceList(){return m.existsSync(this.instanceDir())?m.readdirSync(this.instanceDir()).filter(t=>this.instanceExists(t)):[]}instanceExists(e){return m.existsSync(this.instanceDir(e,"instance.json"))}getInstanceInfo(e){const t=this.instanceDir(e,"instance.json");if(!m.existsSync(t))throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);const r=JSON.parse(Se(t).toString());return{name:e,...r}}setInstanceInfo(e,t){m.existsSync(this.instanceDir(e))||m.mkdirSync(this.instanceDir(e),{recursive:!0});const r=this.instanceDir(e,"instance.json");let n={};m.existsSync(r)&&(n=JSON.parse(Se(r).toString())),m.writeFileSync(r,JSON.stringify({...n,...t}))}isInstanceActive(e){switch(e.type){case"docker":{const r=Mr(`pl-${e.name}`);return r?r.Status.trim().startsWith("running"):!1}case"process":return e.pid?dr(e.pid):!1;default:throw U(),new Error("cli logic error: unknown service type, cannot check its state")}}get isActive(){for(const e of this.instanceList){const t=this.getInstanceInfo(e);if(this.isInstanceActive(t))return!0}return!1}isValidPID(e){return dr(e)}get currentInstance(){const e=this.state.currentInstance;if(e&&this.instanceExists(e))return this.getInstanceInfo(e)}get currentInstanceName(){return this.state.currentInstance}set currentInstanceName(e){this.state.currentInstance=e,this.writeState()}selectInstance(e){if(!this.instanceExists(e))throw new Error(`instance '${e}' does not exist`);this.state.currentInstance=e,this.writeState()}};l(G,"instance");let Oe=G;function dr(a){const e=Cr(a);return e==="platforma"||e.endsWith("/platforma")||e.endsWith("\\platforma")}const f=Oe.getStateInstance();function $e(a,e,t){const r=[],n=[];for(const s of e)if(t={cwd:s.workdir,env:{...s.envs,...t==null?void 0:t.env},...s.runOpts,...t},s.async){const i=Yr(a,s.cmd,s.args,t);n.push(i)}else{const i=Vr(a,s.cmd,s.args,t);if(r.push(i),i.error||i.status!==0)break}return{executed:r,spawned:n}}function Yr(a,e,t,r){var c;a.debug(`Running:
|
|
13
13
|
env: ${JSON.stringify(r.env)}
|
|
14
14
|
cmd: ${JSON.stringify([e,...t])}
|
|
15
15
|
wd: ${(c=r.cwd)==null?void 0:c.toString()}`),r.env={...process.env,...r.env},a.debug(" spawning child process");const n=ne.spawn(e,t,r);let s=!1;const i=()=>{n.kill("SIGINT"),s=!0};return a.debug(" setting up signal handler"),process.on("SIGINT",i),n.on("close",o=>{process.removeListener("SIGINT",i),s&&process.exit(o)}),n}function Vr(a,e,t,r){return a.debug(`Running:
|
|
@@ -114,5 +114,5 @@ The license file can also be set with the variables 'MI_LICENSE_FILE' or 'PL_LIC
|
|
|
114
114
|
or stored in '$HOME/.pl.license'.
|
|
115
115
|
|
|
116
116
|
You can obtain the license from "https://licensing.milaboratories.com".`),new Error("The license was not provided.")}configureDockerStorage(e,t){const r={},n=t.type;switch(e=e.toUpperCase(),n){case"S3":return r[`PL_DATA_${e}_TYPE`]="S3",r[`PL_DATA_${e}_S3_BUCKET`]=t.bucketName,t.endpoint&&(r[`PL_DATA_${e}_S3_ENDPOINT`]=t.endpoint),t.presignEndpoint&&(r[`PL_DATA_${e}_S3_PRESIGN_ENDPOINT`]=t.presignEndpoint),t.region&&(r[`PL_DATA_${e}_S3_REGION`]=t.region),t.key&&(r[`PL_DATA_${e}_S3_KEY`]=t.key),t.secret&&(r[`PL_DATA_${e}_S3_SECRET`]=t.secret),r;case"FS":return r[`PL_DATA_${e}_TYPE`]="FS",r;default:U()}return{}}renderRunInfo(e,t=10){var c,o;const r=[],n=d=>d.padStart(t," ");switch(e.configPath&&r.push(`${n("config")}: ${e.configPath}`),e.apiAddr?r.push(`${n("API")}: ${e.apiAddr}`):e.apiPort?r.push(`${n("API")}: 127.0.0.1:${e.apiPort.toString()}`):r.push(`${n("API")}: 127.0.0.1:6345`),e.logPath&&r.push(`${n("log")}: ${e.logPath}`),(c=e.primary)==null?void 0:c.type){case void 0:break;case"FS":r.push(`${n("primary")}: ${e.primary.rootPath}`);break;case"S3":r.push(`${n("primary")}: S3 at '${e.primary.endpoint??"AWS"}', bucket '${e.primary.bucketName}', prefix: '${e.primary.keyPrefix??""}'`);break;default:U()}switch((o=e.library)==null?void 0:o.type){case void 0:break;case"FS":r.push(`${n("library")}: ${e.library.rootPath}`);break;case"S3":r.push(`${n("library")}: S3 at '${e.library.endpoint??"AWS"}', bucket '${e.library.bucketName}', prefix: '${e.library.keyPrefix??""}'`);break;default:U()}return e.work&&r.push(`${n("workdirs")}: ${e.work.rootPath}`),e.dbPath&&r.push(`${n("db")}: ${e.dbPath}`),r.join(`
|
|
117
|
-
`)}}function ge(a,e){for(const t of a){if(t.error)throw t.error;const r=e??"failed to run command";if(t.status!==0)throw new Error(`${r}, process exited with code '${t.status}'`)}}const ee=class ee extends u.Command{async run(){const{flags:e}=await this.parse(ee),t=A(e["log-level"]);new I(t).cleanupInstance()}};l(ee,"description","Clear service state (forget last run command, destroy docker services, volumes and so on)"),l(ee,"examples",["<%= config.bin %> <%= command.id %>"]),l(ee,"flags",{...L});let Fe=ee;const re=class re extends u.Command{async run(){const{flags:e}=await this.parse(re),t=A(e["log-level"]);new I(t).startLast()}};l(re,"description","Start last run service configuraiton"),l(re,"examples",["<%= config.bin %> <%= command.id %>"]),l(re,"flags",{...L});let Re=re;const te=class te extends u.Command{async run(){const{flags:e}=await this.parse(te),t=A(e["log-level"]),r=new I(t);f.currentInstance?r.stopInstance(f.currentInstance):t.warn("up/start command was not called for any instance, nothing to stop")}};l(te,"description","Stop platforma service"),l(te,"examples",["<%= config.bin %> <%= command.id %>"]),l(te,"flags",{...L});let Ee=te;var F;let it=(F=class extends u.Command{async run(){const{flags:e}=await this.parse(F),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const y of e.mount??[])o.push({hostPath:y});const d=e.arch?`linux/${e.arch}`:void 0,g=r.createDocker(n,c,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:d,customMounts:o,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"]});r.switchInstance(g)}},l(F,"description","Run platforma backend service with 'FS' primary storage type"),l(F,"examples",["<%= config.bin %> <%= command.id %>"]),l(F,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),F);var R;let ct=(R=class extends u.Command{async run(){const{flags:e}=await this.parse(R),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let 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 b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocal(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(R,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(R,"examples",["<%= config.bin %> <%= command.id %>"]),l(R,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),R);const q=class q extends u.Command{async run(){const{flags:e,args:t}=await this.parse(q),r=A(e["log-level"]),n=new I(r),s=t.name;e.all&&(n.cleanupInstance(),process.exit(0)),s||(r.error("Please, specify name of instance to be removed or set '--all' flag instead"),process.exit(1)),n.cleanupInstance(s)}};l(q,"description","List available instances"),l(q,"examples",["<%= config.bin %> <%= command.id %>"]),l(q,"flags",{...L,all:u.Flags.boolean({description:"remove all known instances",required:!1})}),l(q,"args",{name:u.Args.string({required:!1})});let Te=q;const J=class J extends u.Command{async run(){const{flags:e,args:t}=await this.parse(J),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.info("no pl service instance selected. No service was stopped"),process.exit(0)),n.stopInstance(f.getInstanceInfo(s))}};l(J,"description","List available instances"),l(J,"examples",["<%= config.bin %> <%= command.id %>"]),l(J,"flags",{...L}),l(J,"args",{name:u.Args.string({required:!1})});let De=J;const ae=class ae extends u.Command{async run(){await this.parse(ae);const e=f.instanceList,t=f.currentInstanceName;for(const r of e){const n=[],s=f.getInstanceInfo(r);f.isInstanceActive(s)&&n.push("status:up"),n.push(`type:${s.type}`),console.log(r===t?` * ${r} (${n.join(", ")})`:` ${r} (${n.join(", ")})`)}}};l(ae,"description","List available instances"),l(ae,"examples",["<%= config.bin %> <%= command.id %>"]),l(ae,"flags",{});let xe=ae;const H=class H extends u.Command{async run(){const{flags:e,args:t}=await this.parse(H),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"),process.exit(1));const i=n.switchInstance(f.getInstanceInfo(s)),c=[];for(const o of i)c.push(new Promise((d,g)=>{o.on("close",d),o.on("error",g)}));await Promise.all(c)}};l(H,"description","List available instances"),l(H,"examples",["<%= config.bin %> <%= command.id %>"]),l(H,"flags",{...L}),l(H,"args",{name:u.Args.string({required:!1})});let _e=H;var E;let ot=(E=class extends u.Command{async run(){const{flags:e}=await this.parse(E),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker-s3",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const w of e.mount??[])o.push({hostPath:w});const d=e.arch?`linux/${e.arch}`:void 0,g=e["minio-presign-host"]?"minio":"localhost",y=r.createDockerS3(n,c,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:d,customMounts:o,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:g});r.switchInstance(y)}},l(E,"description","Run platforma backend service with 'S3' primary storage type"),l(E,"examples",["<%= config.bin %> <%= command.id %>"]),l(E,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),E);var T;let lt=(T=class extends u.Command{async run(){const{flags:e}=await this.parse(T),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local-s3",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let 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 b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocalS3(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(T,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(T,"examples",["<%= config.bin %> <%= command.id %>"]),l(T,"flags",{...L,...N,...M,...fr,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),T);const W=class W extends u.Command{async run(){const{flags:e,args:t}=await this.parse(W),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const y of e.mount??[])d.push({hostPath:y});const g=e.arch?`linux/${e.arch}`:void 0;n.createDocker(s,o,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:g,customMounts:d,license:e.license,licenseFile:e["license-file"],auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]}),r.info(`Instance '${s}' was created. To start it run 'up' command`)}};l(W,"description","Run Platforma Backend service as docker container on current host"),l(W,"examples",["<%= config.bin %> <%= command.id %>"]),l(W,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),l(W,"args",{name:u.Args.string({required:!0})});let Ne=W;var O;let dt=(O=class extends u.Command{async run(){const{flags:e,args:t}=await this.parse(O),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(n.createLocal(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S){r.error(S.message)})}},l(O,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(O,"examples",["<%= config.bin %> <%= command.id %>"]),l(O,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(O,"args",{name:u.Args.string({required:!0})}),O);const z=class z extends u.Command{async run(){const{flags:e,args:t}=await this.parse(z),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const w of e.mount??[])d.push({hostPath:w});const g=e.arch?`linux/${e.arch}`:void 0,y=e["minio-presign-host"]?"minio":"localhost";n.createDockerS3(s,o,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:g,customMounts:d,auth:c,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:y}),r.info(`Instance '${s}' was created. To start it run 'up' command`),e["minio-presign-host"]&&r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address")}};l(z,"description","Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"),l(z,"examples",["<%= config.bin %> <%= command.id %>"]),l(z,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),l(z,"args",{name:u.Args.string({required:!0})});let Ce=z;const Y=class Y extends u.Command{async run(){const{flags:e,args:t}=await this.parse(Y),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(r.info("Creating instance configuration, data directory and other stuff..."),n.createLocalS3(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S){r.error(S.message)})}};l(Y,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(Y,"examples",["<%= config.bin %> <%= command.id %>"]),l(Y,"flags",{...L,...N,...fr,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(Y,"args",{name:u.Args.string({required:!0})});let Me=Y;const gt={"create-block":Ie,reset:Fe,start:Re,stop:Ee,"start:docker":it,"start:local":ct,"svc:delete":Te,"svc:down":De,"svc:list":xe,"svc:up":_e,"start:docker:s3":ot,"start:local:s3":lt,"svc:create:docker":Ne,"svc:create:local":dt,"svc:create:docker:s3":Ce,"svc:create:local:s3":Me};exports.COMMANDS=gt;
|
|
117
|
+
`)}}function ge(a,e){for(const t of a){if(t.error)throw t.error;const r=e??"failed to run command";if(t.status!==0)throw new Error(`${r}, process exited with code '${t.status}'`)}}const ee=class ee extends u.Command{async run(){const{flags:e}=await this.parse(ee),t=A(e["log-level"]);new I(t).cleanupInstance()}};l(ee,"description","Clear service state (forget last run command, destroy docker services, volumes and so on)"),l(ee,"examples",["<%= config.bin %> <%= command.id %>"]),l(ee,"flags",{...L});let Fe=ee;const re=class re extends u.Command{async run(){const{flags:e}=await this.parse(re),t=A(e["log-level"]);new I(t).startLast()}};l(re,"description","Start last run service configuraiton"),l(re,"examples",["<%= config.bin %> <%= command.id %>"]),l(re,"flags",{...L});let Re=re;const te=class te extends u.Command{async run(){const{flags:e}=await this.parse(te),t=A(e["log-level"]),r=new I(t);f.currentInstance?r.stopInstance(f.currentInstance):t.warn("up/start command was not called for any instance, nothing to stop")}};l(te,"description","Stop platforma service"),l(te,"examples",["<%= config.bin %> <%= command.id %>"]),l(te,"flags",{...L});let Ee=te;var F;let it=(F=class extends u.Command{async run(){const{flags:e}=await this.parse(F),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const y of e.mount??[])o.push({hostPath:y});const d=e.arch?`linux/${e.arch}`:void 0,g=r.createDocker(n,c,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:d,customMounts:o,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"]});r.switchInstance(g)}},l(F,"description","Run platforma backend service with 'FS' primary storage type"),l(F,"examples",["<%= config.bin %> <%= command.id %>"]),l(F,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),F);var R;let ct=(R=class extends u.Command{async run(){const{flags:e}=await this.parse(R),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let 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 b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocal(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(R,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(R,"examples",["<%= config.bin %> <%= command.id %>"]),l(R,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),R);const q=class q extends u.Command{async run(){const{flags:e,args:t}=await this.parse(q),r=A(e["log-level"]),n=new I(r),s=t.name;e.all&&(n.cleanupInstance(),process.exit(0)),s||(r.error("Please, specify name of instance to be removed or set '--all' flag instead"),process.exit(1)),n.cleanupInstance(s)}};l(q,"description","List available instances"),l(q,"examples",["<%= config.bin %> <%= command.id %>"]),l(q,"flags",{...L,all:u.Flags.boolean({description:"remove all known instances",required:!1})}),l(q,"args",{name:u.Args.string({required:!1})});let Te=q;const J=class J extends u.Command{async run(){const{flags:e,args:t}=await this.parse(J),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.info("no pl service instance selected. No service was stopped"),process.exit(0)),n.stopInstance(f.getInstanceInfo(s))}};l(J,"description","List available instances"),l(J,"examples",["<%= config.bin %> <%= command.id %>"]),l(J,"flags",{...L}),l(J,"args",{name:u.Args.string({required:!1})});let De=J;const ae=class ae extends u.Command{async run(){await this.parse(ae);const e=f.instanceList,t=f.currentInstanceName;for(const r of e){const n=[],s=f.getInstanceInfo(r);f.isInstanceActive(s)&&n.push("status:up"),n.push(`type:${s.type}`),console.log(r===t?` * ${r} (${n.join(", ")})`:` ${r} (${n.join(", ")})`)}}};l(ae,"description","List available instances"),l(ae,"examples",["<%= config.bin %> <%= command.id %>"]),l(ae,"flags",{});let xe=ae;const H=class H extends u.Command{async run(){const{flags:e,args:t}=await this.parse(H),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"),process.exit(1));const i=n.switchInstance(f.getInstanceInfo(s)),c=[];for(const o of i)c.push(new Promise((d,g)=>{o.on("close",d),o.on("error",g)}));await Promise.all(c)}};l(H,"description","List available instances"),l(H,"examples",["<%= config.bin %> <%= command.id %>"]),l(H,"flags",{...L}),l(H,"args",{name:u.Args.string({required:!1})});let _e=H;var E;let ot=(E=class extends u.Command{async run(){const{flags:e}=await this.parse(E),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker-s3",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const w of e.mount??[])o.push({hostPath:w});const d=e.arch?`linux/${e.arch}`:void 0,g=e["minio-presign-host"]?"minio":"localhost",y=r.createDockerS3(n,c,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:d,customMounts:o,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:g});r.switchInstance(y)}},l(E,"description","Run platforma backend service with 'S3' primary storage type"),l(E,"examples",["<%= config.bin %> <%= command.id %>"]),l(E,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),E);var T;let lt=(T=class extends u.Command{async run(){const{flags:e}=await this.parse(T),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local-s3",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let 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 b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocalS3(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(T,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(T,"examples",["<%= config.bin %> <%= command.id %>"]),l(T,"flags",{...L,...N,...M,...fr,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),T);const W=class W extends u.Command{async run(){const{flags:e,args:t}=await this.parse(W),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const y of e.mount??[])d.push({hostPath:y});const g=e.arch?`linux/${e.arch}`:void 0;n.createDocker(s,o,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:g,customMounts:d,license:e.license,licenseFile:e["license-file"],auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]}),r.info(`Instance '${s}' was created. To start it run 'up' command`)}};l(W,"description","Run Platforma Backend service as docker container on current host"),l(W,"examples",["<%= config.bin %> <%= command.id %>"]),l(W,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),l(W,"args",{name:u.Args.string({required:!0})});let Ne=W;var O;let dt=(O=class extends u.Command{async run(){const{flags:e,args:t}=await this.parse(O),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(n.createLocal(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(S){r.error(S.message)})}},l(O,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(O,"examples",["<%= config.bin %> <%= command.id %>"]),l(O,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(O,"args",{name:u.Args.string({required:!0})}),O);const z=class z extends u.Command{async run(){const{flags:e,args:t}=await this.parse(z),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const w of e.mount??[])d.push({hostPath:w});const g=e.arch?`linux/${e.arch}`:void 0,y=e["minio-presign-host"]?"minio":"localhost";n.createDockerS3(s,o,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:g,customMounts:d,auth:c,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:y}),r.info(`Instance '${s}' was created. To start it run 'up' command`),e["minio-presign-host"]&&r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address")}};l(z,"description","Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"),l(z,"examples",["<%= config.bin %> <%= command.id %>"]),l(z,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),l(z,"args",{name:u.Args.string({required:!0})});let Ce=z;const Y=class Y extends u.Command{async run(){const{flags:e,args:t}=await this.parse(Y),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(r.info("Creating instance configuration, data directory and other stuff..."),n.createLocalS3(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(S){r.error(S.message)})}};l(Y,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(Y,"examples",["<%= config.bin %> <%= command.id %>"]),l(Y,"flags",{...L,...N,...fr,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(Y,"args",{name:u.Args.string({required:!0})});let Me=Y;const gt={"create-block":Ie,reset:Fe,start:Re,stop:Ee,"start:docker":it,"start:local":ct,"svc:delete":Te,"svc:down":De,"svc:list":xe,"svc:up":_e,"start:docker:s3":ot,"start:local:s3":lt,"svc:create:docker":Ne,"svc:create:local":dt,"svc:create:docker:s3":Ce,"svc:create:local:s3":Me};exports.COMMANDS=gt;
|
|
118
118
|
//# sourceMappingURL=index.js.map
|