fix(core): update
This commit is contained in:
parent
82f3b4bd7d
commit
e5b75014af
54
package-lock.json
generated
54
package-lock.json
generated
@ -619,9 +619,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.19.0",
|
"version": "2.20.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/commander/-/commander-2.19.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.0.tgz",
|
||||||
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
|
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
@ -1071,6 +1071,11 @@
|
|||||||
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
|
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node-forge": {
|
||||||
|
"version": "0.7.5",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/node-forge/-/node-forge-0.7.5.tgz",
|
||||||
|
"integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ=="
|
||||||
|
},
|
||||||
"normalize-newline": {
|
"normalize-newline": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-newline/-/normalize-newline-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-newline/-/normalize-newline-3.0.0.tgz",
|
||||||
@ -1254,9 +1259,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.9.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.10.0.tgz",
|
||||||
"integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==",
|
"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-parse": "^1.0.6"
|
"path-parse": "^1.0.6"
|
||||||
@ -1275,6 +1280,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
},
|
},
|
||||||
|
"selfsigned": {
|
||||||
|
"version": "1.10.4",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/selfsigned/-/selfsigned-1.10.4.tgz",
|
||||||
|
"integrity": "sha512-9AukTiDmHXGXWtWjembZ5NDmVvP2695EtpgbCsxCa68w3c88B+alqbmZ4O3hZ4VWGXeGWzEVdvqgAJD8DQPCDw==",
|
||||||
|
"requires": {
|
||||||
|
"node-forge": "0.7.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "5.6.0",
|
"version": "5.6.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/semver/-/semver-5.6.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/semver/-/semver-5.6.0.tgz",
|
||||||
@ -1447,9 +1460,9 @@
|
|||||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||||
},
|
},
|
||||||
"tslint": {
|
"tslint": {
|
||||||
"version": "5.12.1",
|
"version": "5.15.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.12.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.15.0.tgz",
|
||||||
"integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==",
|
"integrity": "sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-code-frame": "^6.22.0",
|
"babel-code-frame": "^6.22.0",
|
||||||
@ -1458,18 +1471,31 @@
|
|||||||
"commander": "^2.12.1",
|
"commander": "^2.12.1",
|
||||||
"diff": "^3.2.0",
|
"diff": "^3.2.0",
|
||||||
"glob": "^7.1.1",
|
"glob": "^7.1.1",
|
||||||
"js-yaml": "^3.7.0",
|
"js-yaml": "^3.13.0",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
"resolve": "^1.3.2",
|
"resolve": "^1.3.2",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
"tslib": "^1.8.0",
|
"tslib": "^1.8.0",
|
||||||
"tsutils": "^2.27.2"
|
"tsutils": "^2.29.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.13.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||||
|
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"argparse": "^1.0.7",
|
||||||
|
"esprima": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tslint-config-prettier": {
|
"tslint-config-prettier": {
|
||||||
"version": "1.17.0",
|
"version": "1.18.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/tslint-config-prettier/-/tslint-config-prettier-1.17.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz",
|
||||||
"integrity": "sha512-NKWNkThwqE4Snn4Cm6SZB7lV5RMDDFsBwz6fWUkTxOKGjMx8ycOHnjIbhn7dZd5XmssW3CwqUjlANR6EhP9YQw==",
|
"integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tsutils": {
|
"tsutils": {
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"@pushrocks/smartshell": "^2.0.13",
|
"@pushrocks/smartshell": "^2.0.13",
|
||||||
"@pushrocks/smartstring": "^3.0.8",
|
"@pushrocks/smartstring": "^3.0.8",
|
||||||
"@pushrocks/smartunique": "^3.0.1"
|
"@pushrocks/smartunique": "^3.0.1",
|
||||||
|
"selfsigned": "^1.10.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.4",
|
"@gitzone/tsbuild": "^2.1.4",
|
||||||
@ -38,7 +39,7 @@
|
|||||||
"@gitzone/tstest": "^1.0.18",
|
"@gitzone/tstest": "^1.0.18",
|
||||||
"@pushrocks/qenv": "^4.0.0",
|
"@pushrocks/qenv": "^4.0.0",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"tslint": "^5.12.1",
|
"tslint": "^5.15.0",
|
||||||
"tslint-config-prettier": "^1.17.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ let testNginxZone01: smartnginx.NginxHost;
|
|||||||
let testNginxZone02: smartnginx.NginxHost;
|
let testNginxZone02: smartnginx.NginxHost;
|
||||||
|
|
||||||
tap.test('should create a valid instance of SmartNginx', async () => {
|
tap.test('should create a valid instance of SmartNginx', async () => {
|
||||||
testSmartNginx = new smartnginx.SmartNginx({});
|
testSmartNginx = new smartnginx.SmartNginx({defaultProxyUrl: 'https://git.zone'});
|
||||||
expect(testSmartNginx).to.be.instanceof(smartnginx.SmartNginx);
|
expect(testSmartNginx).to.be.instanceof(smartnginx.SmartNginx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,10 +5,16 @@ import { NginxHost } from './smartnginx.classes.nginxhost';
|
|||||||
import { NginxProcess } from './smartnginx.classes.nginxprocess';
|
import { NginxProcess } from './smartnginx.classes.nginxprocess';
|
||||||
import { IHostConfig } from './interfaces/hostconfig';
|
import { IHostConfig } from './interfaces/hostconfig';
|
||||||
|
|
||||||
|
export interface ISmartNginxContructorOptions {
|
||||||
|
logger?: plugins.smartlog.Smartlog;
|
||||||
|
defaultProxyUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main class that manages a NginxInstance
|
* main class that manages a NginxInstance
|
||||||
*/
|
*/
|
||||||
export class SmartNginx {
|
export class SmartNginx {
|
||||||
|
public options: ISmartNginxContructorOptions;
|
||||||
public logger: plugins.smartlog.Smartlog;
|
public logger: plugins.smartlog.Smartlog;
|
||||||
|
|
||||||
// the objectmaps
|
// the objectmaps
|
||||||
@ -16,9 +22,10 @@ export class SmartNginx {
|
|||||||
private hostCandidates = new plugins.lik.Objectmap<NginxHost>();
|
private hostCandidates = new plugins.lik.Objectmap<NginxHost>();
|
||||||
|
|
||||||
public nginxProcess: NginxProcess = new NginxProcess(this);
|
public nginxProcess: NginxProcess = new NginxProcess(this);
|
||||||
constructor(optionsArg: { logger?: plugins.smartlog.Smartlog }) {
|
constructor(optionsArg: ISmartNginxContructorOptions) {
|
||||||
optionsArg.logger
|
this.options = optionsArg;
|
||||||
? (this.logger = optionsArg.logger)
|
this.options.logger
|
||||||
|
? (this.logger = this.options.logger)
|
||||||
: (this.logger = plugins.smartlog.defaultLogger);
|
: (this.logger = plugins.smartlog.defaultLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +115,12 @@ export class SmartNginx {
|
|||||||
|
|
||||||
// write base config
|
// write base config
|
||||||
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigDirPath);
|
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigDirPath);
|
||||||
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(), paths.nginxConfFile);
|
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(this.options.defaultProxyUrl), paths.nginxConfFile);
|
||||||
|
|
||||||
|
// write standard self signed certificate
|
||||||
|
const selfsignedCert = plugins.selfsigned.generate([{ name: 'commonName', value: 'selfsigned.git.zone' }], { days: 365});
|
||||||
|
plugins.smartfile.memory.toFsSync(selfsignedCert.private, plugins.path.join(paths.nginxConfigDirPath, './default.private.pem'));
|
||||||
|
plugins.smartfile.memory.toFsSync(selfsignedCert.public, plugins.path.join(paths.nginxConfigDirPath, './default.public.pem'));
|
||||||
|
|
||||||
// deploy hosts
|
// deploy hosts
|
||||||
plugins.smartfile.fs.ensureEmptyDirSync(paths.nginxHostDirPath);
|
plugins.smartfile.fs.ensureEmptyDirSync(paths.nginxHostDirPath);
|
||||||
|
@ -13,3 +13,10 @@ import * as smartstring from '@pushrocks/smartstring';
|
|||||||
import * as smartunique from '@pushrocks/smartunique';
|
import * as smartunique from '@pushrocks/smartunique';
|
||||||
|
|
||||||
export { lik, smartlog, smartpromise, smartshell, smartfile, smartstring, smartunique };
|
export { lik, smartlog, smartpromise, smartshell, smartfile, smartstring, smartunique };
|
||||||
|
|
||||||
|
// thirdparty scope
|
||||||
|
import * as selfsigned from 'selfsigned';
|
||||||
|
|
||||||
|
export {
|
||||||
|
selfsigned
|
||||||
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './smartnginx.plugins';
|
import * as plugins from './smartnginx.plugins';
|
||||||
import * as paths from './smartnginx.paths';
|
import * as paths from './smartnginx.paths';
|
||||||
export let getBaseConfigString = () => {
|
export let getBaseConfigString = (defaultProxy: string) => {
|
||||||
const baseConfig = plugins.smartstring.indent.normalize(`
|
const baseConfig = plugins.smartstring.indent.normalize(`
|
||||||
user www-data;
|
user www-data;
|
||||||
worker_processes auto;
|
worker_processes auto;
|
||||||
@ -63,6 +63,31 @@ export let getBaseConfigString = () => {
|
|||||||
# Virtual Host Configs
|
# Virtual Host Configs
|
||||||
##
|
##
|
||||||
|
|
||||||
|
server {
|
||||||
|
# The keepalive parameter sets the maximum number of idle keepalive connections
|
||||||
|
# to upstream servers that are preserved in the cache of each worker process. When
|
||||||
|
# this number is exceeded, the least recently used connections are closed.
|
||||||
|
listen *:80 default_server;
|
||||||
|
rewrite ^ ${defaultProxy} permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen *:443 ssl default_server;
|
||||||
|
ssl_certificate ${paths.nginxHostDirPath}/default.public.pem;
|
||||||
|
ssl_certificate_key ${paths.nginxHostDirPath}/default.private.pem;
|
||||||
|
location / {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_next_upstream error timeout http_404 http_429 http_500 http_502;
|
||||||
|
proxy_next_upstream_tries 5;
|
||||||
|
proxy_pass ${defaultProxy};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include ${paths.nginxHostDirPath}/*.conf;
|
include ${paths.nginxHostDirPath}/*.conf;
|
||||||
include /etc/nginx/sites-enabled/*;
|
include /etc/nginx/sites-enabled/*;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user