diff --git a/bin/build.js b/bin/build.js new file mode 100755 index 0000000..23f6c10 --- /dev/null +++ b/bin/build.js @@ -0,0 +1,85 @@ +#! /usr/bin/env node +const path = require('path'); +const cp = require('child_process'), + exec = cp.exec; +const fs = require('fs'); + +const task = process.env.npm_config_task; +let userName = process.env.npm_config_username; +let imageName = process.env.npm_config_imagename; +let version = process.env.npm_config_imageversion; +const hznConfig = process.env.npm_config_hznconfig; +let org = process.env.npm_config_org || 'biz'; + +console.log('current directory: ', process.cwd()); +let build = { + getConfig: () => { + if(fs.existsSync(hznConfig)) { + let hznJson = JSON.parse(fs.readFileSync(hznConfig).toString()); + let envVars = hznJson[org]['envVars']; + userName = envVars.YOUR_DOCKERHUB_ID; + imageName = envVars.SERVICE_NAME; + version = envVars.SERVICE_VERSION; + } + }, + dockerImage: () => { + if(hznConfig) { + build.getConfig(); + } + if(userName && imageName && version) { + let arg = `hzn architecture` + exec(arg, {maxBuffer: 1024 * 2000}, (err, stdout, stderr) => { + if(!err) { + let arch = stdout.replace(/\r?\n|\r/g, ''); + arg = `docker build -t ${userName}/${imageName}_${arch}:${version} -f Dockerfile-${arch} .`; + exec(arg, {maxBuffer: 1024 * 3500}, (err, stdout, stderr) => { + if(!err) { + console.log(stdout) + console.log(`done building image ${imageName}`); + } else { + console.log(`failed to build image ${imageName}`, err); + } + }); + } else { + console.log('failed to identify arch', err); + } + }); + } else { + console.log('docker username, imagename and imageversion are required...'); + process.exit(0); + } + }, + pushImage: () => { + if(hznConfig) { + build.getConfig(); + } + if(userName && imageName && version) { + let arg = `hzn architecture` + exec(arg, {maxBuffer: 1024 * 2000}, (err, stdout, stderr) => { + if(!err) { + let arch = stdout.replace(/\r?\n|\r/g, ''); + arg = `docker push ${userName}/${imageName}_${arch}:${version}`; + exec(arg, {maxBuffer: 1024 * 3500}, (err, stdout, stderr) => { + if(!err) { + console.log(stdout) + console.log(`done publishing image ${imageName}`); + } else { + console.log(`failed to publish image ${imageName}`, err); + } + }); + } else { + console.log('failed to identify arch', err); + } + }); + } else { + console.log('docker username, imagename and imageversion are required...'); + process.exit(0); + } + }, + default: () => { + console.log('command not found.'); + process.exit(0); + } +} + +build[task] ? build[task]() : build.default(); diff --git a/bin/install.js b/bin/install.js new file mode 100755 index 0000000..82395cb --- /dev/null +++ b/bin/install.js @@ -0,0 +1,93 @@ +#! /usr/bin/env node +const fs = require('fs'); +const os = require('os'); +const jsonfile = require('jsonfile'); +const hznConfig = '/etc/default/config'; + +const template = { + envHzn: { + "envVars": { + "ANAX": "", + "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": "config/config.json", + "UPDATE_FILE_NAME": "model.zip" + }, + "metaVars": { + } + }, + envLocal: { + "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": "", + "DEFAULT_ORG": "" + } +} + +const getPropsFromFile = (file) => { + let props = {}; + try { + if(fs.existsSync(file)) { + let data = fs.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[prop[0]] = prop[1]; + } + } + }); + } + } catch(e) { + console.log(e) + props = []; + } + return props; +} + +const postInstall = () => { + if(fs.existsSync(`${hznConfig}/.env-local`)) { + let props = getPropsFromFile(`${hznConfig}/.env-local`); + Object.keys(template.envLocal).forEach((key) => { + if(!props[key]) { + props[key] = template.envLocal[key] + } + }) + let content = ''; + Object.keys(props).forEach((key) => { + content += `${key}=${props[key]}\n`; + }) + fs.writeFileSync(`${hznConfig}/.env-local`, content); + } + if(fs.existsSync(`${hznConfig}/.env-hzn.json`)) { + let json = jsonfile.readFileSync(`${hznConfig}/.env-hzn.json`); + Object.keys(template.envHzn).forEach((child) => { + let node = template.envHzn[child]; + Object.keys(json).forEach((org) => { + Object.keys(node).forEach((key) => { + if(!json[org][child][key]) { + json[org][child][key] = node[key]; + } + }) + }) + }) + jsonfile.writeFileSync(`${hznConfig}/.env-hzn.json`, json, {spaces: 2}); + } +}; + +postInstall() \ No newline at end of file diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 4b8244c..2c8f7e8 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -26,10 +26,10 @@ const builder = (yargs) => yargs type: 'string', demandOption: true, desc: 'Available actions: ' + - 'allInOneMMS, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + - 'listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + + 'allInOneMMS, buildAndPublish, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + + 'getIpAddress, listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + 'publishMMSPattern, publishMMSService, publishPatterrn, publishService, pullDockerImage, pushMMSImage, pushServiceImage, ' + - 'registerAgent, removeOrg, setup, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' + 'registerAgent, removeOrg, setup, setupManagementHub, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' }); exports.builder = builder; const handler = (argv) => { @@ -44,8 +44,8 @@ const handler = (argv) => { const p = pattern || ''; const configPath = config_path || hzn_1.utils.getHznConfig(); const skipInitialize = ['buildMMSImage', 'buildServiceImage', 'dockerImageExists', 'uninstallHorizon']; - const justRun = ['checkConfigState', 'createHznKey', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'showHznInfo', 'uninstallHorizon', 'updateHznInfo']; - const promptForUpdate = ['setup', 'test', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; + const justRun = ['checkConfigState', 'createHznKey', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'setupManagementHub', 'showHznInfo', 'uninstallHorizon', 'updateHznInfo']; + const promptForUpdate = ['setup', 'test', 'buildAndPublish', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; if (env.length == 0) { let value = hzn_1.utils.getPropValueFromFile(`${hzn_1.utils.getHznConfig()}/.env-local`, 'DEFAULT_ORG'); env = value.length > 0 ? value : 'biz'; diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index 9c75b19..bd0e109 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,GA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AAA;wBACX,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;4BAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;4BAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;wBAClB,CAAC;qBACF,CAAC,CAAA;iBACH;YACH,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;gBAChB,IAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;oBACrC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;oBACnC,WAAK,CAAC,aAAa,CAAC,GAAG,CAAC;yBACvB,SAAS,CAAC;wBACT,QAAQ,EAAE,GAAG,EAAE;4BACb,OAAO,EAAE,CAAC;wBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;qBAChC,CAAC,CAAA;iBACH;qBAAM;oBACL,WAAK,CAAC,gBAAgB,EAAE;yBACvB,SAAS,CAAC;wBACT,QAAQ,EAAC,GAAG,EAAE;4BACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;4BAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;wBACjB,CAAC;qBACF,CAAC,CAAA;iBACH;YACH,CAAC;SACF,CAAC,CAAA;KACH;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,8FAA8F,CAAC,CAAA;KAC5G;AACH,CAAC,CAAC;AA3GW,QAAA,OAAO,WA2GlB"} \ No newline at end of file diff --git a/build/common/src/hzn.d.ts b/build/common/src/hzn.d.ts index 9aeddca..04967f8 100644 --- a/build/common/src/hzn.d.ts +++ b/build/common/src/hzn.d.ts @@ -33,6 +33,7 @@ export declare class Hzn { unregisterAgent(): Observable; registerAgent(): Observable; publishMMSObject(): Observable; + buildAndPublish(): Observable; allInOneMMS(): Observable; showHznInfo(): Observable; updateHznInfo(): Observable; @@ -50,5 +51,7 @@ export declare class Hzn { installHznCli(): Observable; uninstallHorizon(): Observable; preInstallHznCli(): Observable; + setupManagementHub(): Observable; setupRedHat(): Observable; + getIpAddress(): Observable; } diff --git a/build/common/src/hzn.js b/build/common/src/hzn.js index 4f5d4d9..6987a17 100644 --- a/build/common/src/hzn.js +++ b/build/common/src/hzn.js @@ -145,6 +145,66 @@ class Hzn { 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'); } + buildAndPublish() { + return new rxjs_1.Observable((observer) => { + this.buildServiceImage().subscribe({ + complete: () => { + this.pushServiceImage().subscribe({ + complete: () => { + this.buildMMSImage().subscribe({ + complete: () => { + this.pushMMSImage().subscribe({ + complete: () => { + this.publishService().subscribe({ + complete: () => { + this.publishPattern().subscribe({ + complete: () => { + this.publishMMSService().subscribe({ + complete: () => { + this.publishMMSPattern().subscribe({ + complete: () => { + this.registerAgent().subscribe({ + complete: () => { + observer.next(); + observer.complete(); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }, error: (err) => { + observer.error(err); + } + }); + }); + } allInOneMMS() { return new rxjs_1.Observable((observer) => { this.unregisterAgent().subscribe({ @@ -261,6 +321,9 @@ class Hzn { }); }); } + setupManagementHub() { + return exports.utils.setupManagementHub(); + } setupRedHat() { return new rxjs_1.Observable((observer) => { exports.utils.checkOS() @@ -283,6 +346,13 @@ class Hzn { }); }); } + getIpAddress() { + return new rxjs_1.Observable((observer) => { + let result = exports.utils.getIpAddress(); + console.log(result); + observer.complete(); + }); + } } exports.Hzn = Hzn; //# sourceMappingURL=hzn.js.map \ No newline at end of file diff --git a/build/common/src/hzn.js.map b/build/common/src/hzn.js.map index 203be02..2beb37d 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,+BAAkC;AAClC,+BAA4B;AAC5B,mCAAgC;AAEnB,QAAA,KAAK,GAAG,IAAI,aAAK,EAAE,CAAC;AAEjC,MAAa,GAAG;IAed,YAAY,GAAW,EAAE,UAAkB,EAAE,IAAY,EAAE,UAAkB,EAAE,QAAgB,EAAE,UAAkB,EAAE,UAAkB;QACrI,IAAI,CAAC,MAAM,GAAG,IAAI,SAAG,CAAC,GAAG,EAAE,aAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QACjD,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,IAAI;QACF,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,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;oBACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;oBAC9D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;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AG,EAAE,EAAE;oBACb,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,kBAAkB;QAChB,OAAO,aAAK,CAAC,kBAAkB,EAAE,CAAC;IACpC,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;IACD,YAAY;QACV,OAAO,IAAI,iBAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,IAAI,MAAM,GAAG,aAAK,CAAC,YAAY,EAAE,CAAA;YACjC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YACnB,QAAQ,CAAC,QAAQ,EAAE,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAzWD,kBAyWC"} \ No newline at end of file diff --git a/build/common/src/utils.d.ts b/build/common/src/utils.d.ts index f6c636d..58a39c9 100644 --- a/build/common/src/utils.d.ts +++ b/build/common/src/utils.d.ts @@ -14,10 +14,12 @@ export declare class Utils { listNodePattern(): Observable; getDeviceArch(): Observable; checkOS(): Observable; + getIpAddress(): any[]; aptUpdate(): Observable; installPrereq(): Observable; installHznCli(anax: string, id: null): Observable; uninstallHorizon(): Observable; + setupManagementHub(): Observable; copyFile(arg: string): Promise; updateEnvFiles(org: string): Observable; updateOrgConfig(hznJson: any, org: string, newOrg?: boolean): Observable; diff --git a/build/common/src/utils.js b/build/common/src/utils.js index 5adba3d..e57fef0 100644 --- a/build/common/src/utils.js +++ b/build/common/src/utils.js @@ -8,6 +8,7 @@ const rxjs_1 = require("rxjs"); const cp = require('child_process'), exec = cp.exec; const fs_1 = require("fs"); const os_1 = __importDefault(require("os")); +const ifs = os_1.default.networkInterfaces(); const prompt_1 = __importDefault(require("prompt")); const jsonfile_1 = __importDefault(require("jsonfile")); const env = process.env.npm_config_env || 'biz'; @@ -62,6 +63,12 @@ class Utils { checkOS() { return this.shell(`cat /etc/os-release`); } + getIpAddress() { + return Object.keys(ifs) + .map(x => [x, ifs[x].filter(x => x.family === 'IPv4')[0]]) + .filter(x => x[1]) + .map(x => x[1].address); + } aptUpdate() { // TODO, if failed run sudo apt-get -y --fix-missing full-upgrade // cat info.cfg @@ -88,6 +95,35 @@ class Utils { uninstallHorizon() { return this.shell(`sudo apt purge -y bluehorizon horizon horizon-cli`); } + setupManagementHub() { + return new rxjs_1.Observable((observer) => { + let ips = this.getIpAddress(); + const pEnv = process.env; + const props = [ + { name: 'HZN_LISTEN_IP', default: ips ? ips[0] : '', ipList: ips, required: true }, + { name: 'HZN_TRANSPORT', default: 'https', required: true }, + { name: 'EXCHANGE_USER_ORG', default: 'myorg', required: true } + ]; + console.log(props); + console.log('\nKey in new value or (leave blank) press Enter to keep current value: '); + prompt_1.default.get(props, (err, result) => { + console.log(result); + console.log(`\nWould you like to proceed to install Management Hub: Y/n?`); + prompt_1.default.get({ name: 'answer', required: true }, (err, question) => { + if (question.answer.toUpperCase() === 'Y') { + for (const [key, value] of Object.entries(result)) { + pEnv[key] = value; + } + this.shell(`curl -sSL https://raw.githubusercontent.com/open-horizon/devops/master/mgmt-hub/deploy-mgmt-hub.sh --output deploy-mgmt-hub.sh && chmod +x deploy-mgmt-hub.sh && sudo -s -E -b ./deploy-mgmt-hub.sh`) + .subscribe({ + complete: () => observer.complete(), + error: (err) => observer.error(err) + }); + } + }); + }); + }); + } copyFile(arg) { return (0, rxjs_1.firstValueFrom)(this.shell(arg)); } @@ -98,7 +134,7 @@ class Utils { 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.toUpperCase() === 'Y') { - console.log('\nKey in new value or press Enter to keep current value: '); + console.log('\nKey in new value or (leave blank) 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?`); @@ -133,15 +169,21 @@ class Utils { let props = []; let envVars = hznJson[org]['envVars']; let i = 0; + let pkg = jsonfile_1.default.readFileSync('./package.json'); for (const [key, value] of Object.entries(envVars)) { - props[i] = { name: key, default: value, required: notRequired.indexOf(key) < 0 }; + if (pkg && pkg.version && (key == 'SERVICE_VERSION' || key == 'MMS_SERVICE_VERSION')) { + props[i] = { name: key, default: value, package: pkg.version, required: notRequired.indexOf(key) < 0 }; + } + else { + 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.toUpperCase() === 'Y') { - console.log('\nKey in new value or press Enter to keep current value: '); + console.log('\nKey in new value or (leave blank) 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?`); @@ -157,7 +199,8 @@ class Utils { }); } else { - observer.error(`config files not updated for ${org}`); + console.log(`config files not updated for ${org}`); + observer.complete(); } }); }); @@ -179,7 +222,8 @@ class Utils { }); } else { - observer.error(`config files not updated for ${org}`); + console.log(`config files not updated for ${org}`); + observer.complete(); } } }); @@ -234,7 +278,8 @@ class Utils { }); } else { - observer.error(`config files not updated for ${org}`); + console.log(`config files not updated for ${org}`); + observer.complete(); } }); } @@ -253,7 +298,7 @@ class Utils { return false; } }); - console.log('\nKey in new value or press Enter to keep current value: '); + console.log('\nKey in new value or (leave blank) 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?`); @@ -321,7 +366,7 @@ class Utils { let data = (0, fs_1.readFileSync)(file).toString().split('\n'); Object.values(data).some((el) => { let ar = el.split('='); - if (ar && ar.length > 0 && ar[0] == 'prop') { + if (ar && ar.length > 0 && ar[0] == prop) { value = ar[1]; return true; } @@ -363,7 +408,7 @@ class Utils { 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: '); + console.log('\nKey in new value or (leave blank) press Enter to keep current value: '); prompt_1.default.get(props, (err, result) => { console.log(result); console.log('\nWould you like to update horizon: Y/n?'); diff --git a/build/common/src/utils.js.map b/build/common/src/utils.js.map index 7d43bb6..55a568b 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,2BAAoF;AACpF,4CAAoB;AACpB,oDAA4B;AAC5B,wDAAgC;AAGhC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC;AAChD,MAAM,WAAW,GAAG,CAAC,yBAAyB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEpI,MAAa,KAAK;IAEhB;QADA,cA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AAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtaD,sBAsaC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 133eff7..fc102e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,13 @@ { "name": "hzn-cli", - "version": "0.1.6", + "version": "0.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.1.6", + "name": "hzn-cli", + "version": "0.2.2", + "hasInstallScript": true, "license": "ISC", "dependencies": { "chalk": "^4.1.2", diff --git a/package.json b/package.json index e1b4484..5c5dc52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hzn-cli", - "version": "0.2.1", + "version": "0.2.2", "description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments", "main": "./build/index.js", "bin": { @@ -10,7 +10,8 @@ "start": "nodemon -e ts --watch 'src/**/*.ts' --exec 'npm run build'", "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" + "refresh": "rm -rf ./node_modules ./package-lock.json && npm install", + "postinstall": "bin/install.js" }, "keywords": [ "IEAM", diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index 795c1a5..ffc0a56 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -35,10 +35,10 @@ export const builder: CommandBuilder = (yargs) => type: 'string', demandOption: true, desc: 'Available actions: ' + - 'allInOneMMS, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + - 'listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + + 'allInOneMMS, buildAndPublish, buildMMSImage, buildServiceImage, checkConfigState, createHznKey, dockerImageExists, getDeviceArch, ' + + 'getIpAddress, listDeploymentPolicy, listNode, listNodePattern, listObject, listPattern, listService, publishMMSObject, ' + 'publishMMSPattern, publishMMSService, publishPatterrn, publishService, pullDockerImage, pushMMSImage, pushServiceImage, ' + - 'registerAgent, removeOrg, setup, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' + 'registerAgent, removeOrg, setup, setupManagementHub, showHznInfo, test, uninstallHorizon, unregisterAgent, updateHznInfo' }); export const handler = (argv: Arguments): void => { @@ -56,10 +56,11 @@ export const handler = (argv: Arguments): void => { const obj = object || ''; const p = pattern || ''; const configPath = config_path || utils.getHznConfig(); - const skipInitialize = ['buildMMSImage', 'buildServiceImage', 'dockerImageExists', 'uninstallHorizon']; + const skipInitialize = ['buildMMSImage', 'buildServiceImage', 'dockerImageExists']; const justRun = ['checkConfigState', 'createHznKey', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'showHznInfo', 'uninstallHorizon', 'updateHznInfo']; - const promptForUpdate = ['setup', 'test', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] - + const promptForUpdate = ['setup', 'test', 'buildAndPublish', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] + const runDirectly = ['setupManagementHub', 'uninstallHorizon']; + if(env.length == 0) { let value = utils.getPropValueFromFile(`${utils.getHznConfig()}/.env-local`, 'DEFAULT_ORG') env = value.length > 0 ? value : 'biz' @@ -94,7 +95,16 @@ export const handler = (argv: Arguments): void => { utils.checkDefaultConfig() .subscribe({ complete: () => { - if(skipInitialize.indexOf(action) >= 0) { + if(runDirectly.indexOf(action) >= 0) { + utils[action]() + .subscribe({ + complete: () => process.exit(0), + error: (err) => { + console.log(err); + process.exit(0); + } + }) + } else if(skipInitialize.indexOf(action) >= 0) { proceed(); } else if(justRun.indexOf(action) >= 0) { utils.orgCheck(env, true) diff --git a/src/common/src/hzn.ts b/src/common/src/hzn.ts index e7d5126..5773945 100644 --- a/src/common/src/hzn.ts +++ b/src/common/src/hzn.ts @@ -158,6 +158,66 @@ export class Hzn { 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'); } + buildAndPublish() { + return new Observable((observer) => { + this.buildServiceImage().subscribe({ + complete: () => { + this.pushServiceImage().subscribe({ + complete: () => { + this.buildMMSImage().subscribe({ + complete: () => { + this.pushMMSImage().subscribe({ + complete: () => { + this.publishService().subscribe({ + complete: () => { + this.publishPattern().subscribe({ + complete: () => { + this.publishMMSService().subscribe({ + complete: () => { + this.publishMMSPattern().subscribe({ + complete: () => { + this.registerAgent().subscribe({ + complete: () => { + observer.next(); + observer.complete(); + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }, error: (err) => { + observer.error(err); + } + }) + }); + } allInOneMMS() { return new Observable((observer) => { this.unregisterAgent().subscribe({ @@ -274,6 +334,9 @@ export class Hzn { }) }); } + setupManagementHub() { + return utils.setupManagementHub(); + } setupRedHat() { return new Observable((observer) => { utils.checkOS() @@ -295,4 +358,11 @@ export class Hzn { }) }) } + getIpAddress() { + return new Observable((observer) => { + let result = utils.getIpAddress() + console.log(result) + observer.complete() + }) + } } \ No newline at end of file diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index db7f3e8..de32acd 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -3,6 +3,7 @@ const cp = require('child_process'), exec = cp.exec; import { readFileSync, writeFileSync, copyFileSync , existsSync, exists } from 'fs'; import os from 'os'; +const ifs: any = os.networkInterfaces(); import prompt from 'prompt'; import jsonfile from 'jsonfile'; @@ -58,6 +59,12 @@ export class Utils { checkOS() { return this.shell(`cat /etc/os-release`); } + getIpAddress() { + return Object.keys(ifs) + .map(x => [x, ifs[x].filter(x => x.family === 'IPv4')[0]]) + .filter(x => x[1]) + .map(x => x[1].address); + } aptUpdate() { // TODO, if failed run sudo apt-get -y --fix-missing full-upgrade // cat info.cfg @@ -83,17 +90,49 @@ export class Utils { uninstallHorizon() { return this.shell(`sudo apt purge -y bluehorizon horizon horizon-cli`); } + setupManagementHub() { + return new Observable((observer) => { + let ips = this.getIpAddress() + const pEnv: any = process.env; + const props = [ + {name: 'HZN_LISTEN_IP', default: ips ? ips[0]: '', ipList: ips, required: true}, + {name: 'HZN_TRANSPORT', default: 'https', required: true}, + {name: 'EXCHANGE_USER_ORG', default: 'myorg', required: true} + ] + console.log(props) + console.log('\nKey in new value or (leave blank) press Enter to keep current value: ') + prompt.get(props, (err: any, result: any) => { + console.log(result) + console.log(`\nWould you like to proceed to install Management Hub: Y/n?`) + prompt.get({name: 'answer', required: true}, (err: any, question: any) => { + if(question.answer.toUpperCase() === 'Y') { + for(const [key, value] of Object.entries(result)) { + pEnv[key] = value; + } + this.shell(`curl -sSL https://raw.githubusercontent.com/open-horizon/devops/master/mgmt-hub/deploy-mgmt-hub.sh --output deploy-mgmt-hub.sh && chmod +x deploy-mgmt-hub.sh && sudo -s -E -b ./deploy-mgmt-hub.sh`) + .subscribe({ + next: (res: any) => { + writeFileSync(`${this.hznConfig}/.secret`, res) + }, + complete: () => observer.complete(), + error: (err) => observer.error(err) + }) + } + }) + }) + }) + } copyFile(arg: string) { return firstValueFrom(this.shell(arg)); } updateEnvFiles(org: string) { - return new Observable((observer) => { + return new Observable((observer) => { 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) => { if(question.answer.toUpperCase() === 'Y') { - console.log('\nKey in new value or press Enter to keep current value: ') + console.log('\nKey in new value or (leave blank) 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?`) @@ -127,15 +166,21 @@ export class Utils { let props: any[] = []; let envVars = hznJson[org]['envVars']; let i = 0; + let pkg = jsonfile.readFileSync('./package.json'); + for(const [key, value] of Object.entries(envVars)) { - props[i] = {name: key, default: value, required: notRequired.indexOf(key) < 0}; + if(pkg && pkg.version && (key == 'SERVICE_VERSION' || key == 'MMS_SERVICE_VERSION')) { + props[i] = {name: key, default: value, package: pkg.version, required: notRequired.indexOf(key) < 0}; + } else { + 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.toUpperCase() === 'Y') { - console.log('\nKey in new value or press Enter to keep current value: ') + console.log('\nKey in new value or (leave blank) 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?`) @@ -241,7 +286,7 @@ export class Utils { return false; } }) - console.log('\nKey in new value or press Enter to keep current value: ') + console.log('\nKey in new value or (leave blank) 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?`) @@ -346,7 +391,7 @@ export class Utils { updateHznInfo() { return new Observable((observer) => { let props = this.getPropsFromFile('/etc/default/horizon'); - console.log('\nKey in new value or press Enter to keep current value: ') + console.log('\nKey in new value or (leave blank) press Enter to keep current value: ') prompt.get(props, (err: any, result: any) => { console.log(result)