From a47aae61bd8e12cecf3a966dfeaa9d29daf48767 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Fri, 19 Nov 2021 18:18:01 -0500 Subject: [PATCH 1/9] refactor and move functions to utils for reuse --- build/commands/deploy.js | 4 +- build/commands/deploy.js.map | 2 +- build/common/src/hzn.d.ts | 4 +- build/common/src/hzn.js | 117 ++++++---------------------------- build/common/src/hzn.js.map | 2 +- build/common/src/utils.d.ts | 6 +- build/common/src/utils.js | 55 +++++++++++++++- build/common/src/utils.js.map | 2 +- package-lock.json | 4 +- src/commands/deploy.ts | 7 +- src/common/src/hzn.ts | 82 ++---------------------- src/common/src/utils.ts | 59 ++++++++++++++++- 12 files changed, 152 insertions(+), 192 deletions(-) diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 4c26683..246c9e3 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -24,7 +24,7 @@ const builder = (yargs) => yargs .positional('action', { type: 'string', demandOption: true, - desc: 'Available actions: test, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + + desc: 'Available actions: test, setup, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + 'publishMMSPattern, registerAgent, publishMMSObject, unregisterAgent, allInOneMMS, showHznInfo, updateHznInfo, listService, listPattern, ' + 'listNode, listObject, listDeploymentPolicy, listNodePattern, checkConfigState, getDeviceArch, createHznKey, uninstallHorizon' }); @@ -61,7 +61,7 @@ const handler = (argv) => { }); } else { - console.log('./config/.env-hzn.json file not fouund.'); + console.log(`${configPath}/.env-hzn.json file not fouund.`); } }; exports.handler = handler; diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index 99ffaf4..048cd80 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAAwC;AACx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AAC,GAAG,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;SACF,CAAC,CAAA;KACH;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,iCAAiC,CAAC,CAAA;KAC5D;AACH,CAAC,CAAC;AAvCW,QAAA,OAAO,WAuClB"} \ No newline at end of file diff --git a/build/common/src/hzn.d.ts b/build/common/src/hzn.d.ts index 5e94887..c7ca11b 100644 --- a/build/common/src/hzn.d.ts +++ b/build/common/src/hzn.d.ts @@ -1,5 +1,6 @@ import { Observable } from 'rxjs'; import { Utils } from './utils'; +export declare const utils: Utils; export declare class Hzn { objectType: any; objectId: any; @@ -15,7 +16,6 @@ export declare class Hzn { envVar: any; configPath: string; name: string; - utils: Utils; constructor(env: string, configPath: string, name: string, objectType: string, objectId: string, objectFile: string, mmsPattern: string); setup(): Observable; test(): Observable; @@ -32,9 +32,7 @@ export declare class Hzn { publishService(): Observable; publishPattern(): Observable; showHznInfo(): Observable; - getHznInfo(): string[]; updateHznInfo(): Observable; - copyFile(arg: string): Promise; listService(): Observable; listPattern(): Observable; listNode(): Observable; diff --git a/build/common/src/hzn.js b/build/common/src/hzn.js index 187c633..fbe9570 100644 --- a/build/common/src/hzn.js +++ b/build/common/src/hzn.js @@ -1,16 +1,14 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Hzn = void 0; +exports.Hzn = exports.utils = void 0; const rxjs_1 = require("rxjs"); const cp = require('child_process'), exec = cp.exec; -const fs_1 = require("fs"); const env_1 = require("./env"); const utils_1 = require("./utils"); const prompt = require('prompt'); -const utils = new utils_1.Utils(); +exports.utils = new utils_1.Utils(); class Hzn { constructor(env, configPath, name, objectType, objectId, objectFile, mmsPattern) { - this.utils = new utils_1.Utils(); this.envVar = new env_1.Env(env, configPath); this.configPath = configPath; this.name = name; @@ -100,22 +98,8 @@ class Hzn { }); } buildMMSImage() { - return new rxjs_1.Observable((observer) => { - // let tag = `${this.envVar.getDockerImageBase()}_${this.envVar.getArch()}:${this.envVar.getMMSServiceVersion()}`; - let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done building mms docker image`); - } - else { - console.log('failed to build mms docker image', err); - } - observer.next(); - observer.complete(); - }); - }); + let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); + return exports.utils.shell(arg, 'done building mms docker image', 'failed to build mms docker image'); } pushMMSImage() { return new rxjs_1.Observable((observer) => { @@ -310,108 +294,49 @@ class Hzn { }); } showHznInfo() { - return new rxjs_1.Observable((observer) => { - const file = this.getHznInfo(); - console.log(file); - observer.next(file); - observer.complete(); - }); - } - getHznInfo() { - return (0, fs_1.readFileSync)('/etc/default/horizon').toString().split('\n'); + return exports.utils.showHznInfo(); } updateHznInfo() { - return new rxjs_1.Observable((observer) => { - let data = this.getHznInfo(); - let props = []; - data.forEach((el, i) => { - if (el.length > 0) { - let prop = el.split('='); - if (prop && prop.length > 0) { - props[i] = { name: prop[0], default: prop[1], required: true }; - } - } - }); - console.log('\nKey in new value or press Enter to keep current value: '); - prompt.get(props, (err, result) => { - console.log(result); - console.log('\nWould like to update horizon: Y/n?'); - prompt.get({ name: 'answer', required: true }, (err, question) => { - if (question.answer === 'Y') { - let content = ''; - for (const [key, value] of Object.entries(result)) { - content += `${key}=${value}\n`; - } - this.copyFile('sudo cp /etc/default/horizon /etc/default/.horizon').then(() => { - (0, fs_1.writeFileSync)('.horizon', content); - this.copyFile(`sudo mv .horizon /etc/default/horizon`).then(() => { - observer.next(); - observer.complete(); - }); - }); - } - }); - }); - }); - } - copyFile(arg) { - return new Promise((resolve, reject) => { - try { - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(`done moving file`); - } - else { - console.log('failed to move file', err); - } - resolve(stdout); - }); - } - catch (e) { - console.log(e); - resolve(e); - } - }); + return exports.utils.updateHznInfo(); } listService() { - return utils.listService(this.name); + return exports.utils.listService(this.name); } listPattern() { - return utils.listPattern(this.name); + return exports.utils.listPattern(this.name); } listNode() { - return utils.listNode(this.name); + return exports.utils.listNode(this.name); } listObject() { - return utils.listObject(this.name); + return exports.utils.listObject(this.name); } listDeploymentPolicy() { - return utils.listDeploymentPolicy(this.name); + return exports.utils.listDeploymentPolicy(this.name); } checkConfigState() { - return utils.checkConfigState(); + return exports.utils.checkConfigState(); } listNodePattern() { - return utils.listNodePattern(); + return exports.utils.listNodePattern(); } getDeviceArch() { - return utils.getDeviceArch(); + return exports.utils.getDeviceArch(); } createHznKey() { - return utils.createHznKey(this.envVar.getOrgId(), this.envVar.getMyDockerHubId()); + return exports.utils.createHznKey(this.envVar.getOrgId(), this.envVar.getMyDockerHubId()); } aptUpdate() { - return utils.aptUpdate(); + return exports.utils.aptUpdate(); } installPrereq() { - return utils.installPrereq(); + return exports.utils.installPrereq(); } installHznCli() { - return utils.installHznCli(this.envVar.getAnax(), this.envVar.getHznNodeID()); + return exports.utils.installHznCli(this.envVar.getAnax(), this.envVar.getHznNodeID()); } uninstallHorizon() { - return utils.uninstallHorizon(); + return exports.utils.uninstallHorizon(); } preInstallHznCli() { return new rxjs_1.Observable((observer) => { @@ -444,11 +369,11 @@ class Hzn { } setupRedHat() { return new rxjs_1.Observable((observer) => { - utils.checkOS() + exports.utils.checkOS() .subscribe({ next: (stdout) => { if (stdout.toLowerCase().indexOf('redhat') >= 0) { - utils.shell(`sudo yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc + exports.utils.shell(`sudo yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc && sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo -y && sudo yum install docker-ce docker-ce-cli containerd.io`) .subscribe({ diff --git a/build/common/src/hzn.js.map b/build/common/src/hzn.js.map index 82db262..f51a13b 100644 --- a/build/common/src/hzn.js.map +++ b/build/common/src/hzn.js.map @@ -1 +1 @@ -{"version":3,"file":"hzn.js","sourceRoot":"","sources":["../../../src/common/src/hzn.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAC5C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAAiD;AACjD,+BAA4B;AAC5B,mCAAgC;AAChC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,KAAK,GAAG,IAAI,aAAK,EAAE,CAAC;AAE1B,MAAa,GAAG;IAgBd,YAAY,GAAW,EAAE,UAAkB,EAAE,IAAY,EAAE,UAAkB,EAAE,QAAgB,EAAE,UAAkB,EAAE,UAAkB;QADvI,UAAK,GAAG,IAAI,aAAK,EAAE,CAAC;QAElB,IAAI,CAAC,MAAM,GAAG,IAAI,SAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,OAAO,IAAI,iBAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;iBACjB,SAAS,CAAC;gBACT,QAAQ,EAAE,GAAG,EAAE;oBACb,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU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GAAG,EAAE,EAAE;oCACb,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gCACtB,CAAC;6BACF,CAAC,CAAA;wBACJ,CAAC;wBACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;4BACb,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;wBACtB,CAAC;qBACF,CAAC,CAAA;gBACJ,CAAC;gBACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;oBACb,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,WAAW;QACT,OAAO,IAAI,iBAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,aAAK,CAAC,OAAO,EAAE;iBACd,SAAS,CAAC;gBACT,IAAI,EAAE,CAAC,MAAU,EAAE,EAAE;oBACnB,IAAG,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;wBAC9C,aAAK,CAAC,KAAK,CAAC;;kFAE0D,CAAC;6BACtE,SAAS,CAAC;4BACT,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE;4BACnC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;yBACpC,CAAC,CAAA;qBACH;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;wBAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC;qBACrB;gBACH,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAjYD,kBAiYC"} \ No newline at end of file diff --git a/build/common/src/utils.d.ts b/build/common/src/utils.d.ts index fb91140..832e402 100644 --- a/build/common/src/utils.d.ts +++ b/build/common/src/utils.d.ts @@ -16,7 +16,11 @@ export declare class Utils { installPrereq(): Observable; installHznCli(anax: string, id: null): Observable; uninstallHorizon(): Observable; - shell(arg: string, options?: { + copyFile(arg: string): Promise; + getHznInfo(): string[]; + showHznInfo(): Observable; + updateHznInfo(): Observable; + shell(arg: string, success?: string, error?: string, options?: { maxBuffer: number; }): Observable; } diff --git a/build/common/src/utils.js b/build/common/src/utils.js index 817d434..f812fa8 100644 --- a/build/common/src/utils.js +++ b/build/common/src/utils.js @@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Utils = void 0; const rxjs_1 = require("rxjs"); const cp = require('child_process'), exec = cp.exec; +const fs_1 = require("fs"); +const prompt = require('prompt'); const env = process.env.npm_config_env || 'biz'; class Utils { constructor() { } @@ -75,17 +77,66 @@ class Utils { uninstallHorizon() { return this.shell(`sudo apt purge -y bluehorizon horizon horizon-cli`); } - shell(arg, options = { maxBuffer: 1024 * 2000 }) { + copyFile(arg) { + return (0, rxjs_1.firstValueFrom)(this.shell(arg)); + } + getHznInfo() { + return (0, fs_1.readFileSync)('/etc/default/horizon').toString().split('\n'); + } + showHznInfo() { + return new rxjs_1.Observable((observer) => { + const file = this.getHznInfo(); + console.log(file); + observer.next(file); + observer.complete(); + }); + } + updateHznInfo() { + return new rxjs_1.Observable((observer) => { + let data = this.getHznInfo(); + let props = []; + data.forEach((el, i) => { + if (el.length > 0) { + let prop = el.split('='); + if (prop && prop.length > 0) { + props[i] = { name: prop[0], default: prop[1], required: true }; + } + } + }); + console.log('\nKey in new value or press Enter to keep current value: '); + prompt.get(props, (err, result) => { + console.log(result); + console.log('\nWould like to update horizon: Y/n?'); + prompt.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer === 'Y') { + let content = ''; + for (const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + this.copyFile('sudo cp /etc/default/horizon /etc/default/.horizon').then(() => { + (0, fs_1.writeFileSync)('.horizon', content); + this.copyFile(`sudo mv .horizon /etc/default/horizon`).then(() => { + observer.next(); + observer.complete(); + }); + }); + } + }); + }); + }); + } + shell(arg, success = 'command executed successfully', error = 'command failed', options = { maxBuffer: 1024 * 2000 }) { return new rxjs_1.Observable((observer) => { console.log(arg); let child = exec(arg, options, (err, stdout, stderr) => { if (!err) { console.log(stdout); + console.log(success); observer.next(stdout); observer.complete(); } else { - console.log(`shell command failed: ${err}`); + console.log(`${error}: ${err}`); observer.error(err); } }); diff --git a/build/common/src/utils.js.map b/build/common/src/utils.js.map index daf7ddc..3cbb311 100644 --- a/build/common/src/utils.js.map +++ b/build/common/src/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AACtC,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AAEf,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAEhD,MAAa,KAAK;IAChB,gBAAe,CAAC;IAChB,IAAI;IACJ,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,CAAC,IAAY;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAC1F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,CAAC;oBAC5C,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,sBAwFC"} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;AAAA,+BAAsD;AACtD,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAAiD;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAGjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAEhD,MAAa,KAAK;IAChB,gBAAe,CAAC;IAChB,IAAI;IACJ,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,CAAC,IAAY;QACnB,MAAM,GAAG,GAAG,IAAI,CAA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,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1ID,sBA0IC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9732888..166520d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "hzn-cli", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.1.2", + "version": "0.1.3", "license": "ISC", "dependencies": { "chalk": "^4.1.2", diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index fb55901..555520b 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -1,5 +1,5 @@ import type { Arguments, CommandBuilder } from 'yargs'; -import { Hzn } from '../common/src/hzn'; +import { Hzn, utils } from '../common/src/hzn'; import chalk from 'chalk'; import clear from 'clear'; import figlet from 'figlet'; @@ -32,7 +32,7 @@ export const builder: CommandBuilder = (yargs) => .positional('action', { type: 'string', demandOption: true, - desc: 'Available actions: test, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + + desc: 'Available actions: test, setup, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + 'publishMMSPattern, registerAgent, publishMMSObject, unregisterAgent, allInOneMMS, showHznInfo, updateHznInfo, listService, listPattern, ' + 'listNode, listObject, listDeploymentPolicy, listNodePattern, checkConfigState, getDeviceArch, createHznKey, uninstallHorizon' }); @@ -53,6 +53,7 @@ export const handler = (argv: Arguments): void => { const p = pattern || ''; console.log('$$$ ', action, env, config_path, n); const configPath = config_path || 'config'; + if(existsSync(`${configPath}/.env-hzn.json`)) { const hzn = new Hzn(env, configPath, n, objType, objId, obj, p); @@ -73,7 +74,7 @@ export const handler = (argv: Arguments): void => { } }) } else { - console.log('./config/.env-hzn.json file not fouund.') + console.log(`${configPath}/.env-hzn.json file not fouund.`) } }; diff --git a/src/common/src/hzn.ts b/src/common/src/hzn.ts index a55d9ac..5393b64 100644 --- a/src/common/src/hzn.ts +++ b/src/common/src/hzn.ts @@ -6,7 +6,7 @@ import { Env } from './env'; import { Utils } from './utils'; const prompt = require('prompt'); -const utils = new Utils(); +export const utils = new Utils(); export class Hzn { objectType: any; @@ -23,7 +23,6 @@ export class Hzn { envVar: any; configPath: string; name: string; - utils = new Utils(); constructor(env: string, configPath: string, name: string, objectType: string, objectId: string, objectFile: string, mmsPattern: string) { this.envVar = new Env(env, configPath); this.configPath = configPath; @@ -112,21 +111,8 @@ export class Hzn { }) } buildMMSImage() { - return new Observable((observer) => { - // let tag = `${this.envVar.getDockerImageBase()}_${this.envVar.getArch()}:${this.envVar.getMMSServiceVersion()}`; - let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done building mms docker image`); - } else { - console.log('failed to build mms docker image', err); - } - observer.next(); - observer.complete(); - }); - }) + let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); + return utils.shell(arg, 'done building mms docker image', 'failed to build mms docker image'); } pushMMSImage() { return new Observable((observer) => { @@ -313,68 +299,10 @@ export class Hzn { }) } showHznInfo() { - return new Observable((observer) => { - const file = this.getHznInfo(); - console.log(file) - observer.next(file); - observer.complete(); - }) - } - getHznInfo() { - return readFileSync('/etc/default/horizon').toString().split('\n'); + return utils.showHznInfo(); } updateHznInfo() { - return new Observable((observer) => { - let data = this.getHznInfo(); - let props: any[] = []; - data.forEach((el, i) => { - if(el.length > 0) { - let prop = el.split('='); - if(prop && prop.length > 0) { - props[i] = {name: prop[0], default: prop[1], required: true}; - } - } - }); - console.log('\nKey in new value or press Enter to keep current value: ') - prompt.get(props, (err: any, result: any) => { - console.log(result) - - console.log('\nWould like to update horizon: Y/n?') - prompt.get({name: 'answer', required: true}, (err: any, question: any) => { - if(question.answer === 'Y') { - let content = ''; - for(const [key, value] of Object.entries(result)) { - content += `${key}=${value}\n`; - } - this.copyFile('sudo cp /etc/default/horizon /etc/default/.horizon').then(() => { - writeFileSync('.horizon', content); - this.copyFile(`sudo mv .horizon /etc/default/horizon`).then(() => { - observer.next(); - observer.complete(); - }) - }) - } - }) - }) - }) - } - copyFile(arg: string) { - return new Promise((resolve, reject) => { - try { - console.log(arg); - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(`done moving file`); - } else { - console.log('failed to move file', err); - } - resolve(stdout); - }); - } catch(e) { - console.log(e) - resolve(e); - } - }); + return utils.updateHznInfo(); } listService() { return utils.listService(this.name); diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index e0486d7..b957a55 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -1,6 +1,9 @@ -import { Observable, of } from 'rxjs'; +import { Observable, of, firstValueFrom } from 'rxjs'; const cp = require('child_process'), exec = cp.exec; +import { readFileSync, writeFileSync } from 'fs'; +const prompt = require('prompt'); + const env = process.env.npm_config_env || 'biz'; @@ -73,16 +76,66 @@ export class Utils { uninstallHorizon() { return this.shell(`sudo apt purge -y bluehorizon horizon horizon-cli`); } - shell(arg: string, options={maxBuffer: 1024 * 2000}) { + copyFile(arg: string) { + return firstValueFrom(this.shell(arg)); + } + getHznInfo() { + return readFileSync('/etc/default/horizon').toString().split('\n'); + } + showHznInfo() { + return new Observable((observer) => { + const file = this.getHznInfo(); + console.log(file) + observer.next(file); + observer.complete(); + }) + } + updateHznInfo() { + return new Observable((observer) => { + let data = this.getHznInfo(); + let props: any[] = []; + data.forEach((el, i) => { + if(el.length > 0) { + let prop = el.split('='); + if(prop && prop.length > 0) { + props[i] = {name: prop[0], default: prop[1], required: true}; + } + } + }); + console.log('\nKey in new value or press Enter to keep current value: ') + prompt.get(props, (err: any, result: any) => { + console.log(result) + + console.log('\nWould like to update horizon: Y/n?') + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer === 'Y') { + let content = ''; + for(const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + this.copyFile('sudo cp /etc/default/horizon /etc/default/.horizon').then(() => { + writeFileSync('.horizon', content); + this.copyFile(`sudo mv .horizon /etc/default/horizon`).then(() => { + observer.next(); + observer.complete(); + }) + }) + } + }) + }) + }) + } + shell(arg: string, success='command executed successfully', error='command failed', options={maxBuffer: 1024 * 2000}) { return new Observable((observer) => { console.log(arg); let child = exec(arg, options, (err: any, stdout: any, stderr: any) => { if(!err) { console.log(stdout); + console.log(success); observer.next(stdout); observer.complete(); } else { - console.log(`shell command failed: ${err}`); + console.log(`${error}: ${err}`); observer.error(err); } }); From b98a6ce993d63bc7abda2ae80bb273689d034335 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Sat, 20 Nov 2021 21:05:39 -0500 Subject: [PATCH 2/9] add logic to automate configuration setup --- build/commands/deploy.d.ts | 1 + build/commands/deploy.js | 73 +++++++++++----- build/commands/deploy.js.map | 2 +- build/common/src/env.js | 5 +- build/common/src/env.js.map | 2 +- build/common/src/hzn.d.ts | 3 +- build/common/src/hzn.js | 8 +- build/common/src/hzn.js.map | 2 +- build/common/src/utils.d.ts | 5 ++ build/common/src/utils.js | 160 +++++++++++++++++++++++++++++++--- build/common/src/utils.js.map | 2 +- package-lock.json | 38 +++++++- package.json | 1 + setup/config/env-hzn.json | 79 +++++++++-------- setup/config/env-local | 5 ++ src/commands/deploy.ts | 77 +++++++++++----- src/common/src/env.ts | 5 +- src/common/src/hzn.ts | 8 +- src/common/src/utils.ts | 149 ++++++++++++++++++++++++++++--- src/env-hzn.json | 63 +++++++++++++ src/env-local | 5 ++ 21 files changed, 573 insertions(+), 120 deletions(-) create mode 100644 setup/config/env-local create mode 100644 src/env-hzn.json create mode 100644 src/env-local diff --git a/build/commands/deploy.d.ts b/build/commands/deploy.d.ts index e4f9e8e..bdef4ac 100644 --- a/build/commands/deploy.d.ts +++ b/build/commands/deploy.d.ts @@ -8,6 +8,7 @@ declare type Options = { object_id: string | undefined; object: string | undefined; pattern: string | undefined; + skip_config_update: string | undefined; }; export declare const command: string; export declare const desc: string; diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 246c9e3..03fb09d 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -19,7 +19,8 @@ const builder = (yargs) => yargs object_type: { type: 'string', desc: 'Type of object' }, object_id: { type: 'string', desc: 'Id of object to be published' }, object: { type: 'string', desc: 'Object file to be published' }, - pattern: { type: 'string', desc: 'MMS pattern' } + pattern: { type: 'string', desc: 'MMS pattern' }, + skip_config_update: { type: 'string', desc: 'Do not prompt for config updates' } }) .positional('action', { type: 'string', @@ -32,37 +33,67 @@ exports.builder = builder; const handler = (argv) => { (0, clear_1.default)(); console.log(chalk_1.default.greenBright(figlet_1.default.textSync('hzn-cli', { horizontalLayout: 'full' }))); - const { action, org, config_path, name, object_type, object_id, object, pattern } = argv; + const { action, org, config_path, name, object_type, object_id, object, pattern, skip_config_update } = argv; const env = org || 'biz'; const n = name || ''; const objType = object_type || ''; const objId = object_id || ''; const obj = object || ''; const p = pattern || ''; - console.log('$$$ ', action, env, config_path, n); - const configPath = config_path || 'config'; - if ((0, fs_1.existsSync)(`${configPath}/.env-hzn.json`)) { - const hzn = new hzn_1.Hzn(env, configPath, n, objType, objId, obj, p); - hzn.setup() - .subscribe({ - complete: () => { - hzn[action]() + const configPath = config_path || '/etc/default'; + const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; + console.log('$$$ ', action, env, configPath, n); + const proceed = () => { + if ((0, fs_1.existsSync)(`${configPath}/.env-hzn.json`)) { + const hzn = new hzn_1.Hzn(env, configPath, n, objType, objId, obj, p); + hzn.init() + .subscribe({ + complete: () => { + hzn[action]() + .subscribe({ + complete: () => { + console.log('process completed.'); + process.exit(0); + } + }); + }, + error: (err) => { + console.log('something went wrong. ', err); + process.exit(0); + } + }); + } + else { + console.log(`${configPath}/.env-hzn.json file not fouund.`); + } + }; + hzn_1.utils.checkDefaultConfig() + .subscribe({ + complete: () => { + console.log(skip_config_update); + if (promptForUpdate.indexOf(action) < 0 || skip_config_update) { + proceed(); + } + else { + hzn_1.utils.updateEnvFiles(env, configPath) .subscribe({ complete: () => { - console.log('process completed.'); - process.exit(0); + proceed(); + }, error: (err) => { + console.log(err); } }); - }, - error: (err) => { - console.log('something went wrong. ', err); - process.exit(0); } - }); - } - else { - console.log(`${configPath}/.env-hzn.json file not fouund.`); - } + }, error: (err) => { + console.log(err, 'Initialising...'); + hzn_1.utils.setupEnvFiles() + .subscribe({ + complete: () => { + proceed(); + }, error: () => process.exit(0) + }); + } + }); }; exports.handler = handler; //# sourceMappingURL=deploy.js.map \ No newline at end of file diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index 048cd80..92e5731 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAA+C;AAC/C,kDAA0B;AAC1B,kDAA0B;AAC1B,oDAA4B;AAC5B,2BAAgC;AAYnB,QAAA,OAAO,GAAW,iBAAiB,CAAC;AACpC,QAAA,IAAI,GAAW,8BAA8B,CAAC;AAEpD,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,OAAO,CAAC;IACP,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gCAAgC,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,GAAG,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;oBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;aACF,CAAC,CAAA;SACH;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,iCAAiC,CAAC,CAAA;SAC5D;IACH,CAAC,CAAA;IAED,WAAK,CAAC,kBAAkB,EAAE;SACzB,SAAS,CAAC;QACT,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;YAC/B,IAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,kBAAkB,EAAE;gBAC5D,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,WAAK,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,CAAC;qBACpC,SAAS,CAAC;oBACT,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,EAAE,CAAA;oBACX,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;wBAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;YACnC,WAAK,CAAC,aAAa,EAAE;iBACpB,SAAS,CAAC;gBACT,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AArEW,QAAA,OAAO,WAqElB"} \ No newline at end of file diff --git a/build/common/src/env.js b/build/common/src/env.js index 3792a4d..698bf6f 100644 --- a/build/common/src/env.js +++ b/build/common/src/env.js @@ -8,8 +8,8 @@ var dotenv = require('dotenv'); const pEnv = process.env; class Env { constructor(env, configPath) { - if ((0, fs_1.existsSync)(`${configPath}/.env-local`)) { - const localEnv = dotenv.parse((0, fs_1.readFileSync)(`${configPath}/.env-local`)); + if ((0, fs_1.existsSync)(`/etc/default/.env-local`)) { + const localEnv = dotenv.parse((0, fs_1.readFileSync)(`/etc/default/.env-local`)); for (var i in localEnv) { pEnv[i] = localEnv[i]; } @@ -55,6 +55,7 @@ class Env { } setAdditionalEnv() { let container = pEnv.MMS_CONTAINER_NAME || pEnv.MMS_SERVICE_NAME; + pEnv.HZN_ORG_ID = this.env; pEnv.MMS_PATTERN_NAME = `pattern-${pEnv.MMS_SERVICE_NAME}-${pEnv.ARCH}`; pEnv.MMS_CONTAINER = `${pEnv.YOUR_DOCKERHUB_ID}/${container}_${pEnv.ARCH}:${pEnv.MMS_SERVICE_VERSION}`.replace(/\r?\n|\r/g, ''); pEnv.PATTERN_NAME = `pattern-${pEnv.SERVICE_NAME}`; diff --git a/build/common/src/env.js.map b/build/common/src/env.js.map index 0e39c1e..31983df 100644 --- a/build/common/src/env.js.map +++ b/build/common/src/env.js.map @@ -1 +1 @@ -{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/src/env.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAClC,2BAA8C;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzB,MAAa,GAAG;IAMd,YAAY,GAAW,EAAE,UAAkB;QACzC,IAAG,IAAA,eAAU,EAAC,GAAG,UAAU,aAAa,CAAC,EAAE;YACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,GAAG,UAAU,aAAa,CAAC,CA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3B,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IACD,wBAAwB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,mBAAmB;QACjB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC;IACzC,CAAC;CACF;AApID,kBAoIC"} \ No newline at end of file +{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/src/env.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAClC,2BAA8C;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzB,MAAa,GAAG;IAMd,YAAY,GAAW,EAAE,UAAkB;QACzC,IAAG,IAAA,eAAU,EAAC,yBAAyB,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,yBAAyB,CAAC,CAAC,CAAC;YACvE,KAAI,IAAI,CAAC,IAAI,QAAQ,EAAE;gBACrB,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;QACD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,GAAG,UAAU,gBAAgB,CAAC;IAC9C,CAAC;IACD,IAAI;QACF,OAAO,IAAI,iBAAU,CA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O;QACL,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC;IACzC,CAAC;CACF;AArID,kBAqIC"} \ No newline at end of file diff --git a/build/common/src/hzn.d.ts b/build/common/src/hzn.d.ts index c7ca11b..2178ba6 100644 --- a/build/common/src/hzn.d.ts +++ b/build/common/src/hzn.d.ts @@ -17,8 +17,9 @@ export declare class Hzn { configPath: string; name: string; constructor(env: string, configPath: string, name: string, objectType: string, objectId: string, objectFile: string, mmsPattern: string); - setup(): Observable; + init(): Observable; test(): Observable; + setup(): Observable; buildServiceImage(): Observable; pushServiceImage(): Observable; buildMMSImage(): Observable; diff --git a/build/common/src/hzn.js b/build/common/src/hzn.js index fbe9570..309c623 100644 --- a/build/common/src/hzn.js +++ b/build/common/src/hzn.js @@ -17,7 +17,7 @@ class Hzn { this.objectFile = objectFile; this.mmsPattern = mmsPattern; } - setup() { + init() { return new rxjs_1.Observable((observer) => { this.envVar.init() .subscribe({ @@ -62,6 +62,12 @@ class Hzn { observer.complete(); }); } + setup() { + return new rxjs_1.Observable((observer) => { + console.log(`it works...${this.envVar.getArch()}, your environment is ready to go!`); + observer.complete(); + }); + } buildServiceImage() { return new rxjs_1.Observable((observer) => { let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); diff --git a/build/common/src/hzn.js.map b/build/common/src/hzn.js.map index f51a13b..f1cd4de 100644 --- a/build/common/src/hzn.js.map +++ b/build/common/src/hzn.js.map @@ -1 +1 @@ -{"version":3,"file":"hzn.js","sourceRoot":"","sources":["../../../src/common/src/hzn.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAC5C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AAEf,+BAA4B;AAC5B,mCAAgC;AAChC,MA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AC;yBACpC,CAAC,CAAA;qBACH;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;wBAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC;qBACrB;gBACH,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAvYD,kBAuYC"} \ No newline at end of file diff --git a/build/common/src/utils.d.ts b/build/common/src/utils.d.ts index 832e402..37cf132 100644 --- a/build/common/src/utils.d.ts +++ b/build/common/src/utils.d.ts @@ -17,8 +17,13 @@ export declare class Utils { installHznCli(anax: string, id: null): Observable; uninstallHorizon(): Observable; copyFile(arg: string): Promise; + updateEnvFiles(org: string, configPath: string): Observable; + setupEnvFiles(): Observable; + updateEnvHzn(org: string, configPath: string): Observable; + checkDefaultConfig(): Observable; getHznInfo(): string[]; showHznInfo(): Observable; + getPropsFromFile(file: string): any[]; updateHznInfo(): Observable; shell(arg: string, success?: string, error?: string, options?: { maxBuffer: number; diff --git a/build/common/src/utils.js b/build/common/src/utils.js index f812fa8..1226f4e 100644 --- a/build/common/src/utils.js +++ b/build/common/src/utils.js @@ -1,10 +1,15 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Utils = void 0; const rxjs_1 = require("rxjs"); const cp = require('child_process'), exec = cp.exec; const fs_1 = require("fs"); -const prompt = require('prompt'); +const os_1 = __importDefault(require("os")); +const prompt_1 = __importDefault(require("prompt")); +const jsonfile_1 = __importDefault(require("jsonfile")); const env = process.env.npm_config_env || 'biz'; class Utils { constructor() { } @@ -80,6 +85,123 @@ class Utils { copyFile(arg) { return (0, rxjs_1.firstValueFrom)(this.shell(arg)); } + updateEnvFiles(org, configPath) { + return new rxjs_1.Observable((observer) => { + let props = this.getPropsFromFile('/etc/default/.env-local'); + console.log(props); + console.log(`\nWould you like to change any of the above properties: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer === 'Y') { + console.log('\nKey in new value or press Enter to keep current value: '); + prompt_1.default.get(props, (err, result) => { + console.log(result); + console.log(`\nWould you like to update config files: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + let content = ''; + for (const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + (0, fs_1.writeFileSync)('.env-local', content); + this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { + this.updateEnvHzn(org, configPath) + .subscribe({ + complete: () => observer.complete() + }); + }); + }); + }); + } + else { + this.updateEnvHzn(org, configPath) + .subscribe({ + complete: () => observer.complete() + }); + } + }); + }); + } + setupEnvFiles() { + return new rxjs_1.Observable((observer) => { + let props = this.getPropsFromFile('./src/env-local'); + console.log('\nKey in new value or press Enter to keep current value: '); + prompt_1.default.get(props, (err, result) => { + console.log(result); + console.log(`\nWould you like to save config files: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer === 'Y') { + let content = ''; + for (const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + (0, fs_1.writeFileSync)('.env-local', content); + this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { + this.copyFile('sudo cp ./src/env-hzn.json /etc/default/.env-hzn.json').then(() => { + observer.next(); + observer.complete(); + }); + }); + } + else { + console.log(`config files not saved`); + observer.error(); + } + }); + }); + }); + } + updateEnvHzn(org, configPath) { + return new rxjs_1.Observable((observer) => { + let props = []; + let hznJson = jsonfile_1.default.readFileSync(`${configPath}/.env-hzn.json`); + let envVars = hznJson[org]['envVars']; + let i = 0; + const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; + for (const [key, value] of Object.entries(envVars)) { + props[i] = { name: key, default: value, required: notRequired.indexOf(key) < 0 }; + i++; + } + console.log(props); + console.log(`\nWould you like to change any of the above properties for ${org}: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer === 'Y') { + console.log('\nKey in new value or press Enter to keep current value: '); + prompt_1.default.get(props, (err, result) => { + console.log(result); + console.log(`\nWould you like to save these changes: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer === 'Y') { + for (const [key, value] of Object.entries(result)) { + envVars[key] = value; + } + jsonfile_1.default.writeFileSync('.env-hzn.json', hznJson, { spaces: 2 }); + this.copyFile(`sudo mv .env-hzn.json ${configPath}/.env-hzn.json`).then(() => { + observer.complete(); + }); + } + else { + console.log(`config files updated`); + observer.complete(); + } + }); + }); + } + else { + console.log(`config files not updated for ${org}`); + observer.complete(); + } + }); + }); + } + checkDefaultConfig() { + return new rxjs_1.Observable((observer) => { + if ((0, fs_1.existsSync)(`/etc/default/.env-local`) && (0, fs_1.existsSync)(`/etc/default/.env-hzn.json`)) { + observer.complete(); + } + else { + observer.error('No config files.'); + } + }); + } getHznInfo() { return (0, fs_1.readFileSync)('/etc/default/horizon').toString().split('\n'); } @@ -91,23 +213,30 @@ class Utils { observer.complete(); }); } - updateHznInfo() { - return new rxjs_1.Observable((observer) => { - let data = this.getHznInfo(); - let props = []; - data.forEach((el, i) => { - if (el.length > 0) { - let prop = el.split('='); - if (prop && prop.length > 0) { - props[i] = { name: prop[0], default: prop[1], required: true }; + getPropsFromFile(file) { + let props = []; + let data = (0, fs_1.readFileSync)(file).toString().split('\n'); + data.forEach((el, i) => { + if (el.length > 0) { + let prop = el.split('='); + if (prop && prop.length > 0) { + if (prop[0] === 'HZN_CUSTOM_NODE_ID' && (!prop[1] || prop[1].length == 0)) { + prop[1] = os_1.default.hostname(); } + props[i] = { name: prop[0], default: prop[1], required: true }; } - }); + } + }); + return props; + } + updateHznInfo() { + return new rxjs_1.Observable((observer) => { + let props = this.getPropsFromFile('/etc/default/horizon'); console.log('\nKey in new value or press Enter to keep current value: '); - prompt.get(props, (err, result) => { + prompt_1.default.get(props, (err, result) => { console.log(result); - console.log('\nWould like to update horizon: Y/n?'); - prompt.get({ name: 'answer', required: true }, (err, question) => { + console.log('\nWould you like to update horizon: Y/n?'); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { if (question.answer === 'Y') { let content = ''; for (const [key, value] of Object.entries(result)) { @@ -121,6 +250,9 @@ class Utils { }); }); } + else { + observer.complete(); + } }); }); }); diff --git a/build/common/src/utils.js.map b/build/common/src/utils.js.map index 3cbb311..e691b64 100644 --- a/build/common/src/utils.js.map +++ b/build/common/src/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;AAAA,+BAAsD;AACtD,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAAiD;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAGjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAEhD,MAAa,KAAK;IAChB,gBAAe,CAAC;IAChB,IAAI;IACJ,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,CAAC,IAAY;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,IAAI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O,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1ID,sBA0IC"} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAsD;AACtD,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAA4E;AAC5E,4CAAoB;AACpB,oDAA4B;AAC5B,wDAAgC;AAGhC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAEhD,MAAa,KAAK;IAChB,gBAAe,CAAC;IAChB,IAAI;IACJ,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAChG,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,CAAC,IAAY;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAC1F,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC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AC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,GAAW,EAAE,OAAO,GAAC,+BAA+B,EAAE,KAAK,GAAC,gBAAgB,EAAE,OAAO,GAAC,EAAC,SAAS,EAAE,IAAI,GAAG,IAAI,EAAC;QAClH,OAAO,IAAI,iBAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAQ,EAAE,MAAW,EAAE,MAAW,EAAE,EAAE;gBACpE,IAAG,CAAC,GAAG,EAAE;oBACP,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBACpB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,GAAG,EAAE,CAAC,CAAC;oBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnQD,sBAmQC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 166520d..137e9d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "commander": "^8.2.0", "dotenv": "^10.0.0", "figlet": "^1.5.2", + "jsonfile": "^6.1.0", "prompt": "^1.2.0", "rxjs": "^7.3.0", "yargs": "^17.1.1" @@ -1652,7 +1653,7 @@ "version": "4.2.8", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", - "dev": true + "devOptional": true }, "node_modules/has-flag": { "version": "4.0.0", @@ -1914,6 +1915,17 @@ "dev": true, "peer": true }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -3026,6 +3038,14 @@ "node": ">=8" } }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/update-notifier": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", @@ -4583,7 +4603,7 @@ "version": "4.2.8", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", - "dev": true + "devOptional": true }, "has-flag": { "version": "4.0.0", @@ -4791,6 +4811,15 @@ "dev": true, "peer": true }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -5611,6 +5640,11 @@ "crypto-random-string": "^2.0.0" } }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, "update-notifier": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", diff --git a/package.json b/package.json index 2fdd547..900932a 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "commander": "^8.2.0", "dotenv": "^10.0.0", "figlet": "^1.5.2", + "jsonfile": "^6.1.0", "prompt": "^1.2.0", "rxjs": "^7.3.0", "yargs": "^17.1.1" diff --git a/setup/config/env-hzn.json b/setup/config/env-hzn.json index 9306a4c..ac70627 100644 --- a/setup/config/env-hzn.json +++ b/setup/config/env-hzn.json @@ -2,26 +2,19 @@ "biz": { "envVars": { - "HZN_ORG_ID": "", - "HZN_EXCHANGE_USER_AUTH": "", - "HZN_EXCHANGE_URL": "", - "HZN_FSS_CSSURL": "", - "HZN_CUSTOM_NODE_ID": "", /* defaults to hostname if leave blank */ - "SERVICE_NAME": "", - "SERVICE_VERSION": "", - "SERVICE_CONTAINER_NAME": "", + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", "SERVICE_CONTAINER_CREDS": "", - "YOUR_DOCKERHUB_ID": "", - "VOLUME_MOUNT": "", - "MMS_SHARED_VOLUME": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", "MMS_CONTAINER_CREDS": "", - "MMS_CONTAINER_NAME": "", - "MMS_SERVICE_NAME": "", - "MMS_SERVICE_VERSION": "", - "MMS_OBJECT_TYPE": "", - "MMS_OBJECT_ID": "", - "MMS_OBJECT_FILE": "config/config.json", - "UPDATE_FILE_NAME": "" + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" }, "metaVars": { } @@ -29,26 +22,40 @@ "demo": { "envVars": { - "HZN_ORG_ID": "", - "HZN_EXCHANGE_USER_AUTH": "", - "HZN_EXCHANGE_URL": "", - "HZN_FSS_CSSURL": "", - "HZN_CUSTOM_NODE_ID": "", /* defaults to hostname if leave blank */ - "SERVICE_NAME": "", - "SERVICE_VERSION": "", - "SERVICE_CONTAINER_NAME": "", + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", "SERVICE_CONTAINER_CREDS": "", - "YOUR_DOCKERHUB_ID": "", - "VOLUME_MOUNT": "", - "MMS_SHARED_VOLUME": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", "MMS_CONTAINER_CREDS": "", - "MMS_CONTAINER_NAME": "", - "MMS_SERVICE_NAME": "", - "MMS_SERVICE_VERSION": "", - "MMS_OBJECT_TYPE": "", - "MMS_OBJECT_ID": "", - "MMS_OBJECT_FILE": "config/config.json", - "UPDATE_FILE_NAME": "" + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + }, + "myorg": + { + "envVars": { + "ANAX": "https://github.com/open-horizon/anax/releases/latest/download/agent-install.sh", + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" }, "metaVars": { } diff --git a/setup/config/env-local b/setup/config/env-local new file mode 100644 index 0000000..e578d30 --- /dev/null +++ b/setup/config/env-local @@ -0,0 +1,5 @@ +YOUR_DOCKERHUB_ID= +HZN_EXCHANGE_USER_AUTH= +HZN_EXCHANGE_URL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-exchange/v1 +HZN_FSS_CSSURL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-css +HZN_CUSTOM_NODE_ID= \ No newline at end of file diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index 555520b..56f9b37 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -14,6 +14,7 @@ type Options = { object_id: string | undefined; object: string | undefined; pattern: string | undefined; + skip_config_update: string | undefined; }; export const command: string = 'deploy '; export const desc: string = 'Deploy to Org '; @@ -27,7 +28,8 @@ export const builder: CommandBuilder = (yargs) => object_type: {type: 'string', desc: 'Type of object'}, object_id: {type: 'string', desc: 'Id of object to be published'}, object: {type: 'string', desc: 'Object file to be published'}, - pattern: {type: 'string', desc: 'MMS pattern'} + pattern: {type: 'string', desc: 'MMS pattern'}, + skip_config_update: {type: 'string', desc: 'Do not prompt for config updates'} }) .positional('action', { type: 'string', @@ -44,37 +46,66 @@ export const handler = (argv: Arguments): void => { figlet.textSync('hzn-cli', { horizontalLayout: 'full' }) ) ); - const { action, org, config_path, name, object_type, object_id, object, pattern } = argv; + const { action, org, config_path, name, object_type, object_id, object, pattern, skip_config_update } = argv; const env = org || 'biz'; const n = name || ''; const objType = object_type || ''; const objId = object_id || ''; const obj = object || ''; const p = pattern || ''; - console.log('$$$ ', action, env, config_path, n); - const configPath = config_path || 'config'; + const configPath = config_path || '/etc/default'; + const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] + console.log('$$$ ', action, env, configPath, n); - if(existsSync(`${configPath}/.env-hzn.json`)) { - const hzn = new Hzn(env, configPath, n, objType, objId, obj, p); + const proceed = () => { + if(existsSync(`${configPath}/.env-hzn.json`)) { + const hzn = new Hzn(env, configPath, n, objType, objId, obj, p); + + hzn.init() + .subscribe({ + complete: () => { + hzn[action]() + .subscribe({ + complete:() => { + console.log('process completed.'); + process.exit(0) + } + }) + }, + error: (err) => { + console.log('something went wrong. ', err); + process.exit(0); + } + }) + } else { + console.log(`${configPath}/.env-hzn.json file not fouund.`) + } + } - hzn.setup() - .subscribe({ - complete: () => { - hzn[action]() + utils.checkDefaultConfig() + .subscribe({ + complete: () => { + if(promptForUpdate.indexOf(action) < 0 || skip_config_update) { + proceed(); + } else { + utils.updateEnvFiles(env, configPath) .subscribe({ - complete:() => { - console.log('process completed.'); - process.exit(0) - } - }) - }, - error: (err) => { - console.log('something went wrong. ', err); - process.exit(0); + complete: () => { + proceed() + }, error: (err) => { + console.log(err) + } + }) } - }) - } else { - console.log(`${configPath}/.env-hzn.json file not fouund.`) - } + }, error: (err) => { + console.log(err, 'Initialising...') + utils.setupEnvFiles() + .subscribe({ + complete: () => { + proceed(); + }, error: () => process.exit(0) + }) + } + }) }; diff --git a/src/common/src/env.ts b/src/common/src/env.ts index f8a9627..937d2b4 100644 --- a/src/common/src/env.ts +++ b/src/common/src/env.ts @@ -13,8 +13,8 @@ export class Env { hznEnv: any; configPath: string; constructor(env: string, configPath: string) { - if(existsSync(`${configPath}/.env-local`)) { - const localEnv = dotenv.parse(readFileSync(`${configPath}/.env-local`)); + if(existsSync(`/etc/default/.env-local`)) { + const localEnv = dotenv.parse(readFileSync(`/etc/default/.env-local`)); for(var i in localEnv) { pEnv[i] = localEnv[i]; } @@ -58,6 +58,7 @@ export class Env { } setAdditionalEnv() { let container = pEnv.MMS_CONTAINER_NAME || pEnv.MMS_SERVICE_NAME; + pEnv.HZN_ORG_ID = this.env; pEnv.MMS_PATTERN_NAME = `pattern-${pEnv.MMS_SERVICE_NAME}-${pEnv.ARCH}`; pEnv.MMS_CONTAINER = `${pEnv.YOUR_DOCKERHUB_ID}/${container}_${pEnv.ARCH}:${pEnv.MMS_SERVICE_VERSION}`.replace(/\r?\n|\r/g, '') pEnv.PATTERN_NAME = `pattern-${pEnv.SERVICE_NAME}`; diff --git a/src/common/src/hzn.ts b/src/common/src/hzn.ts index 5393b64..d3718db 100644 --- a/src/common/src/hzn.ts +++ b/src/common/src/hzn.ts @@ -33,7 +33,7 @@ export class Hzn { this.mmsPattern = mmsPattern; } - setup() { + init() { return new Observable((observer) => { this.envVar.init() .subscribe({ @@ -77,6 +77,12 @@ export class Hzn { observer.complete(); }); } + setup() { + return new Observable((observer) => { + console.log(`it works...${this.envVar.getArch()}, your environment is ready to go!`) + observer.complete(); + }); + } buildServiceImage() { return new Observable((observer) => { let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index b957a55..aa38789 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -1,8 +1,10 @@ import { Observable, of, firstValueFrom } from 'rxjs'; const cp = require('child_process'), exec = cp.exec; -import { readFileSync, writeFileSync } from 'fs'; -const prompt = require('prompt'); +import { readFileSync, writeFileSync, copyFileSync , existsSync } from 'fs'; +import os from 'os'; +import prompt from 'prompt'; +import jsonfile from 'jsonfile'; const env = process.env.npm_config_env || 'biz'; @@ -79,6 +81,118 @@ export class Utils { copyFile(arg: string) { return firstValueFrom(this.shell(arg)); } + updateEnvFiles(org: string, configPath: string) { + return new Observable((observer) => { + let props = this.getPropsFromFile('/etc/default/.env-local'); + console.log(props) + console.log(`\nWould you like to change any of the above properties: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer === 'Y') { + console.log('\nKey in new value or press Enter to keep current value: ') + prompt.get(props, (err: any, result: any) => { + console.log(result) + console.log(`\nWould you like to update config files: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + let content = ''; + for(const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + writeFileSync('.env-local', content); + this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { + this.updateEnvHzn(org, configPath) + .subscribe({ + complete: () => observer.complete() + }) + }) + }) + }) + } else { + this.updateEnvHzn(org, configPath) + .subscribe({ + complete: () => observer.complete() + }) + } + }) + }); + } + setupEnvFiles() { + return new Observable((observer) => { + let props = this.getPropsFromFile('./src/env-local'); + console.log('\nKey in new value or press Enter to keep current value: ') + prompt.get(props, (err: any, result: any) => { + console.log(result) + console.log(`\nWould you like to save config files: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer === 'Y') { + let content = ''; + for(const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + writeFileSync('.env-local', content); + this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { + this.copyFile('sudo cp ./src/env-hzn.json /etc/default/.env-hzn.json').then(() => { + observer.next(); + observer.complete(); + }) + }) + } else { + console.log(`config files not saved`) + observer.error(); + } + }) + }) + }) + } + updateEnvHzn(org: string, configPath: string) { + return new Observable((observer) => { + let props: any[] = []; + let hznJson = jsonfile.readFileSync(`${configPath}/.env-hzn.json`); + let envVars = hznJson[org]['envVars']; + let i = 0; + const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; + for(const [key, value] of Object.entries(envVars)) { + props[i] = {name: key, default: value, required: notRequired.indexOf(key) < 0}; + i++; + } + console.log(props) + console.log(`\nWould you like to change any of the above properties for ${org}: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer === 'Y') { + console.log('\nKey in new value or press Enter to keep current value: ') + prompt.get(props, (err: any, result: any) => { + console.log(result) + console.log(`\nWould you like to save these changes: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer === 'Y') { + for(const [key, value] of Object.entries(result)) { + envVars[key] = value; + } + jsonfile.writeFileSync('.env-hzn.json', hznJson, {spaces: 2}); + this.copyFile(`sudo mv .env-hzn.json ${configPath}/.env-hzn.json`).then(() => { + observer.complete(); + }) + } else { + console.log(`config files updated`) + observer.complete() + } + }) + }) + } else { + console.log(`config files not updated for ${org}`) + observer.complete(); + } + }) + }) + } + checkDefaultConfig() { + return new Observable((observer) => { + if(existsSync(`/etc/default/.env-local`) && existsSync(`/etc/default/.env-hzn.json`)) { + observer.complete() + } else { + observer.error('No config files.') + } + }) + } getHznInfo() { return readFileSync('/etc/default/horizon').toString().split('\n'); } @@ -90,23 +204,30 @@ export class Utils { observer.complete(); }) } + getPropsFromFile(file: string) { + let props: any[] = []; + let data = readFileSync(file).toString().split('\n'); + data.forEach((el, i) => { + if(el.length > 0) { + let prop = el.split('='); + if(prop && prop.length > 0) { + if(prop[0] === 'HZN_CUSTOM_NODE_ID' && (!prop[1] || prop[1].length == 0)) { + prop[1] = os.hostname(); + } + props[i] = {name: prop[0], default: prop[1], required: true}; + } + } + }); + return props; + } updateHznInfo() { return new Observable((observer) => { - let data = this.getHznInfo(); - let props: any[] = []; - data.forEach((el, i) => { - if(el.length > 0) { - let prop = el.split('='); - if(prop && prop.length > 0) { - props[i] = {name: prop[0], default: prop[1], required: true}; - } - } - }); + let props = this.getPropsFromFile('/etc/default/horizon'); console.log('\nKey in new value or press Enter to keep current value: ') prompt.get(props, (err: any, result: any) => { console.log(result) - console.log('\nWould like to update horizon: Y/n?') + console.log('\nWould you like to update horizon: Y/n?') prompt.get({name: 'answer', required: true}, (err: any, question: any) => { if(question.answer === 'Y') { let content = ''; @@ -120,6 +241,8 @@ export class Utils { observer.complete(); }) }) + } else { + observer.complete(); } }) }) diff --git a/src/env-hzn.json b/src/env-hzn.json new file mode 100644 index 0000000..ac70627 --- /dev/null +++ b/src/env-hzn.json @@ -0,0 +1,63 @@ +{ + "biz": + { + "envVars": { + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + }, + "demo": + { + "envVars": { + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + }, + "myorg": + { + "envVars": { + "ANAX": "https://github.com/open-horizon/anax/releases/latest/download/agent-install.sh", + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + } +} \ No newline at end of file diff --git a/src/env-local b/src/env-local new file mode 100644 index 0000000..e578d30 --- /dev/null +++ b/src/env-local @@ -0,0 +1,5 @@ +YOUR_DOCKERHUB_ID= +HZN_EXCHANGE_USER_AUTH= +HZN_EXCHANGE_URL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-exchange/v1 +HZN_FSS_CSSURL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-css +HZN_CUSTOM_NODE_ID= \ No newline at end of file From 7dd215caff19ec380b157c860984e407cc61d4d2 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Sun, 21 Nov 2021 11:51:25 -0500 Subject: [PATCH 3/9] set org id in init --- build/commands/deploy.js | 1 - build/commands/deploy.js.map | 2 +- build/common/src/env.js | 1 + build/common/src/env.js.map | 2 +- src/common/src/env.ts | 3 ++- src/common/src/utils.ts | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 03fb09d..21644e3 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -70,7 +70,6 @@ const handler = (argv) => { hzn_1.utils.checkDefaultConfig() .subscribe({ complete: () => { - console.log(skip_config_update); if (promptForUpdate.indexOf(action) < 0 || skip_config_update) { proceed(); } diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index 92e5731..d947e59 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAA+C;AAC/C,kDAA0B;AAC1B,kDAA0B;AAC1B,oDAA4B;AAC5B,2BAAgC;AAanB,QAAA,OAAO,GAAW,iBAAiB,CAAC;AACpC,QAAA,IAAI,GAAW,8BAA8B,CAAC;AAEpD,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,OAAO,CAAC;IACP,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gCAAgC,EAAC;IAC7D,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,yDAAyD,EAAC;IAC9F,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,yCAAyC,EAAC;IACvE,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAC;IACrD,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,8BAA8B,EAAC;IACjE,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,6BAA6B,EAAC;IAC7D,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAC;IAC9C,kBAAkB,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kCAAkC,EAAC;CAC/E,CAAC;KACD,UAAU,CAAC,QAAQ,EAAE;IAC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C;iBACF,CAAC,CAAA;aACH;QACH,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;YACnC,WAAK,CAAC,aAAa,EAAE;iBACpB,SAAS,CAAC;gBACT,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AApEW,QAAA,OAAO,WAoElB"} \ No newline at end of file diff --git a/build/common/src/env.js b/build/common/src/env.js index 698bf6f..9514af3 100644 --- a/build/common/src/env.js +++ b/build/common/src/env.js @@ -14,6 +14,7 @@ class Env { pEnv[i] = localEnv[i]; } } + console.log('env', pEnv); this.env = env; this.configPath = configPath; this.hznEnv = `${configPath}/.env-hzn.json`; diff --git a/build/common/src/env.js.map b/build/common/src/env.js.map index 31983df..7be20d3 100644 --- a/build/common/src/env.js.map +++ b/build/common/src/env.js.map @@ -1 +1 @@ -{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/src/env.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAClC,2BAA8C;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzB,MAAa,GAAG;IAMd,YAAY,GAAW,EAAE,UAAkB;QACzC,IAAG,IAAA,eAAU,EAAC,yBAAyB,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,yBAAyB,CAAC,CAAC,CAAC;YACvE,KAAI,I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AAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IACD,wBAAwB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,mBAAmB;QACjB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC;IACzC,CAAC;CACF;AArID,kBAqIC"} \ No newline at end of file +{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/src/env.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAClC,2BAA8C;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzB,MAAa,GAAG;IAMd,YAAY,GAAW,EAAE,UAAkB;QACzC,IAAG,IAAA,eAAU,EAAC,yBAAyB,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,yBAAyB,CAAC,CAAC,CAAC;YACvE,KAAI,IAAI,CAAC,IAAI,QAAQ,EAAE;gBACrB,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CA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,CAAC;IAC3B,CAAC;IACD,mBAAmB;QACjB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC;IACzC,CAAC;CACF;AAtID,kBAsIC"} \ No newline at end of file diff --git a/src/common/src/env.ts b/src/common/src/env.ts index 937d2b4..f829fd3 100644 --- a/src/common/src/env.ts +++ b/src/common/src/env.ts @@ -19,12 +19,14 @@ export class Env { pEnv[i] = localEnv[i]; } } + console.log('env', pEnv) this.env = env; this.configPath = configPath; this.hznEnv = `${configPath}/.env-hzn.json`; } init() { return new Observable((observer) => { + pEnv.HZN_ORG_ID = this.env; this.hznJson = JSON.parse(readFileSync(this.hznEnv).toString()); // console.log(process.cwd(), this.env, this.hznJson) this.envVars = this.hznJson[this.env]['envVars']; @@ -58,7 +60,6 @@ export class Env { } setAdditionalEnv() { let container = pEnv.MMS_CONTAINER_NAME || pEnv.MMS_SERVICE_NAME; - pEnv.HZN_ORG_ID = this.env; pEnv.MMS_PATTERN_NAME = `pattern-${pEnv.MMS_SERVICE_NAME}-${pEnv.ARCH}`; pEnv.MMS_CONTAINER = `${pEnv.YOUR_DOCKERHUB_ID}/${container}_${pEnv.ARCH}:${pEnv.MMS_SERVICE_VERSION}`.replace(/\r?\n|\r/g, '') pEnv.PATTERN_NAME = `pattern-${pEnv.SERVICE_NAME}`; diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index aa38789..0fb08d8 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -71,7 +71,7 @@ export class Utils { if(anax && anax.length > 0) { return this.shell(`curl -sSL ${anax} | sudo -s -E bash -s -- -i anax: -k css: -c css: -p IBM/pattern-ibm.helloworld -w '*' -T 120`) } else { - let nodeId = id ? ` -d ${id}` : ''; + let nodeId = id ? `-d ${id}` : ''; return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E ./agent-install.sh -i 'css:' ${nodeId}`) } } From 31b4e6119d75e2d9d2060f3d7463230fea3795d5 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Sun, 21 Nov 2021 11:54:43 -0500 Subject: [PATCH 4/9] remove console log --- src/common/src/env.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/src/env.ts b/src/common/src/env.ts index f829fd3..4a63cac 100644 --- a/src/common/src/env.ts +++ b/src/common/src/env.ts @@ -19,7 +19,6 @@ export class Env { pEnv[i] = localEnv[i]; } } - console.log('env', pEnv) this.env = env; this.configPath = configPath; this.hznEnv = `${configPath}/.env-hzn.json`; From c1ded979aac115197c0d96e69b7ce238c18712a3 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Sun, 21 Nov 2021 23:49:51 -0500 Subject: [PATCH 5/9] more refactor --- build/commands/deploy.js | 14 ++- build/commands/deploy.js.map | 2 +- build/common/src/env.d.ts | 4 +- build/common/src/env.js | 13 +- build/common/src/env.js.map | 2 +- build/common/src/hzn.d.ts | 6 +- build/common/src/hzn.js | 202 +++++++------------------------- build/common/src/hzn.js.map | 2 +- build/common/src/utils.d.ts | 6 +- build/common/src/utils.js | 52 ++++---- build/common/src/utils.js.map | 2 +- package.json | 2 +- src/commands/deploy.ts | 41 ++++--- src/common/src/env.ts | 12 +- src/common/src/hzn.ts | 202 ++++++++------------------------ src/common/src/utils.ts | 49 ++++---- src/config/mms/pattern.json | 18 +++ src/config/mms/policy.json | 9 ++ src/config/mms/service.json | 32 +++++ src/config/service/pattern.json | 11 ++ src/config/service/service.json | 23 ++++ 21 files changed, 307 insertions(+), 397 deletions(-) create mode 100644 src/config/mms/pattern.json create mode 100644 src/config/mms/policy.json create mode 100644 src/config/mms/service.json create mode 100644 src/config/service/pattern.json create mode 100644 src/config/service/service.json diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 21644e3..2be51a0 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -25,9 +25,11 @@ const builder = (yargs) => yargs .positional('action', { type: 'string', demandOption: true, - desc: 'Available actions: test, setup, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + - 'publishMMSPattern, registerAgent, publishMMSObject, unregisterAgent, allInOneMMS, showHznInfo, updateHznInfo, listService, listPattern, ' + - 'listNode, listObject, listDeploymentPolicy, listNodePattern, checkConfigState, getDeviceArch, createHznKey, uninstallHorizon' + desc: 'Available actions: ' + + 'allInOneMMS, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + + 'listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + + 'publishMMSPattern, publishMMSService, publishPatterrn, publishService, pullDockerImage, pushMMSImage, pushServiceImage, ' + + 'registerAgent, setup, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' }); exports.builder = builder; const handler = (argv) => { @@ -40,11 +42,11 @@ const handler = (argv) => { const objId = object_id || ''; const obj = object || ''; const p = pattern || ''; - const configPath = config_path || '/etc/default'; + const configPath = config_path || '/etc/default/config'; const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; console.log('$$$ ', action, env, configPath, n); const proceed = () => { - if ((0, fs_1.existsSync)(`${configPath}/.env-hzn.json`)) { + if ((0, fs_1.existsSync)(`${hzn_1.utils.getHznConfig()}/.env-hzn.json`)) { const hzn = new hzn_1.Hzn(env, configPath, n, objType, objId, obj, p); hzn.init() .subscribe({ @@ -74,7 +76,7 @@ const handler = (argv) => { proceed(); } else { - hzn_1.utils.updateEnvFiles(env, configPath) + hzn_1.utils.updateEnvFiles(env) .subscribe({ complete: () => { proceed(); diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index d947e59..db19a33 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAA+C;AAC/C,kDAA0B;AAC1B,kDAA0B;AAC1B,oDAA4B;AAC5B,2BAAgC;AAanB,QAAA,OAAO,GAAW,iBAAiB,CAAC;AACpC,QAAA,IAAI,GAAW,8BAA8B,CAAC;AAEpD,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,OAAO,CAAC;IACP,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gCAAgC,EAAC;IAC7D,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,yDAAyD,EAAC;IAC9F,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,yCAAyC,EAAC;IACvE,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAC;IACrD,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,8BAA8B,EAAC;IACjE,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,6BAA6B,EAAC;IAC7D,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAC;IAC9C,kBAAkB,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kCAAkC,EAAC;CAC/E,CAAC;KACD,UAAU,CAAC,QAAQ,EAAE;IACpB,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,IAAI;IAClB,IAAI,EAAE,yJAAyJ;QACzJ,0IAA0I;QAC1I,8HAA8H;CACrI,CAAC,CAAC;AAlBM,QAAA,OAAO,WAkBb;AAEA,MAAM,OAAO,GAAG,CAAC,IAAwB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EAAE,GAAG,EAAE;oBACb,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AApEW,QAAA,OAAO,WAoElB"} \ No newline at end of file diff --git a/build/common/src/env.d.ts b/build/common/src/env.d.ts index c2ce35b..a2f0080 100644 --- a/build/common/src/env.d.ts +++ b/build/common/src/env.d.ts @@ -4,8 +4,8 @@ export declare class Env { envVars: any; hznJson: any; hznEnv: any; - configPath: string; - constructor(env: string, configPath: string); + hznConfig: string; + constructor(env: string, hznConfig: string); init(): Observable; setAdditionalEnv(): void; getEnv(): string; diff --git a/build/common/src/env.js b/build/common/src/env.js index 9514af3..0518dbb 100644 --- a/build/common/src/env.js +++ b/build/common/src/env.js @@ -7,20 +7,20 @@ const cp = require('child_process'), exec = cp.exec; var dotenv = require('dotenv'); const pEnv = process.env; class Env { - constructor(env, configPath) { - if ((0, fs_1.existsSync)(`/etc/default/.env-local`)) { - const localEnv = dotenv.parse((0, fs_1.readFileSync)(`/etc/default/.env-local`)); + constructor(env, hznConfig) { + if ((0, fs_1.existsSync)(`${hznConfig}/.env-local`)) { + const localEnv = dotenv.parse((0, fs_1.readFileSync)(`${hznConfig}/.env-local`)); for (var i in localEnv) { pEnv[i] = localEnv[i]; } } - console.log('env', pEnv); this.env = env; - this.configPath = configPath; - this.hznEnv = `${configPath}/.env-hzn.json`; + this.hznConfig = hznConfig; + this.hznEnv = `${hznConfig}/.env-hzn.json`; } init() { return new rxjs_1.Observable((observer) => { + pEnv.HZN_ORG_ID = this.env; this.hznJson = JSON.parse((0, fs_1.readFileSync)(this.hznEnv).toString()); // console.log(process.cwd(), this.env, this.hznJson) this.envVars = this.hznJson[this.env]['envVars']; @@ -56,7 +56,6 @@ class Env { } setAdditionalEnv() { let container = pEnv.MMS_CONTAINER_NAME || pEnv.MMS_SERVICE_NAME; - pEnv.HZN_ORG_ID = this.env; pEnv.MMS_PATTERN_NAME = `pattern-${pEnv.MMS_SERVICE_NAME}-${pEnv.ARCH}`; pEnv.MMS_CONTAINER = `${pEnv.YOUR_DOCKERHUB_ID}/${container}_${pEnv.ARCH}:${pEnv.MMS_SERVICE_VERSION}`.replace(/\r?\n|\r/g, ''); pEnv.PATTERN_NAME = `pattern-${pEnv.SERVICE_NAME}`; diff --git a/build/common/src/env.js.map b/build/common/src/env.js.map index 7be20d3..ab584db 100644 --- a/build/common/src/env.js.map +++ b/build/common/src/env.js.map @@ -1 +1 @@ -{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/src/env.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAClC,2BAA8C;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzB,MAAa,GAAG;IAMd,YAAY,GAAW,EAAE,UAAkB;QACzC,IAAG,IAAA,eAAU,EAAC,yBAAyB,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,yBAAyB,CAAC,CAAC,CAAC;YACvE,KAAI,IAAI,CAAC,IAAI,QAAQ,EAAE;gBACrB,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,GAAG,UAAU,gBAAgB,CAAC;IAC9C,CAAC;IACD,IAAI;QACF,OAAO,IAAI,i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IAC9B,CAAC;IACD,kBAAkB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,kBAAkB;QAChB,OAAO,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC9D,CAAC;IACD,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IACD,iBAAiB;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IACD,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IACD,eAAe;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IACD,wBAAwB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,mBAAmB;QACjB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC;IACzC,CAAC;CACF;AArID,kBAqIC"} \ No newline at end of file diff --git a/build/common/src/hzn.d.ts b/build/common/src/hzn.d.ts index 2178ba6..9aeddca 100644 --- a/build/common/src/hzn.d.ts +++ b/build/common/src/hzn.d.ts @@ -24,14 +24,16 @@ export declare class Hzn { pushServiceImage(): Observable; buildMMSImage(): Observable; pushMMSImage(): Observable; + pullDockerImage(): Observable; + dockerImageExists(): Observable; + publishService(): Observable; + publishPattern(): Observable; publishMMSService(): Observable; publishMMSPattern(): Observable; unregisterAgent(): Observable; registerAgent(): Observable; publishMMSObject(): Observable; allInOneMMS(): Observable; - publishService(): Observable; - publishPattern(): Observable; showHznInfo(): Observable; updateHznInfo(): Observable; listService(): Observable; diff --git a/build/common/src/hzn.js b/build/common/src/hzn.js index 309c623..4f5d4d9 100644 --- a/build/common/src/hzn.js +++ b/build/common/src/hzn.js @@ -2,14 +2,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Hzn = exports.utils = void 0; const rxjs_1 = require("rxjs"); -const cp = require('child_process'), exec = cp.exec; const env_1 = require("./env"); const utils_1 = require("./utils"); -const prompt = require('prompt'); exports.utils = new utils_1.Utils(); class Hzn { constructor(env, configPath, name, objectType, objectId, objectFile, mmsPattern) { - this.envVar = new env_1.Env(env, configPath); + this.envVar = new env_1.Env(env, exports.utils.getHznConfig()); this.configPath = configPath; this.name = name; this.objectType = objectType; @@ -69,133 +67,73 @@ class Hzn { }); } buildServiceImage() { - return new rxjs_1.Observable((observer) => { - let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done building service docker image`); - } - else { - console.log('failed to build service docker image', err); - } - observer.next(); - observer.complete(); - }); - }); + let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); + return exports.utils.shell(arg, 'done building service docker image', 'failed to build service docker image'); } pushServiceImage() { - return new rxjs_1.Observable((observer) => { - let arg = `docker push ${this.envVar.getServiceContainer()}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done pushing service docker image`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to push service docker image', err); - observer.error(err); - } - }); - }); + let arg = `docker push ${this.envVar.getServiceContainer()}`; + return exports.utils.shell(arg, 'done pushing service docker image', 'failed to push service docker image'); } buildMMSImage() { let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); return exports.utils.shell(arg, 'done building mms docker image', 'failed to build mms docker image'); } pushMMSImage() { + let arg = `docker push ${this.envVar.getMMSContainer()}`; + return exports.utils.shell(arg, 'done pushing mms docker image', 'failed to push mms docker image'); + } + pullDockerImage() { + let image = this.name ? this.name : this.envVar.getServiceContainer(); + let arg = `docker pull ${image}`; + return exports.utils.shell(arg, 'done pulling docker image', 'failed to pull docker image'); + } + dockerImageExists() { + let image = this.name ? this.name : this.envVar.getMMSContainer(); + let arg = `docker images ${image}`; + // return utils.shell(arg, 'done checking docker image', 'failed to check docker image'); return new rxjs_1.Observable((observer) => { - let arg = `docker push ${this.envVar.getMMSContainer()}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done pushing mms docker image`); - observer.next(); + exports.utils.shell(arg, 'done checking docker image', 'failed to check docker image') + .subscribe({ + next: (res) => { + console.log(res); + const imageName = image.split(':'); + // @ts-ignore + let exist = res.indexOf(imageName[0]) > 0 && res.indexOf(imageName[1]) > 0; + observer.next(exist); observer.complete(); } - else { - console.log('failed to push mms docker image', err); - observer.error(err); - } }); }); } + publishService() { + let arg = `hzn exchange service publish -O ${this.envVar.getServiceContainerCreds()} -f ${this.serviceJson} --pull-image`; + return exports.utils.shell(arg, 'done publishing service', 'failed to publish service'); + } + publishPattern() { + let arg = `hzn exchange pattern publish -f ${this.patternJson}`; + return exports.utils.shell(arg, 'done publishing service pattern', 'failed to publish service pattern'); + } publishMMSService() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn exchange service publish -O ${this.envVar.getMMSContainerCreds()} -f ${this.mmsServiceJson}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done publishing mms service`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to publish mms service', err); - observer.error(err); - } - }); - }); + let arg = `hzn exchange service publish -O ${this.envVar.getMMSContainerCreds()} -f ${this.mmsServiceJson} --pull-image`; + return exports.utils.shell(arg, 'done publishing mms service', 'failed to publish mms service'); } publishMMSPattern() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn exchange pattern publish -f ${this.mmsPatternJson}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done publishing mss pattern`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to publish mms pattern', err); - observer.error(err); - } - }); - }); + let arg = `hzn exchange pattern publish -f ${this.mmsPatternJson}`; + return exports.utils.shell(arg, 'done publishing mss pattern', 'failed to publish mms pattern'); } unregisterAgent() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn unregister -f`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done unregistering agent`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to unregister agent', err); - observer.error(err); - } - }); - }); + let arg = `hzn unregister -f`; + return exports.utils.shell(arg, 'done unregistering agent', 'failed to unregister agent'); } registerAgent() { return new rxjs_1.Observable((observer) => { this.unregisterAgent().subscribe({ complete: () => { let arg = `hzn register --policy ${this.mmsPolicyJson} --pattern "${this.mmsPattern}"`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done registering mss agent`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to register mms agent', err); - observer.error(err); - } + exports.utils.shell(arg, 'done registering agent', 'failed to register agent') + .subscribe({ + complete: () => observer.complete(), + error: (err) => observer.error(err) }); }, error: (err) => { observer.error(err); @@ -204,22 +142,8 @@ class Hzn { }); } publishMMSObject() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn mms object publish --type=${this.objectType} --id=${this.objectId} --object=${this.objectFile} --pattern=${this.mmsPattern}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done publishing object`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to publish object', err); - observer.error(err); - } - }); - }); + let arg = `hzn mms object publish --type=${this.objectType} --id=${this.objectId} --object=${this.objectFile} --pattern=${this.mmsPattern}`; + return exports.utils.shell(arg, 'done publishing object', 'failed to publish object'); } allInOneMMS() { return new rxjs_1.Observable((observer) => { @@ -263,42 +187,6 @@ class Hzn { }); }); } - publishService() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn exchange service publish -O ${this.envVar.getServiceContainerCreds()} -f ${this.serviceJson} --pull-image`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done publishing ${this.envVar.getServiceName()} service`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to publish service', err); - observer.error(err); - } - }); - }); - } - publishPattern() { - return new rxjs_1.Observable((observer) => { - let arg = `hzn exchange pattern publish -f ${this.patternJson}`; - console.log(arg); - exec(arg, { maxBuffer: 1024 * 2000 }, (err, stdout, stderr) => { - if (!err) { - console.log(stdout); - console.log(`done publishing ${this.envVar.getPatternName()} pattern`); - observer.next(); - observer.complete(); - } - else { - console.log('failed to publish mms pattern', err); - observer.error(err); - } - }); - }); - } showHznInfo() { return exports.utils.showHznInfo(); } diff --git a/build/common/src/hzn.js.map b/build/common/src/hzn.js.map index f1cd4de..203be02 100644 --- a/build/common/src/hzn.js.map +++ b/build/common/src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AAK,CAAC,GAAG,CAAC;yBACpC,CAAC,CAAA;qBACH;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;wBAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC;qBACrB;gBACH,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAnSD,kBAmSC"} \ No newline at end of file diff --git a/build/common/src/utils.d.ts b/build/common/src/utils.d.ts index 37cf132..ae59c99 100644 --- a/build/common/src/utils.d.ts +++ b/build/common/src/utils.d.ts @@ -1,7 +1,9 @@ import { Observable } from 'rxjs'; export declare class Utils { + hznConfig: string; constructor(); init(): void; + getHznConfig(): string; listService(name: string): Observable; listPattern(name: string): Observable; listNode(name: string): Observable; @@ -17,9 +19,9 @@ export declare class Utils { installHznCli(anax: string, id: null): Observable; uninstallHorizon(): Observable; copyFile(arg: string): Promise; - updateEnvFiles(org: string, configPath: string): Observable; + updateEnvFiles(org: string): Observable; setupEnvFiles(): Observable; - updateEnvHzn(org: string, configPath: string): Observable; + updateEnvHzn(org: string): Observable; checkDefaultConfig(): Observable; getHznInfo(): string[]; showHznInfo(): Observable; diff --git a/build/common/src/utils.js b/build/common/src/utils.js index 1226f4e..8dba0e5 100644 --- a/build/common/src/utils.js +++ b/build/common/src/utils.js @@ -12,9 +12,14 @@ const prompt_1 = __importDefault(require("prompt")); const jsonfile_1 = __importDefault(require("jsonfile")); const env = process.env.npm_config_env || 'biz'; class Utils { - constructor() { } + constructor() { + this.hznConfig = '/etc/default/config'; + } init() { } + getHznConfig() { + return this.hznConfig; + } listService(name) { const arg = name.length > 0 ? `hzn exchange service list ${name}` : 'hzn exchange service list'; return this.shell(arg); @@ -75,7 +80,7 @@ class Utils { return this.shell(`curl -sSL ${anax} | sudo -s -E bash -s -- -i anax: -k css: -c css: -p IBM/pattern-ibm.helloworld -w '*' -T 120`); } else { - let nodeId = id ? ` -d ${id}` : ''; + let nodeId = id ? `-d ${id}` : ''; return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E ./agent-install.sh -i 'css:' ${nodeId}`); } } @@ -85,9 +90,9 @@ class Utils { copyFile(arg) { return (0, rxjs_1.firstValueFrom)(this.shell(arg)); } - updateEnvFiles(org, configPath) { + updateEnvFiles(org) { return new rxjs_1.Observable((observer) => { - let props = this.getPropsFromFile('/etc/default/.env-local'); + let props = this.getPropsFromFile(`${this.hznConfig}/.env-local`); console.log(props); console.log(`\nWould you like to change any of the above properties: Y/n?`); prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { @@ -102,8 +107,8 @@ class Utils { content += `${key}=${value}\n`; } (0, fs_1.writeFileSync)('.env-local', content); - this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { - this.updateEnvHzn(org, configPath) + this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { + this.updateEnvHzn(org) .subscribe({ complete: () => observer.complete() }); @@ -112,7 +117,7 @@ class Utils { }); } else { - this.updateEnvHzn(org, configPath) + this.updateEnvHzn(org) .subscribe({ complete: () => observer.complete() }); @@ -129,15 +134,17 @@ class Utils { console.log(`\nWould you like to save config files: Y/n?`); prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { if (question.answer === 'Y') { - let content = ''; - for (const [key, value] of Object.entries(result)) { - content += `${key}=${value}\n`; - } - (0, fs_1.writeFileSync)('.env-local', content); - this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { - this.copyFile('sudo cp ./src/env-hzn.json /etc/default/.env-hzn.json').then(() => { - observer.next(); - observer.complete(); + this.copyFile(`sudo cp -rf ./src/config /etc/default`).then(() => { + let content = ''; + for (const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + (0, fs_1.writeFileSync)('.env-local', content); + this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { + this.copyFile(`sudo cp ./src/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + observer.next(); + observer.complete(); + }); }); }); } @@ -149,10 +156,10 @@ class Utils { }); }); } - updateEnvHzn(org, configPath) { + updateEnvHzn(org) { return new rxjs_1.Observable((observer) => { let props = []; - let hznJson = jsonfile_1.default.readFileSync(`${configPath}/.env-hzn.json`); + let hznJson = jsonfile_1.default.readFileSync(`${this.hznConfig}/.env-hzn.json`); let envVars = hznJson[org]['envVars']; let i = 0; const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; @@ -174,12 +181,13 @@ class Utils { envVars[key] = value; } jsonfile_1.default.writeFileSync('.env-hzn.json', hznJson, { spaces: 2 }); - this.copyFile(`sudo mv .env-hzn.json ${configPath}/.env-hzn.json`).then(() => { + this.copyFile(`sudo mv .env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + console.log(`config files updated for ${org}`); observer.complete(); }); } else { - console.log(`config files updated`); + console.log(`config files not updated for ${org}`); observer.complete(); } }); @@ -194,7 +202,7 @@ class Utils { } checkDefaultConfig() { return new rxjs_1.Observable((observer) => { - if ((0, fs_1.existsSync)(`/etc/default/.env-local`) && (0, fs_1.existsSync)(`/etc/default/.env-hzn.json`)) { + if ((0, fs_1.existsSync)(`${this.hznConfig}/.env-local`) && (0, fs_1.existsSync)(`${this.hznConfig}/.env-hzn.json`)) { observer.complete(); } else { @@ -262,7 +270,7 @@ class Utils { console.log(arg); let child = exec(arg, options, (err, stdout, stderr) => { if (!err) { - console.log(stdout); + // console.log(stdout); console.log(success); observer.next(stdout); observer.complete(); diff --git a/build/common/src/utils.js.map b/build/common/src/utils.js.map index e691b64..3320c5c 100644 --- a/build/common/src/utils.js.map +++ b/build/common/src/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAsD;AACtD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G,EAAE,OAAO,EAAE,CAAC,GAAQ,EAAE,MAAW,EAAE,MAAW,EAAE,EAAE;gBACpE,IAAG,CAAC,GAAG,EAAE;oBACP,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBACpB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,GAAG,EAAE,CAAC,CAAC;oBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnQD,sBAmQC"} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAsD;AACtD,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAA4E;AAC5E,4CAAoB;AACpB,oDAA4B;AAC5B,wDAAgC;AAGhC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAEhD,MAAa,KAAK;IAEhB;QADA,cAAS,GAAG,qBAAqB,CAAC;IACnB,CAAC;IAChB,IAAI;IACJ,CAAC;IACD,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IACD,WAAW,CAAC,IAAY;QACtB,MAAM,G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C,GAAQ,EAAE,MAAW,EAAE,MAAW,EAAE,EAAE;gBACpE,IAAG,CAAC,GAAG,EAAE;oBACP,uBAAuB;oBACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,GAAG,EAAE,CAAC,CAAC;oBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1QD,sBA0QC"} \ No newline at end of file diff --git a/package.json b/package.json index 900932a..7676e02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hzn-cli", - "version": "0.1.3", + "version": "0.1.4", "description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments", "main": "./build/index.js", "bin": { diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index 56f9b37..d5dd1a4 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -34,9 +34,11 @@ export const builder: CommandBuilder = (yargs) => .positional('action', { type: 'string', demandOption: true, - desc: 'Available actions: test, setup, buildServiceImage, pushServiceImage, publishService, publishPatterrn, buildMMSImage, pushMMSImage, publishMMSService, ' + - 'publishMMSPattern, registerAgent, publishMMSObject, unregisterAgent, allInOneMMS, showHznInfo, updateHznInfo, listService, listPattern, ' + - 'listNode, listObject, listDeploymentPolicy, listNodePattern, checkConfigState, getDeviceArch, createHznKey, uninstallHorizon' + desc: 'Available actions: ' + + 'allInOneMMS, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + + 'listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + + 'publishMMSPattern, publishMMSService, publishPatterrn, publishService, pullDockerImage, pushMMSImage, pushServiceImage, ' + + 'registerAgent, setup, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' }); export const handler = (argv: Arguments): void => { @@ -53,12 +55,13 @@ export const handler = (argv: Arguments): void => { const objId = object_id || ''; const obj = object || ''; const p = pattern || ''; - const configPath = config_path || '/etc/default'; - const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] + const configPath = config_path || utils.getHznConfig(); + const skipInitialize = ['uninstallHorizon']; + const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] console.log('$$$ ', action, env, configPath, n); const proceed = () => { - if(existsSync(`${configPath}/.env-hzn.json`)) { + if(existsSync(`${utils.getHznConfig()}/.env-hzn.json`)) { const hzn = new Hzn(env, configPath, n, objType, objId, obj, p); hzn.init() @@ -88,7 +91,7 @@ export const handler = (argv: Arguments): void => { if(promptForUpdate.indexOf(action) < 0 || skip_config_update) { proceed(); } else { - utils.updateEnvFiles(env, configPath) + utils.updateEnvFiles(env) .subscribe({ complete: () => { proceed() @@ -98,13 +101,23 @@ export const handler = (argv: Arguments): void => { }) } }, error: (err) => { - console.log(err, 'Initialising...') - utils.setupEnvFiles() - .subscribe({ - complete: () => { - proceed(); - }, error: () => process.exit(0) - }) + if(skipInitialize.indexOf(action) < 0) { + console.log(err, 'Initialising...') + utils.setupEnvFiles() + .subscribe({ + complete: () => { + proceed(); + }, error: () => process.exit(0) + }) + } else { + utils.uninstallHorizon() + .subscribe({ + complete:() => { + console.log('process completed.'); + process.exit(0) + } + }) + } } }) }; diff --git a/src/common/src/env.ts b/src/common/src/env.ts index 4a63cac..992e2b6 100644 --- a/src/common/src/env.ts +++ b/src/common/src/env.ts @@ -11,17 +11,17 @@ export class Env { envVars: any; hznJson: any; hznEnv: any; - configPath: string; - constructor(env: string, configPath: string) { - if(existsSync(`/etc/default/.env-local`)) { - const localEnv = dotenv.parse(readFileSync(`/etc/default/.env-local`)); + hznConfig: string; + constructor(env: string, hznConfig: string) { + if(existsSync(`${hznConfig}/.env-local`)) { + const localEnv = dotenv.parse(readFileSync(`${hznConfig}/.env-local`)); for(var i in localEnv) { pEnv[i] = localEnv[i]; } } this.env = env; - this.configPath = configPath; - this.hznEnv = `${configPath}/.env-hzn.json`; + this.hznConfig = hznConfig; + this.hznEnv = `${hznConfig}/.env-hzn.json`; } init() { return new Observable((observer) => { diff --git a/src/common/src/hzn.ts b/src/common/src/hzn.ts index d3718db..e7d5126 100644 --- a/src/common/src/hzn.ts +++ b/src/common/src/hzn.ts @@ -1,10 +1,6 @@ -import { Observable, forkJoin } from 'rxjs'; -const cp = require('child_process'), -exec = cp.exec; -import { readFileSync, writeFileSync } from 'fs'; +import { Observable } from 'rxjs'; import { Env } from './env'; import { Utils } from './utils'; -const prompt = require('prompt'); export const utils = new Utils(); @@ -24,7 +20,7 @@ export class Hzn { configPath: string; name: string; constructor(env: string, configPath: string, name: string, objectType: string, objectId: string, objectFile: string, mmsPattern: string) { - this.envVar = new Env(env, configPath); + this.envVar = new Env(env, utils.getHznConfig()); this.configPath = configPath; this.name = name; this.objectType = objectType; @@ -84,126 +80,73 @@ export class Hzn { }); } buildServiceImage() { - return new Observable((observer) => { - let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done building service docker image`); - } else { - console.log('failed to build service docker image', err); - } - observer.next(); - observer.complete(); - }); - }); + let arg = `docker build -t ${this.envVar.getServiceContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); + return utils.shell(arg, 'done building service docker image', 'failed to build service docker image'); } pushServiceImage() { - return new Observable((observer) => { - let arg = `docker push ${this.envVar.getServiceContainer()}`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done pushing service docker image`); - observer.next(); - observer.complete(); - } else { - console.log('failed to push service docker image', err); - observer.error(err); - } - }); - }) + let arg = `docker push ${this.envVar.getServiceContainer()}`; + return utils.shell(arg, 'done pushing service docker image', 'failed to push service docker image'); } buildMMSImage() { let arg = `docker build -t ${this.envVar.getMMSContainer()} -f Dockerfile-${this.envVar.getArch()} .`.replace(/\r?\n|\r/g, ''); return utils.shell(arg, 'done building mms docker image', 'failed to build mms docker image'); } pushMMSImage() { + let arg = `docker push ${this.envVar.getMMSContainer()}`; + return utils.shell(arg, 'done pushing mms docker image', 'failed to push mms docker image'); + } + pullDockerImage() { + let image = this.name ? this.name : this.envVar.getServiceContainer() + let arg = `docker pull ${image}`; + return utils.shell(arg, 'done pulling docker image', 'failed to pull docker image'); + } + dockerImageExists() { + let image = this.name ? this.name : this.envVar.getMMSContainer() + let arg = `docker images ${image}`; + // return utils.shell(arg, 'done checking docker image', 'failed to check docker image'); return new Observable((observer) => { - let arg = `docker push ${this.envVar.getMMSContainer()}`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done pushing mms docker image`); - observer.next(); - observer.complete(); - } else { - console.log('failed to push mms docker image', err); - observer.error(err); + utils.shell(arg, 'done checking docker image', 'failed to check docker image') + .subscribe({ + next: (res) => { + console.log(res) + const imageName = image.split(':') + // @ts-ignore + let exist = res.indexOf(imageName[0]) > 0 && res.indexOf(imageName[1]) > 0; + observer.next(exist) + observer.complete() } - }); - }) + }) + }) + } + publishService() { + let arg = `hzn exchange service publish -O ${this.envVar.getServiceContainerCreds()} -f ${this.serviceJson} --pull-image`; + return utils.shell(arg, 'done publishing service', 'failed to publish service'); + } + publishPattern() { + let arg = `hzn exchange pattern publish -f ${this.patternJson}`; + return utils.shell(arg, 'done publishing service pattern', 'failed to publish service pattern'); } publishMMSService() { - return new Observable((observer) => { - let arg = `hzn exchange service publish -O ${this.envVar.getMMSContainerCreds()} -f ${this.mmsServiceJson}`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done publishing mms service`); - observer.next(); - observer.complete(); - } else { - console.log('failed to publish mms service', err); - observer.error(err); - } - }); - }) + let arg = `hzn exchange service publish -O ${this.envVar.getMMSContainerCreds()} -f ${this.mmsServiceJson} --pull-image`; + return utils.shell(arg, 'done publishing mms service', 'failed to publish mms service'); } publishMMSPattern() { - return new Observable((observer) => { - let arg = `hzn exchange pattern publish -f ${this.mmsPatternJson}`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done publishing mss pattern`); - observer.next(); - observer.complete(); - } else { - console.log('failed to publish mms pattern', err); - observer.error(err); - } - }); - }) + let arg = `hzn exchange pattern publish -f ${this.mmsPatternJson}`; + return utils.shell(arg, 'done publishing mss pattern', 'failed to publish mms pattern'); } unregisterAgent() { - return new Observable((observer) => { - let arg = `hzn unregister -f`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done unregistering agent`); - observer.next(); - observer.complete(); - } else { - console.log('failed to unregister agent', err); - observer.error(err); - } - }); - }) + let arg = `hzn unregister -f`; + return utils.shell(arg, 'done unregistering agent', 'failed to unregister agent'); } registerAgent() { return new Observable((observer) => { this.unregisterAgent().subscribe({ complete: () => { let arg = `hzn register --policy ${this.mmsPolicyJson} --pattern "${this.mmsPattern}"`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done registering mss agent`); - observer.next(); - observer.complete(); - } else { - console.log('failed to register mms agent', err); - observer.error(err); - } + utils.shell(arg, 'done registering agent', 'failed to register agent') + .subscribe({ + complete: () => observer.complete(), + error: (err) => observer.error(err) }) }, error: (err) => { observer.error(err); @@ -212,21 +155,8 @@ export class Hzn { }) } publishMMSObject() { - return new Observable((observer) => { - let arg = `hzn mms object publish --type=${this.objectType} --id=${this.objectId} --object=${this.objectFile} --pattern=${this.mmsPattern}` - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err: any, stdout: any, stderr: any) => { - if(!err) { - console.log(stdout) - console.log(`done publishing object`); - observer.next(); - observer.complete(); - } else { - console.log('failed to publish object', err); - observer.error(err); - } - }); - }) + let arg = `hzn mms object publish --type=${this.objectType} --id=${this.objectId} --object=${this.objectFile} --pattern=${this.mmsPattern}` + return utils.shell(arg, 'done publishing object', 'failed to publish object'); } allInOneMMS() { return new Observable((observer) => { @@ -270,40 +200,6 @@ export class Hzn { }) }); } - publishService() { - return new Observable((observer) => { - let arg = `hzn exchange service publish -O ${this.envVar.getServiceContainerCreds()} -f ${this.serviceJson} --pull-image`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err, stdout, stderr) => { - if(!err) { - console.log(stdout) - console.log(`done publishing ${this.envVar.getServiceName()} service`); - observer.next(); - observer.complete(); - } else { - console.log('failed to publish service', err); - observer.error(err); - } - }); - }) - } - publishPattern() { - return new Observable((observer) => { - let arg = `hzn exchange pattern publish -f ${this.patternJson}`; - console.log(arg) - exec(arg, {maxBuffer: 1024 * 2000}, (err, stdout, stderr) => { - if(!err) { - console.log(stdout) - console.log(`done publishing ${this.envVar.getPatternName()} pattern`); - observer.next(); - observer.complete(); - } else { - console.log('failed to publish mms pattern', err); - observer.error(err); - } - }); - }) - } showHznInfo() { return utils.showHznInfo(); } diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index 0fb08d8..333642b 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -10,9 +10,13 @@ import jsonfile from 'jsonfile'; const env = process.env.npm_config_env || 'biz'; export class Utils { + hznConfig = '/etc/default/config'; constructor() {} init() { } + getHznConfig() { + return this.hznConfig + } listService(name: string) { const arg = name.length > 0 ? `hzn exchange service list ${name}` : 'hzn exchange service list'; return this.shell(arg); @@ -81,9 +85,9 @@ export class Utils { copyFile(arg: string) { return firstValueFrom(this.shell(arg)); } - updateEnvFiles(org: string, configPath: string) { + updateEnvFiles(org: string) { return new Observable((observer) => { - let props = this.getPropsFromFile('/etc/default/.env-local'); + let props = this.getPropsFromFile(`${this.hznConfig}/.env-local`); console.log(props) console.log(`\nWould you like to change any of the above properties: Y/n?`) prompt.get({name: 'answer', required: true}, (err: any, question: any) => { @@ -98,8 +102,8 @@ export class Utils { content += `${key}=${value}\n`; } writeFileSync('.env-local', content); - this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { - this.updateEnvHzn(org, configPath) + this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { + this.updateEnvHzn(org) .subscribe({ complete: () => observer.complete() }) @@ -107,7 +111,7 @@ export class Utils { }) }) } else { - this.updateEnvHzn(org, configPath) + this.updateEnvHzn(org) .subscribe({ complete: () => observer.complete() }) @@ -124,17 +128,19 @@ export class Utils { console.log(`\nWould you like to save config files: Y/n?`) prompt.get({name: 'answer', required: true}, (err: any, question: any) => { if(question.answer === 'Y') { - let content = ''; - for(const [key, value] of Object.entries(result)) { - content += `${key}=${value}\n`; - } - writeFileSync('.env-local', content); - this.copyFile('sudo mv .env-local /etc/default/.env-local').then(() => { - this.copyFile('sudo cp ./src/env-hzn.json /etc/default/.env-hzn.json').then(() => { - observer.next(); - observer.complete(); + this.copyFile(`sudo cp -rf ./src/config /etc/default`).then(() => { + let content = ''; + for(const [key, value] of Object.entries(result)) { + content += `${key}=${value}\n`; + } + writeFileSync('.env-local', content); + this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { + this.copyFile(`sudo cp ./src/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + observer.next(); + observer.complete(); + }) }) - }) + }) } else { console.log(`config files not saved`) observer.error(); @@ -143,10 +149,10 @@ export class Utils { }) }) } - updateEnvHzn(org: string, configPath: string) { + updateEnvHzn(org: string) { return new Observable((observer) => { let props: any[] = []; - let hznJson = jsonfile.readFileSync(`${configPath}/.env-hzn.json`); + let hznJson = jsonfile.readFileSync(`${this.hznConfig}/.env-hzn.json`); let envVars = hznJson[org]['envVars']; let i = 0; const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; @@ -168,11 +174,12 @@ export class Utils { envVars[key] = value; } jsonfile.writeFileSync('.env-hzn.json', hznJson, {spaces: 2}); - this.copyFile(`sudo mv .env-hzn.json ${configPath}/.env-hzn.json`).then(() => { + this.copyFile(`sudo mv .env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + console.log(`config files updated for ${org}`) observer.complete(); }) } else { - console.log(`config files updated`) + console.log(`config files not updated for ${org}`) observer.complete() } }) @@ -186,7 +193,7 @@ export class Utils { } checkDefaultConfig() { return new Observable((observer) => { - if(existsSync(`/etc/default/.env-local`) && existsSync(`/etc/default/.env-hzn.json`)) { + if(existsSync(`${this.hznConfig}/.env-local`) && existsSync(`${this.hznConfig}/.env-hzn.json`)) { observer.complete() } else { observer.error('No config files.') @@ -253,7 +260,7 @@ export class Utils { console.log(arg); let child = exec(arg, options, (err: any, stdout: any, stderr: any) => { if(!err) { - console.log(stdout); + // console.log(stdout); console.log(success); observer.next(stdout); observer.complete(); diff --git a/src/config/mms/pattern.json b/src/config/mms/pattern.json new file mode 100644 index 0000000..98548b9 --- /dev/null +++ b/src/config/mms/pattern.json @@ -0,0 +1,18 @@ +{ + "name": "pattern-${MMS_SERVICE_NAME}-$ARCH", + "label": "Edge $MMS_SERVICE_NAME Service Pattern for $ARCH", + "description": "Pattern for $MMS_SERVICE_NAME for $ARCH", + "public": false, + "services": [ + { + "serviceUrl": "$MMS_SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ + { + "version": "$MMS_SERVICE_VERSION" + } + ] + } + ] +} diff --git a/src/config/mms/policy.json b/src/config/mms/policy.json new file mode 100644 index 0000000..fd19430 --- /dev/null +++ b/src/config/mms/policy.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "openhorizon.allowPrivileged", + "value": true + } + ], + "constraints": [ ] +} \ No newline at end of file diff --git a/src/config/mms/service.json b/src/config/mms/service.json new file mode 100644 index 0000000..a918627 --- /dev/null +++ b/src/config/mms/service.json @@ -0,0 +1,32 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$MMS_SERVICE_NAME for $ARCH", + "description": "A MMS example running with node js", + "documentation": "https://github.com/playground/open-labs/master/edge/services/helloworld/README.md", + "url": "$MMS_SERVICE_NAME", + "version": "$MMS_SERVICE_VERSION", + "arch": "$ARCH", + "public": true, + "sharable": "singleton", + "requiredServices": [ + { + "org": "$HZN_ORG_ID", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH" + } + ], + "userInput": [ + { "name": "MMS_OBJECT_TYPE", "label": "", "type": "string", "defaultValue": "$MMS_OBJECT_TYPE" }, + { "name": "MMS_VOLUME_MOUNT", "label": "", "type": "string", "defaultValue": "$VOLUME_MOUNT" }, + { "name": "UPDATE_FILE_NAME", "label": "", "type": "string", "defaultValue": "$UPDATE_FILE_NAME" } + ], + "deployment": { + "services": { + "$MMS_SERVICE_NAME": { + "image": "$MMS_CONTAINER", + "binds": ["$MMS_SHARED_VOLUME:$VOLUME_MOUNT:rw"] + } + } + } +} \ No newline at end of file diff --git a/src/config/service/pattern.json b/src/config/service/pattern.json new file mode 100644 index 0000000..2e7a15e --- /dev/null +++ b/src/config/service/pattern.json @@ -0,0 +1,11 @@ +{ + "name": "$PATTERN_NAME", + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ { "version": "$SERVICE_VERSION" } ] + } + ] +} \ No newline at end of file diff --git a/src/config/service/service.json b/src/config/service/service.json new file mode 100644 index 0000000..4b605dd --- /dev/null +++ b/src/config/service/service.json @@ -0,0 +1,23 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$SERVICE_NAME for $ARCH", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH", + "public": true, + "sharable": "singleton", + "requiredServices": [], + "userInput": [], + "deployment": { + "services": { + "$SERVICE_NAME": { + "image": "$SERVICE_CONTAINER", + "binds": ["$MMS_SHARED_VOLUME:$VOLUME_MOUNT:rw"], + "ports": [ + { "HostIP": "0.0.0.0", "HostPort": "3000:3000/tcp" } + ], + "privileged": true + } + } + } +} \ No newline at end of file From 5ac6280535ee4206dd6bdd038597c737e1412355 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Mon, 22 Nov 2021 11:43:33 -0500 Subject: [PATCH 6/9] add -b to skip prompt --- src/common/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index 333642b..6340b8f 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -76,7 +76,7 @@ export class Utils { return this.shell(`curl -sSL ${anax} | sudo -s -E bash -s -- -i anax: -k css: -c css: -p IBM/pattern-ibm.helloworld -w '*' -T 120`) } else { let nodeId = id ? `-d ${id}` : ''; - return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E ./agent-install.sh -i 'css:' ${nodeId}`) + return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E -b ./agent-install.sh -i 'css:' ${nodeId}`) } } uninstallHorizon() { From b32e7d1bc612609500745b3ea66f10eb5c489c2a Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Tue, 23 Nov 2021 13:17:54 -0500 Subject: [PATCH 7/9] add notrequired check --- setup/config/env-hzn.json | 2 +- src/common/src/utils.ts | 4 ++-- src/env-hzn.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/config/env-hzn.json b/setup/config/env-hzn.json index ac70627..03459e4 100644 --- a/setup/config/env-hzn.json +++ b/setup/config/env-hzn.json @@ -14,7 +14,7 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "" }, "metaVars": { } diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index 6340b8f..f3c8dd5 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -8,6 +8,7 @@ import jsonfile from 'jsonfile'; const env = process.env.npm_config_env || 'biz'; +const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE', 'HZN_CUSTOM_NODE_ID', 'UPDATE_FILE_NAME']; export class Utils { hznConfig = '/etc/default/config'; @@ -155,7 +156,6 @@ export class Utils { let hznJson = jsonfile.readFileSync(`${this.hznConfig}/.env-hzn.json`); let envVars = hznJson[org]['envVars']; let i = 0; - const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; for(const [key, value] of Object.entries(envVars)) { props[i] = {name: key, default: value, required: notRequired.indexOf(key) < 0}; i++; @@ -221,7 +221,7 @@ export class Utils { if(prop[0] === 'HZN_CUSTOM_NODE_ID' && (!prop[1] || prop[1].length == 0)) { prop[1] = os.hostname(); } - props[i] = {name: prop[0], default: prop[1], required: true}; + props[i] = {name: prop[0], default: prop[1], required: notRequired.indexOf(prop[0]) < 0}; } } }); diff --git a/src/env-hzn.json b/src/env-hzn.json index ac70627..03459e4 100644 --- a/src/env-hzn.json +++ b/src/env-hzn.json @@ -14,7 +14,7 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "" }, "metaVars": { } From 7eb973edd80db303e0d21f0f9c1dc658be467a6a Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Mon, 29 Nov 2021 10:30:46 -0500 Subject: [PATCH 8/9] copy config templates --- build/commands/deploy.js | 30 +++++++--- build/commands/deploy.js.map | 2 +- build/common/src/config/mms/pattern.json | 18 ++++++ build/common/src/config/mms/policy.json | 9 +++ build/common/src/config/mms/service.json | 32 ++++++++++ build/common/src/config/service/pattern.json | 11 ++++ build/common/src/config/service/service.json | 23 +++++++ build/common/src/env-hzn.json | 63 ++++++++++++++++++++ build/common/src/env-local | 5 ++ build/common/src/utils.js | 13 ++-- build/common/src/utils.js.map | 2 +- package.json | 4 +- src/common/src/utils.ts | 7 ++- 13 files changed, 197 insertions(+), 22 deletions(-) create mode 100644 build/common/src/config/mms/pattern.json create mode 100644 build/common/src/config/mms/policy.json create mode 100644 build/common/src/config/mms/service.json create mode 100644 build/common/src/config/service/pattern.json create mode 100644 build/common/src/config/service/service.json create mode 100644 build/common/src/env-hzn.json create mode 100644 build/common/src/env-local diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 2be51a0..f188f4f 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -42,8 +42,9 @@ const handler = (argv) => { const objId = object_id || ''; const obj = object || ''; const p = pattern || ''; - const configPath = config_path || '/etc/default/config'; - const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; + const configPath = config_path || hzn_1.utils.getHznConfig(); + const skipInitialize = ['uninstallHorizon']; + const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; console.log('$$$ ', action, env, configPath, n); const proceed = () => { if ((0, fs_1.existsSync)(`${hzn_1.utils.getHznConfig()}/.env-hzn.json`)) { @@ -86,13 +87,24 @@ const handler = (argv) => { }); } }, error: (err) => { - console.log(err, 'Initialising...'); - hzn_1.utils.setupEnvFiles() - .subscribe({ - complete: () => { - proceed(); - }, error: () => process.exit(0) - }); + if (skipInitialize.indexOf(action) < 0) { + console.log(err, 'Initialising...'); + hzn_1.utils.setupEnvFiles() + .subscribe({ + complete: () => { + proceed(); + }, error: () => process.exit(0) + }); + } + else { + hzn_1.utils.uninstallHorizon() + .subscribe({ + complete: () => { + console.log('process completed.'); + process.exit(0); + } + }); + } } }); }; diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index db19a33..c2a5b69 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAA+C;AAC/C,kDAA0B;AAC1B,kDAA0B;AAC1B,oDAA4B;AAC5B,2BAAgC;AAanB,QAAA,OAAO,GAAW,iBAAiB,CAAC;AACpC,QAAA,IAAI,GAAW,8BAA8B,CAAC;AAEpD,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,OAAO,CAAC;IACP,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gCAAgC,EAAC;IAC7D,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI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SAC5D;IACH,CAAC,CAAA;IAED,WAAK,CAAC,kBAAkB,EAAE;SACzB,SAAS,CAAC;QACT,QAAQ,EAAE,GAAG,EAAE;YACb,IAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,kBAAkB,EAAE;gBAC5D,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,WAAK,CAAC,cAAc,CAAC,GAAG,CAAC;qBACxB,SAAS,CAAC;oBACT,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,EAAE,CAAA;oBACX,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;wBAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;YACnC,WAAK,CAAC,aAAa,EAAE;iBACpB,SAAS,CAAC;gBACT,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AApEW,QAAA,OAAO,WAoElB"} \ No newline at end of file +{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA,2CAA+C;AAC/C,kDAA0B;AAC1B,kDAA0B;AAC1B,oDAA4B;AAC5B,2BAAgC;AAanB,QAAA,OAAO,GAAW,iBAAiB,CAAC;AACpC,QAAA,IAAI,GAAW,8BAA8B,CAAC;AAEpD,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,OAAO,CAAC;IACP,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ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AAA;oBACjB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AA/EW,QAAA,OAAO,WA+ElB"} \ No newline at end of file diff --git a/build/common/src/config/mms/pattern.json b/build/common/src/config/mms/pattern.json new file mode 100644 index 0000000..98548b9 --- /dev/null +++ b/build/common/src/config/mms/pattern.json @@ -0,0 +1,18 @@ +{ + "name": "pattern-${MMS_SERVICE_NAME}-$ARCH", + "label": "Edge $MMS_SERVICE_NAME Service Pattern for $ARCH", + "description": "Pattern for $MMS_SERVICE_NAME for $ARCH", + "public": false, + "services": [ + { + "serviceUrl": "$MMS_SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ + { + "version": "$MMS_SERVICE_VERSION" + } + ] + } + ] +} diff --git a/build/common/src/config/mms/policy.json b/build/common/src/config/mms/policy.json new file mode 100644 index 0000000..fd19430 --- /dev/null +++ b/build/common/src/config/mms/policy.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "openhorizon.allowPrivileged", + "value": true + } + ], + "constraints": [ ] +} \ No newline at end of file diff --git a/build/common/src/config/mms/service.json b/build/common/src/config/mms/service.json new file mode 100644 index 0000000..a918627 --- /dev/null +++ b/build/common/src/config/mms/service.json @@ -0,0 +1,32 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$MMS_SERVICE_NAME for $ARCH", + "description": "A MMS example running with node js", + "documentation": "https://github.com/playground/open-labs/master/edge/services/helloworld/README.md", + "url": "$MMS_SERVICE_NAME", + "version": "$MMS_SERVICE_VERSION", + "arch": "$ARCH", + "public": true, + "sharable": "singleton", + "requiredServices": [ + { + "org": "$HZN_ORG_ID", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH" + } + ], + "userInput": [ + { "name": "MMS_OBJECT_TYPE", "label": "", "type": "string", "defaultValue": "$MMS_OBJECT_TYPE" }, + { "name": "MMS_VOLUME_MOUNT", "label": "", "type": "string", "defaultValue": "$VOLUME_MOUNT" }, + { "name": "UPDATE_FILE_NAME", "label": "", "type": "string", "defaultValue": "$UPDATE_FILE_NAME" } + ], + "deployment": { + "services": { + "$MMS_SERVICE_NAME": { + "image": "$MMS_CONTAINER", + "binds": ["$MMS_SHARED_VOLUME:$VOLUME_MOUNT:rw"] + } + } + } +} \ No newline at end of file diff --git a/build/common/src/config/service/pattern.json b/build/common/src/config/service/pattern.json new file mode 100644 index 0000000..2e7a15e --- /dev/null +++ b/build/common/src/config/service/pattern.json @@ -0,0 +1,11 @@ +{ + "name": "$PATTERN_NAME", + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ { "version": "$SERVICE_VERSION" } ] + } + ] +} \ No newline at end of file diff --git a/build/common/src/config/service/service.json b/build/common/src/config/service/service.json new file mode 100644 index 0000000..4b605dd --- /dev/null +++ b/build/common/src/config/service/service.json @@ -0,0 +1,23 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$SERVICE_NAME for $ARCH", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH", + "public": true, + "sharable": "singleton", + "requiredServices": [], + "userInput": [], + "deployment": { + "services": { + "$SERVICE_NAME": { + "image": "$SERVICE_CONTAINER", + "binds": ["$MMS_SHARED_VOLUME:$VOLUME_MOUNT:rw"], + "ports": [ + { "HostIP": "0.0.0.0", "HostPort": "3000:3000/tcp" } + ], + "privileged": true + } + } + } +} \ No newline at end of file diff --git a/build/common/src/env-hzn.json b/build/common/src/env-hzn.json new file mode 100644 index 0000000..03459e4 --- /dev/null +++ b/build/common/src/env-hzn.json @@ -0,0 +1,63 @@ +{ + "biz": + { + "envVars": { + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "" + }, + "metaVars": { + } + }, + "demo": + { + "envVars": { + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + }, + "myorg": + { + "envVars": { + "ANAX": "https://github.com/open-horizon/anax/releases/latest/download/agent-install.sh", + "SERVICE_NAME": "saved-model-service", + "SERVICE_CONTAINER_NAME": "saved-model-service", + "SERVICE_VERSION": "1.0.0", + "SERVICE_CONTAINER_CREDS": "", + "VOLUME_MOUNT": "/mms-shared", + "MMS_SHARED_VOLUME": "demo_model_mms_helper_shared_volume", + "MMS_CONTAINER_CREDS": "", + "MMS_CONTAINER_NAME": "mms-service", + "MMS_SERVICE_NAME": "mms-service", + "MMS_SERVICE_VERSION": "1.0.0", + "MMS_OBJECT_TYPE": "object_detection", + "MMS_OBJECT_ID": "config.json", + "MMS_OBJECT_FILE": "path-to-file" + }, + "metaVars": { + } + } +} \ No newline at end of file diff --git a/build/common/src/env-local b/build/common/src/env-local new file mode 100644 index 0000000..e578d30 --- /dev/null +++ b/build/common/src/env-local @@ -0,0 +1,5 @@ +YOUR_DOCKERHUB_ID= +HZN_EXCHANGE_USER_AUTH= +HZN_EXCHANGE_URL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-exchange/v1 +HZN_FSS_CSSURL=https://cp-console.ieam42-edge-8e873dd4c685acf6fd2f13f4cdfb05bb-0000.us-south.containers.appdomain.cloud/edge-css +HZN_CUSTOM_NODE_ID= \ No newline at end of file diff --git a/build/common/src/utils.js b/build/common/src/utils.js index 8dba0e5..e8d9517 100644 --- a/build/common/src/utils.js +++ b/build/common/src/utils.js @@ -11,6 +11,7 @@ const os_1 = __importDefault(require("os")); const prompt_1 = __importDefault(require("prompt")); const jsonfile_1 = __importDefault(require("jsonfile")); const env = process.env.npm_config_env || 'biz'; +const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE', 'HZN_CUSTOM_NODE_ID', 'UPDATE_FILE_NAME']; class Utils { constructor() { this.hznConfig = '/etc/default/config'; @@ -81,7 +82,7 @@ class Utils { } else { let nodeId = id ? `-d ${id}` : ''; - return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E ./agent-install.sh -i 'css:' ${nodeId}`); + return this.shell(`curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/agent-install.sh/data && chmod +x agent-install.sh && sudo -s -E -b ./agent-install.sh -i 'css:' ${nodeId}`); } } uninstallHorizon() { @@ -127,21 +128,22 @@ class Utils { } setupEnvFiles() { return new rxjs_1.Observable((observer) => { - let props = this.getPropsFromFile('./src/env-local'); + // console.log(process.cwd(), __dirname, __filename) + let props = this.getPropsFromFile(`${__dirname}/env-local`); console.log('\nKey in new value or press Enter to keep current value: '); prompt_1.default.get(props, (err, result) => { console.log(result); console.log(`\nWould you like to save config files: Y/n?`); prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { if (question.answer === 'Y') { - this.copyFile(`sudo cp -rf ./src/config /etc/default`).then(() => { + this.copyFile(`sudo cp -rf ${__dirname}/config /etc/default`).then(() => { let content = ''; for (const [key, value] of Object.entries(result)) { content += `${key}=${value}\n`; } (0, fs_1.writeFileSync)('.env-local', content); this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { - this.copyFile(`sudo cp ./src/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + this.copyFile(`sudo cp ${__dirname}/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { observer.next(); observer.complete(); }); @@ -162,7 +164,6 @@ class Utils { let hznJson = jsonfile_1.default.readFileSync(`${this.hznConfig}/.env-hzn.json`); let envVars = hznJson[org]['envVars']; let i = 0; - const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE']; for (const [key, value] of Object.entries(envVars)) { props[i] = { name: key, default: value, required: notRequired.indexOf(key) < 0 }; i++; @@ -231,7 +232,7 @@ class Utils { if (prop[0] === 'HZN_CUSTOM_NODE_ID' && (!prop[1] || prop[1].length == 0)) { prop[1] = os_1.default.hostname(); } - props[i] = { name: prop[0], default: prop[1], required: true }; + props[i] = { name: prop[0], default: prop[1], required: notRequired.indexOf(prop[0]) < 0 }; } } }); diff --git a/build/common/src/utils.js.map b/build/common/src/utils.js.map index 3320c5c..fec0df4 100644 --- a/build/common/src/utils.js.map +++ b/build/common/src/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAsD;AACtD,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,EACnC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AACf,2BAA4E;AAC5E,4CAAoB;AACpB,oDAA4B;AAC5B,wDAAgC;AAGhC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CAAC,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,GAAW,EAAE,OAAO,GAAC,+BAA+B,EAAE,KAAK,GAAC,gBAAgB,EAAE,OAAO,GAAC,EAAC,SAAS,EAAE,IAAI,GAAG,IAAI,EAAC;QAClH,OAAO,IAAI,iBAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAQ,EAAE,MAAW,EAAE,MAAW,EAAE,EAAE;gBACpE,IAAG,CAAC,GAAG,EAAE;oBACP,uBAAuB;oBACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,GAAG,EAAE,CAAC,CAAC;oBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1QD,sBA0QC"} \ No newline at end of file diff --git a/package.json b/package.json index 7676e02..0ddcf05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hzn-cli", - "version": "0.1.4", + "version": "0.1.5", "description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments", "main": "./build/index.js", "bin": { @@ -8,7 +8,7 @@ }, "scripts": { "start": "nodemon -e ts --watch 'src/**/*.ts' --exec 'npm run build'", - "build": "npx tsc && chmod +x build/*.js && chmod +x build/**/*.js", + "build": "npx tsc && chmod +x build/*.js && chmod +x build/**/*.js && cp src/env-* build/common/src && cp -r src/config build/common/src", "local": "npm run build && sudo npm i -g && oh", "refresh": "rm -rf ./node_modules ./package-lock.json && npm install" }, diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index f3c8dd5..20593ee 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -122,21 +122,22 @@ export class Utils { } setupEnvFiles() { return new Observable((observer) => { - let props = this.getPropsFromFile('./src/env-local'); + // console.log(process.cwd(), __dirname, __filename) + let props = this.getPropsFromFile(`${__dirname}/env-local`); console.log('\nKey in new value or press Enter to keep current value: ') prompt.get(props, (err: any, result: any) => { console.log(result) console.log(`\nWould you like to save config files: Y/n?`) prompt.get({name: 'answer', required: true}, (err: any, question: any) => { if(question.answer === 'Y') { - this.copyFile(`sudo cp -rf ./src/config /etc/default`).then(() => { + this.copyFile(`sudo cp -rf ${__dirname}/config /etc/default`).then(() => { let content = ''; for(const [key, value] of Object.entries(result)) { content += `${key}=${value}\n`; } writeFileSync('.env-local', content); this.copyFile(`sudo mv .env-local ${this.hznConfig}/.env-local`).then(() => { - this.copyFile(`sudo cp ./src/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { + this.copyFile(`sudo cp ${__dirname}/env-hzn.json ${this.hznConfig}/.env-hzn.json`).then(() => { observer.next(); observer.complete(); }) From 601d9181ef08d293c6d6708b315304fa80eca85c Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Mon, 29 Nov 2021 15:36:15 -0500 Subject: [PATCH 9/9] update README and fixed env-hzn.json bug --- README.md | 124 ++++++++++------------------------ build/common/src/env-hzn.json | 9 ++- package.json | 2 +- src/env-hzn.json | 9 ++- 4 files changed, 48 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index 5d1ad13..f68abac 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,7 @@ Open Horizon toolkit is a CLI built with Typescript for the NodeJS developers. ## Pre-release version of hzn-cli, howto? -For now, you can give it a test drive by cloning this repo - -```git clone git@github.com:playground/hzn-cli.git``` - -cd into hzn-cli then run the following command to install it on your device, this will install hzn-cli and the command will be available globally. - -NOTE: Node version 12 or higher is required to be installed before running the following command - -```npm run local``` +```npm i -g hzn-cli``` After installlation run @@ -25,86 +17,40 @@ After installlation run Deploy to Org Positionals: - action Available actions: test, buildServiceImage, pushServiceImage, - publishService, publishPatterrn, buildMMSImage, pushMMSImage, - publishMMSService, publishMMSPattern, agentRun, publishMMSObject, - unregisterAgent, registerAgent, showHznInfo, updateHznInfo, - listService, listPattern, listNode, listObject, listDeploymentPolicy, - listNodePattern, checkConfigState, getDeviceArch, createHznKey + action Available actions: allInOneMMS, buildMMSImage, buildServiceImage, + checkConfigState, createHznKey, dockerImageExists, getDeviceArch, + listDeploymentPolicy, listNode, listNodePattern, listObject, + listPattern, listService, publishMMSObject, publishMMSPattern, + publishMMSService, publishPatterrn, publishService, pullDockerImage, + pushMMSImage, pushServiceImage, registerAgent, setup, showHznInfo, + test, uninstallHorizon, unregisterAgent, updateHznInfo [string] [required] Options: - --version Show version number [boolean] - --org Organization to be deployed to [string] - --configpath Specify path to your configuration, default is ./config - [string] - --name Name of service, pattern, policy & etc. [string] - -h, --help Show help [boolean] + --version Show version number [boolean] + --org Organization to be deployed to [string] + --config_path Specify path to your configuration, default is + ./config [string] + --name Name of service, pattern, policy & etc. [string] + --object_type Type of object [string] + --object_id Id of object to be published [string] + --object Object file to be published [string] + --pattern MMS pattern [string] + --skip_config_update Do not prompt for config updates [string] + -h, --help Show help [boolean] ``` +## To setup your environment, you will need to run +```oh deploy setup``` -## To execute any of the "oh" actions, .env-hzn.json config file is required +This will prompt you for your credential, Docker Hub Id & other configuration parameters. +This will also install and setup hzn envirnoment for you if it hasn't been installled. -.env-hzn.json template -``` -{ - "biz": - { - "envVars": { - "HZN_ORG_ID": "", - "HZN_EXCHANGE_USER_AUTH": "", - "HZN_EXCHANGE_URL": "", - "HZN_FSS_CSSURL": "", - "SERVICE_NAME": "", - "SERVICE_VERSION": "", - "SERVICE_CONTAINER_NAME": "", - "SERVICE_CONTAINER_CREDS": "", - "YOUR_DOCKERHUB_ID": "", - "VOLUME_MOUNT": "", - "MMS_SHARED_VOLUME": "", - "MMS_CONTAINER_CREDS": "", - "MMS_CONTAINER_NAME": "", - "MMS_SERVICE_NAME": "", - "MMS_SERVICE_VERSION": "", - "MMS_OBJECT_TYPE": "", - "MMS_OBJECT_ID": "", - "MMS_OBJECT_FILE": "config/config.json", - "UPDATE_FILE_NAME": "" - }, - "metaVars": { - } - }, - "demo": - { - "envVars": { - "HZN_ORG_ID": "", - "HZN_EXCHANGE_USER_AUTH": "", - "HZN_EXCHANGE_URL": "", - "HZN_FSS_CSSURL": "", - "SERVICE_NAME": "", - "SERVICE_VERSION": "", - "SERVICE_CONTAINER_NAME": "", - "SERVICE_CONTAINER_CREDS": "", - "YOUR_DOCKERHUB_ID": "", - "VOLUME_MOUNT": "", - "MMS_SHARED_VOLUME": "", - "MMS_CONTAINER_CREDS": "", - "MMS_CONTAINER_NAME": "", - "MMS_SERVICE_NAME": "", - "MMS_SERVICE_VERSION": "", - "MMS_OBJECT_TYPE": "", - "MMS_OBJECT_ID": "", - "MMS_OBJECT_FILE": "config/config.json", - "UPDATE_FILE_NAME": "" - }, - "metaVars": { - } - } -} -``` +## To execute any of the "oh" actions +```oh deploy , for example: oh deploy registerAgent``` -## After installation, you can test out the cli by running +## After installation and initialization, you can test out the cli by running -```oh deploy test --configpath /home/pi/config``` +```oh deploy test``` ``` _ _ _ @@ -121,25 +67,25 @@ process completed. ## Here are a few examples of actions you can perform with "oh", default org is "biz" Build service docker image -```oh deploy buildServiceImage --config_path /home/pi/config``` +```oh deploy buildServiceImage``` Push service docker image -```oh deploy pushServiceImage --config_path /home/pi/config``` +```oh deploy pushServiceImage``` Publish service to management hub -```oh deploy publishService --config_path /home/pi/config``` +```oh deploy publishService``` Publish service pattern -```oh deploy publishPattern --config_path /home/pi/config``` +```oh deploy publishPattern``` Publish MMS service -```oh deploy publishMMSService --config_path /home/pi/config``` +```oh deploy publishMMSService``` -Publish MMS pattern +Publish MMS pattern and specify path to the policy.json ```oh deploy publishMMSPattern --config_path /home/pi/config``` Publish MMS Object file -```oh deploy publishMMSObject --object_type=object_detection --object_id=config.json --object=/Users/jeff/Downloads/demo-model/demo/version1/model.zip --pattern=pattern-pi-mms-service-arm --config_path=config``` +```oh deploy publishMMSObject --object_type=object_detection --object_id=config.json --object=/Users/jeff/Downloads/demo-model/demo/version1/model.zip --pattern=pattern-pi-mms-service-arm``` *Register agent (org=demo)- -```oh deploy registerAgent --configpath /home/pi/config --org demo``` \ No newline at end of file +```oh deploy registerAgent --org demo``` \ No newline at end of file diff --git a/build/common/src/env-hzn.json b/build/common/src/env-hzn.json index 03459e4..aca2359 100644 --- a/build/common/src/env-hzn.json +++ b/build/common/src/env-hzn.json @@ -14,7 +14,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { } @@ -34,7 +35,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { } @@ -55,7 +57,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { } diff --git a/package.json b/package.json index 0ddcf05..d9ca7c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hzn-cli", - "version": "0.1.5", + "version": "0.1.6", "description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments", "main": "./build/index.js", "bin": { diff --git a/src/env-hzn.json b/src/env-hzn.json index 03459e4..aca2359 100644 --- a/src/env-hzn.json +++ b/src/env-hzn.json @@ -14,7 +14,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { } @@ -34,7 +35,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { } @@ -55,7 +57,8 @@ "MMS_SERVICE_VERSION": "1.0.0", "MMS_OBJECT_TYPE": "object_detection", "MMS_OBJECT_ID": "config.json", - "MMS_OBJECT_FILE": "path-to-file" + "MMS_OBJECT_FILE": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" }, "metaVars": { }