sojs-script
Advanced tools
| require('sojs'); | ||
| require('sojs-utility'); | ||
| sojs.define({ | ||
| deps: { | ||
| ssh: 'sos.business.system.linux.ssh', | ||
| os: 'sos.business.system.linux.os', | ||
| docker: 'sos.business.system.linux.docker', | ||
| }, | ||
| $systemSetup: function () { | ||
| sojs.promise.resolve(7) | ||
| .then(this.ssh.setPort) | ||
| .then(this.os.getReleaseVersion) | ||
| .then(this.os.setRepo) | ||
| .then(this.docker.install) | ||
| .then(this.docker.setup) | ||
| .then(this.docker.start) | ||
| .then(this.success.proxy(this)) | ||
| .catch(function (err) { | ||
| console.log(err); | ||
| }); | ||
| }, | ||
| success: function (input) { | ||
| console.log('\x1b[36m [finished] \x1b[0m'); | ||
| return true; | ||
| } | ||
| }); |
+1
-1
| { | ||
| "name": "sojs-script", | ||
| "version": "0.0.1", | ||
| "version": "0.0.3", | ||
| "description": "use node script for setupping the system", | ||
@@ -5,0 +5,0 @@ "homepage": "https://coding.net/u/zhangziqiu/p/sojs-script/git", |
+21
-0
| #sojs-script | ||
| ##systemSetup命令 | ||
| 自动执行以下操作(注: 只支持centos): | ||
| * 修改ssh端口号 | ||
| * 根据操作系统版本号, 自动设置并更新repo源为阿里云的源 | ||
| * 安装docker | ||
| * 设置docker加速器为阿里云加速器 | ||
| * 设置docker开机启动 | ||
| * 启动docker服务 | ||
| 配置文件地址: | ||
| ```js | ||
| src/sos/common/config.js | ||
| ``` | ||
| 执行如下命令即可: | ||
| ```js | ||
| node ./bin/systemSetup | ||
| ``` |
@@ -22,3 +22,3 @@ sojs.define({ | ||
| console.log('change ssh port to: ' + portNum); | ||
| source = source.replace(/Port \d+/gi, 'Port ' + portNum); | ||
| source = source.replace(/#?Port \d+/gi, 'Port ' + portNum); | ||
| this.fs.writeFileSync(configFilePath, source); | ||
@@ -25,0 +25,0 @@ } |
| require('sojs'); | ||
| require('sojs-utility'); | ||
| sojs.define({ | ||
| deps: { | ||
| ssh: 'sos.business.system.linux.ssh', | ||
| os: 'sos.business.system.linux.os', | ||
| docker: 'sos.business.system.linux.docker', | ||
| }, | ||
| $init: function () { | ||
| sojs.promise.resolve(7) | ||
| .then(this.ssh.setPort) | ||
| .then(this.os.getReleaseVersion) | ||
| .then(this.os.setRepo) | ||
| .then(this.docker.install) | ||
| .then(this.docker.setup) | ||
| .then(this.docker.start) | ||
| .then(this.success.proxy(this)) | ||
| .catch(function (err) { | ||
| console.log(err); | ||
| }); | ||
| }, | ||
| success: function (input) { | ||
| console.log('\x1b[36m [finished] \x1b[0m'); | ||
| return true; | ||
| } | ||
| }); |
9041
4.92%23
1050%