Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
67dd650dce | |||
92eaf5f19a | |||
fcf9a61b1d | |||
fbd258a876 | |||
c65b8fc1af | |||
b7b588d713 | |||
00d672c135 | |||
6a1e778b49 | |||
4cfb26f62f | |||
7ba3ad0b21 | |||
cd93ec2560 | |||
ede884930e | |||
1049920efd | |||
b7a34403c5 | |||
987e19372a | |||
0b97aaee91 | |||
b87ca1fa03 | |||
824f872fa5 | |||
80248c77d0 | |||
f592150646 | |||
f24652936a | |||
79af6c4a68 | |||
fafc757930 | |||
ead5e1a7bd | |||
ad57be180a | |||
7cc4ce02c9 | |||
70dace595b | |||
9b043d0e0d | |||
381227406b | |||
08d1c292c3 | |||
64b0a2deb7 | |||
9b661c0ee5 | |||
8ca91a48e8 | |||
39a5683b9e | |||
7967334e7d | |||
5a875d1e22 | |||
a533fa5de1 |
@ -1,4 +1,4 @@
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
stages:
|
||||
- test
|
||||
@ -10,17 +10,20 @@ before_script:
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test stable
|
||||
- npmci npm install
|
||||
- npmci npm test stable
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
environment: npmjs-com_registry
|
||||
script:
|
||||
- npmci publish
|
||||
- npmci npm prepare
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Lossless GmbH
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
25
README.md
25
README.md
@ -1,27 +1,30 @@
|
||||
# smartnginx
|
||||
|
||||
control nginx from node, TypeScript ready
|
||||
|
||||
## Status
|
||||
|
||||
[](https://gitlab.com/pushrocks/smartnginx/commits/master)
|
||||
|
||||
## Features
|
||||
|
||||
* easy reverse configuration
|
||||
* automatic letsencrypt DNS01 challenge based ssl cert generation
|
||||
* automatic nginx process handling zero-downtime config reloading
|
||||
* works in Docker environements
|
||||
- easy reverse configuration
|
||||
- automatic letsencrypt DNS01 challenge based ssl cert generation
|
||||
- automatic nginx process handling zero-downtime config reloading
|
||||
- works in Docker environements
|
||||
|
||||
## Usage
|
||||
|
||||
We recommend the use of TypeScript! :)
|
||||
|
||||
```typescript
|
||||
import * as smartnginx from "smartnginx";
|
||||
myNginxConfig = new smartnginx.NginxConfig();
|
||||
myNginxZone = new smartnginx.NginxZone({
|
||||
zoneName:"some.example.com",
|
||||
type:"reverseProxy",
|
||||
destination:"192.192.192.192" // some destination IP
|
||||
import * as smartnginx from 'smartnginx';
|
||||
const smartnginxInstance = new smartnginx.SmartNginx();
|
||||
myNginxHost = new smartnginx.NginxHost({
|
||||
hostName: 'some.example.com',
|
||||
type: 'reverseProxy',
|
||||
destination: '192.192.192.192' // some destination IP
|
||||
});
|
||||
myNginxConfig.addZone(myNginxZone); // adds the zone to the config
|
||||
myNginxConfig.deploy(); // deploys the referenced NginxConfig and gracefully reloads it
|
||||
```
|
||||
```
|
||||
|
9
dist/smartnginx.snippets.js
vendored
9
dist/smartnginx.snippets.js
vendored
@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
const plugins = require("./smartnginx.plugins");
|
||||
const paths = require("./smartnginx.paths");
|
||||
exports.getBaseConfigString = () => {
|
||||
let baseConfig = plugins.smartstring.indent.normalize(`
|
||||
user www-data;
|
||||
@ -63,7 +64,7 @@ exports.getBaseConfigString = () => {
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include ${paths.nginxHostFileBase}/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
daemon off;
|
||||
@ -85,8 +86,8 @@ exports.getHostConfigString = (hostNameArg, destinationIpArg) => {
|
||||
server {
|
||||
listen *:443 ssl;
|
||||
server_name ${hostNameArg};
|
||||
ssl_certificate /LE_CERTS/${hostNameArg}/fullchain.pem;
|
||||
ssl_certificate_key /LE_CERTS/${hostNameArg}/privkey.pem;
|
||||
ssl_certificate ${paths.nginxCertBase}/${hostNameArg}/fullchain.pem;
|
||||
ssl_certificate_key ${paths.nginxCertBase}/${hostNameArg}/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://${hostNameArg};
|
||||
@ -99,4 +100,4 @@ exports.getHostConfigString = (hostNameArg, destinationIpArg) => {
|
||||
`);
|
||||
return hostConfig;
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5zbmlwcGV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbnguc25pcHBldHMudHM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FBRztJQUNoQyxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O2FBOEQxQyxLQUFLLENBQUMsaUJBQWlCOzs7O0VBSWxDLENBQUMsQ0FBQztJQUNILE1BQU0sQ0FBQyxVQUFVLENBQUM7QUFDbkIsQ0FBQyxDQUFBO0FBR1UsMkJBQW1CLEdBQUcsQ0FBQyxXQUFrQixFQUFDLGdCQUF1QjtJQUMzRSxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUM7YUFDMUMsV0FBVztZQUNaLGdCQUFnQjs7Ozs7aUJBS1gsV0FBVzs4QkFDRSxXQUFXOzs7OztpQkFLeEIsV0FBVztxQkFDUCxLQUFLLENBQUMsYUFBYSxJQUFJLFdBQVc7eUJBQzlCLEtBQUssQ0FBQyxhQUFhLElBQUksV0FBVzs7O3dCQUduQyxXQUFXOzs7Ozs7O0VBT2pDLENBQUMsQ0FBQztJQUNILE1BQU0sQ0FBQyxVQUFVLENBQUM7QUFDbkIsQ0FBQyxDQUFDIn0=
|
8
npmextra.json
Normal file
8
npmextra.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"npmdocker": {
|
||||
|
||||
}
|
||||
}
|
1603
package-lock.json
generated
Normal file
1603
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "smartnginx",
|
||||
"version": "1.0.2",
|
||||
"name": "@pushrocks/smartnginx",
|
||||
"version": "2.0.13",
|
||||
"private": false,
|
||||
"description": "control nginx from node, TypeScript ready",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(npmts)",
|
||||
"cleanTest": "(rm -r nginxconfig)"
|
||||
"test": "tstest test/",
|
||||
"cleanTest": "(rm -r nginxconfig) && npm run test",
|
||||
"build": "(tsbuild)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -22,19 +24,20 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/smartnginx#README",
|
||||
"dependencies": {
|
||||
"@types/q": "^0.0.27",
|
||||
"@types/shelljs": "^0.3.27",
|
||||
"beautylog": "^5.0.18",
|
||||
"cert": "1.0.6",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.7.1",
|
||||
"smartfile": "^4.0.12",
|
||||
"smartstring": "^2.0.15"
|
||||
"@pushrocks/lik": "^3.0.4",
|
||||
"@pushrocks/smartfile": "^6.0.11",
|
||||
"@pushrocks/smartlog": "^2.0.9",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@pushrocks/smartshell": "^2.0.13",
|
||||
"@pushrocks/smartstring": "^3.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npmts-g": "^5.2.6",
|
||||
"qenv": "^1.0.8",
|
||||
"should": "^10.0.0",
|
||||
"typings-test": "^1.0.1"
|
||||
"@gitzone/tsbuild": "^2.1.4",
|
||||
"@gitzone/tsrun": "^1.1.17",
|
||||
"@gitzone/tstest": "^1.0.18",
|
||||
"@pushrocks/qenv": "^3.0.2",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"tslint": "^5.12.0",
|
||||
"tslint-config-prettier": "^1.17.0"
|
||||
}
|
||||
}
|
||||
|
2
test/test.d.ts
vendored
2
test/test.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
import "typings-test";
|
||||
import "should";
|
61
test/test.js
61
test/test.js
@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
const path = require("path");
|
||||
require("should");
|
||||
const qenv_1 = require("qenv");
|
||||
const smartnginx = require("../dist/index");
|
||||
// setup environment
|
||||
let testQenv = new qenv_1.Qenv(process.cwd(), path.join(process.cwd(), ".nogit"));
|
||||
describe("smartnginx", function () {
|
||||
let testNginxConfig;
|
||||
let testNginxZone01;
|
||||
let testNginxZone02;
|
||||
describe("NginxZone", function () {
|
||||
it(`"new NginxZone()" should produce an instance of NginxConfig`, function () {
|
||||
testNginxZone01 = new smartnginx.NginxHost({
|
||||
hostName: "test100.bleu.de",
|
||||
type: smartnginx.hostTypes.reverseProxy,
|
||||
destination: "192.192.192.191"
|
||||
});
|
||||
testNginxZone02 = new smartnginx.NginxHost({
|
||||
hostName: "test102.bleu.de",
|
||||
type: smartnginx.hostTypes.reverseProxy,
|
||||
destination: "192.192.192.192"
|
||||
});
|
||||
testNginxZone01.should.be.instanceof(smartnginx.NginxHost);
|
||||
console.log(testNginxZone01.configString);
|
||||
});
|
||||
});
|
||||
describe("NginxConfig", function () {
|
||||
this.timeout(10000);
|
||||
it(`"new NginxConfig()" should produce an instance of NginxConfig`, function () {
|
||||
testNginxConfig = new smartnginx.NginxConfig({
|
||||
cfEmail: process.env.CF_EMAIL,
|
||||
cfKey: process.env.CF_KEY,
|
||||
testMode: true
|
||||
});
|
||||
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
|
||||
});
|
||||
describe(".addZone()", function () {
|
||||
it("should add a zone to NginxConfig Object", function () {
|
||||
testNginxConfig.addHost(testNginxZone01);
|
||||
testNginxConfig.addHost(testNginxZone02);
|
||||
});
|
||||
});
|
||||
describe(".deploy()", function () {
|
||||
this.timeout(600000);
|
||||
it("should deploy a config from an instance", function (done) {
|
||||
testNginxConfig.deploy()
|
||||
.then(() => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe(".stop", function () {
|
||||
it("should end the process", function () {
|
||||
testNginxConfig.nginxProcess.stop();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json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UFBTSxDQUFDLENBQUM7WUFDckIsRUFBRSxDQUFDLHlDQUF5QyxFQUFDLFVBQVMsSUFBSTtnQkFDdEQsZUFBZSxDQUFDLE1BQU0sRUFBRTtxQkFDbkIsSUFBSSxDQUFDO29CQUNGLElBQUksRUFBRSxDQUFDO2dCQUNYLENBQUMsQ0FBQyxDQUFDO1lBQ1gsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQztRQUNILFFBQVEsQ0FBQyxPQUFPLEVBQUM7WUFDYixFQUFFLENBQUMsd0JBQXdCLEVBQUM7Z0JBQ3hCLGVBQWUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLENBQUM7WUFDeEMsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFDO0FBQ1AsQ0FBQyxDQUFDLENBQUMifQ==
|
103
test/test.ts
103
test/test.ts
@ -1,60 +1,47 @@
|
||||
import "typings-test";
|
||||
import path = require("path");
|
||||
import "should";
|
||||
import {Qenv} from "qenv";
|
||||
import * as smartnginx from "../dist/index";
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import path = require('path');
|
||||
|
||||
// setup environment
|
||||
let testQenv = new Qenv(process.cwd(),path.join(process.cwd(),".nogit"));
|
||||
describe("smartnginx",function(){
|
||||
let testNginxConfig:smartnginx.NginxConfig;
|
||||
let testNginxZone01:smartnginx.NginxHost;
|
||||
let testNginxZone02:smartnginx.NginxHost;
|
||||
describe("NginxZone",function(){
|
||||
it(`"new NginxZone()" should produce an instance of NginxConfig`,function(){
|
||||
testNginxZone01 = new smartnginx.NginxHost({
|
||||
hostName:"test100.bleu.de",
|
||||
type:smartnginx.hostTypes.reverseProxy,
|
||||
destination:"192.192.192.191"
|
||||
});
|
||||
testNginxZone02 = new smartnginx.NginxHost({
|
||||
hostName:"test102.bleu.de",
|
||||
type:smartnginx.hostTypes.reverseProxy,
|
||||
destination:"192.192.192.192"
|
||||
});
|
||||
testNginxZone01.should.be.instanceof(smartnginx.NginxHost);
|
||||
console.log(testNginxZone01.configString);
|
||||
});
|
||||
});
|
||||
describe("NginxConfig",function(){
|
||||
this.timeout(10000);
|
||||
it(`"new NginxConfig()" should produce an instance of NginxConfig`,function(){
|
||||
testNginxConfig = new smartnginx.NginxConfig({
|
||||
cfEmail: process.env.CF_EMAIL,
|
||||
cfKey: process.env.CF_KEY,
|
||||
testMode:true
|
||||
});
|
||||
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
|
||||
});
|
||||
describe(".addZone()",function(){
|
||||
it("should add a zone to NginxConfig Object",function(){
|
||||
testNginxConfig.addHost(testNginxZone01);
|
||||
testNginxConfig.addHost(testNginxZone02);
|
||||
})
|
||||
});
|
||||
describe(".deploy()",function(){
|
||||
this.timeout(600000);
|
||||
it("should deploy a config from an instance",function(done){
|
||||
testNginxConfig.deploy()
|
||||
.then(() => {
|
||||
done();
|
||||
});
|
||||
})
|
||||
});
|
||||
describe(".stop",function(){
|
||||
it("should end the process",function(){
|
||||
testNginxConfig.nginxProcess.stop();
|
||||
})
|
||||
})
|
||||
});
|
||||
import { Qenv } from '@pushrocks/qenv';
|
||||
const testQenv = new Qenv('./', './.nogit/');
|
||||
|
||||
import * as smartnginx from '../ts/index';
|
||||
|
||||
let testSmartNginx: smartnginx.SmartNginx;
|
||||
let testNginxZone01: smartnginx.NginxHost;
|
||||
let testNginxZone02: smartnginx.NginxHost;
|
||||
|
||||
tap.test('should create a valid instance of SmartNginx', async () => {
|
||||
testSmartNginx = new smartnginx.SmartNginx({});
|
||||
expect(testSmartNginx).to.be.instanceof(smartnginx.SmartNginx);
|
||||
});
|
||||
|
||||
tap.test(`should produce an instance of NginxConfig`, async () => {
|
||||
testNginxZone01 = new smartnginx.NginxHost(testSmartNginx, {
|
||||
hostName: 'test100.bleu.de',
|
||||
destination: '192.192.192.191',
|
||||
privateKey: 'some private',
|
||||
publicKey: 'some public'
|
||||
});
|
||||
testNginxZone02 = new smartnginx.NginxHost(testSmartNginx, {
|
||||
hostName: 'test102.bleu.de',
|
||||
destination: '192.192.192.192',
|
||||
privateKey: 'some private',
|
||||
publicKey: 'some public'
|
||||
});
|
||||
expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost);
|
||||
});
|
||||
|
||||
tap.test('.addZone() should add a zone to NginxConfig Object', async () => {
|
||||
testSmartNginx.addHost(testNginxZone01);
|
||||
testSmartNginx.addHost(testNginxZone02);
|
||||
});
|
||||
|
||||
tap.test('.deploy() should deploy a config from an instance', async () => {
|
||||
await testSmartNginx.deploy();
|
||||
});
|
||||
|
||||
tap.test('.stop() should end the process', async () => {
|
||||
testSmartNginx.nginxProcess.stop();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from "./smartnginx.plugins";
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
|
||||
// classes
|
||||
export * from "./smartnginx.classes.nginxconfig";
|
||||
export * from "./smartnginx.classes.nginxprocess";
|
||||
export * from "./smartnginx.classes.nginxhost";
|
||||
export * from './smartnginx.classes.smartnginx';
|
||||
export * from './smartnginx.classes.nginxprocess';
|
||||
export * from './smartnginx.classes.nginxhost';
|
||||
|
6
ts/interfaces/hostconfig.ts
Normal file
6
ts/interfaces/hostconfig.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface IHostConfig {
|
||||
hostName: string;
|
||||
destination: string;
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
}
|
0
ts/interfaces/index.ts
Normal file
0
ts/interfaces/index.ts
Normal file
@ -1,71 +0,0 @@
|
||||
import * as plugins from "./smartnginx.plugins";
|
||||
import * as paths from "./smartnginx.paths";
|
||||
import * as snippets from "./smartnginx.snippets";
|
||||
import { NginxHost } from "./smartnginx.classes.nginxhost";
|
||||
import { NginxProcess } from "./smartnginx.classes.nginxprocess";
|
||||
let allConfigs: NginxConfig[] = [];
|
||||
|
||||
/**
|
||||
* main class that manages a NginxInstance
|
||||
*/
|
||||
export class NginxConfig {
|
||||
hosts: NginxHost[] = [];
|
||||
cert: plugins.cert.Cert; // the Cert Instance from which the config gets its certificates
|
||||
nginxProcess: NginxProcess = new NginxProcess(this);
|
||||
isDeployed: boolean = false;
|
||||
constructor(optionsArg: plugins.cert.ICertConstructorOptions) {
|
||||
this.cert = new plugins.cert.Cert({
|
||||
cfEmail: optionsArg.cfEmail,
|
||||
cfKey: optionsArg.cfKey,
|
||||
sslDir: paths.nginxCertBase,
|
||||
gitOriginRepo: optionsArg.gitOriginRepo,
|
||||
testMode: optionsArg.testMode
|
||||
});
|
||||
};
|
||||
|
||||
// interact with Hosts
|
||||
addHost(nginxHostArg: NginxHost){
|
||||
this.hosts.push(nginxHostArg);
|
||||
}
|
||||
listHosts(): NginxHost[]{
|
||||
return this.hosts;
|
||||
};
|
||||
removeHost(nginxHostArg: NginxHost) {
|
||||
|
||||
}
|
||||
clean() {
|
||||
this.hosts = [];
|
||||
}
|
||||
// handle deployment of hosts
|
||||
deploy() {
|
||||
let done = plugins.q.defer();
|
||||
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigBase);
|
||||
plugins.smartfile.fs.ensureDirSync(paths.nginxHostFileBase);
|
||||
plugins.smartfile.fs.ensureDirSync(paths.nginxCertBase);
|
||||
for (let config of allConfigs) {
|
||||
config.isDeployed = false;
|
||||
};
|
||||
this.isDeployed = true;
|
||||
// write base config
|
||||
plugins.smartfile.memory.toFsSync(
|
||||
snippets.getBaseConfigString(),
|
||||
paths.nginxConfFile
|
||||
);
|
||||
// deploy hosts
|
||||
let promiseArray = [];
|
||||
for (let host of this.hosts) {
|
||||
let hostDeployedPromise = host.deploy(this.cert);
|
||||
hostDeployedPromise.then(() => {
|
||||
plugins.beautylog.info(`Host ${host.hostName} deployed!`);
|
||||
this.nginxProcess.reloadConfig();
|
||||
});
|
||||
promiseArray.push(hostDeployedPromise);
|
||||
};
|
||||
plugins.q.all(promiseArray)
|
||||
.then(() => {
|
||||
done.resolve();
|
||||
});
|
||||
|
||||
return done.promise;
|
||||
};
|
||||
};
|
@ -1,43 +1,53 @@
|
||||
import * as plugins from "./smartnginx.plugins";
|
||||
import * as paths from "./smartnginx.paths";
|
||||
import * as snippets from "./smartnginx.snippets"
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import * as snippets from './smartnginx.snippets';
|
||||
|
||||
/**
|
||||
* the host config data that NginxHost needs to create a valid instance
|
||||
*/
|
||||
export interface IHostConfigData {
|
||||
hostName: string,
|
||||
type: hostTypes,
|
||||
destination: string
|
||||
}
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx';
|
||||
|
||||
import { IHostConfig } from './interfaces/hostconfig';
|
||||
|
||||
export enum hostTypes {
|
||||
reverseProxy,
|
||||
static
|
||||
reverseProxy
|
||||
}
|
||||
|
||||
/**
|
||||
* manages a single nginx host
|
||||
*/
|
||||
export class NginxHost {
|
||||
hostName: string; // the host name e.g. domain name
|
||||
type: hostTypes;
|
||||
destination: string;
|
||||
configString: string; // the actual host config file as string
|
||||
constructor(optionsArg:IHostConfigData) {
|
||||
this.hostName = optionsArg.hostName;
|
||||
this.type = optionsArg.type;
|
||||
this.destination = optionsArg.destination;
|
||||
this.configString = snippets.getHostConfigString(optionsArg.hostName, optionsArg.destination);
|
||||
};
|
||||
deploy(certInstanceArg: plugins.cert.Cert) {
|
||||
let done = plugins.q.defer();
|
||||
let filePath = plugins.path.join(paths.nginxHostFileBase, this.hostName + ".conf");
|
||||
// writeConfig
|
||||
plugins.smartfile.memory.toFsSync(this.configString, filePath);
|
||||
// get cert
|
||||
certInstanceArg.getDomainCert(this.hostName)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
||||
};
|
||||
export class NginxHost implements IHostConfig {
|
||||
/**
|
||||
* smartnginxInstance this NginHost belongs to
|
||||
*/
|
||||
smartnginxInstance: SmartNginx;
|
||||
|
||||
hostName: string; // the host name e.g. domain name
|
||||
destination: string;
|
||||
configString: string; // the actual host config file as string
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
|
||||
constructor(smartnginxInstanceArg: SmartNginx, optionsArg: IHostConfig) {
|
||||
this.smartnginxInstance = smartnginxInstanceArg;
|
||||
this.hostName = optionsArg.hostName;
|
||||
this.destination = optionsArg.destination;
|
||||
this.configString = snippets.getHostConfigString(optionsArg.hostName, optionsArg.destination);
|
||||
this.privateKey = optionsArg.privateKey;
|
||||
this.publicKey = optionsArg.publicKey;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param certInstanceArg
|
||||
*/
|
||||
public async deploy() {
|
||||
const filePathConfig = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.conf`);
|
||||
const filePathPrivate = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.private.pem`);
|
||||
const filePathPublic = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.public.pem`);
|
||||
// writeConfig
|
||||
plugins.smartfile.memory.toFsSync(this.configString, filePathConfig);
|
||||
|
||||
// write ssl
|
||||
plugins.smartfile.memory.toFsSync(this.privateKey, filePathPrivate);
|
||||
plugins.smartfile.memory.toFsSync(this.publicKey, filePathPublic);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +1,69 @@
|
||||
import * as plugins from "./smartnginx.plugins";
|
||||
import * as paths from "./smartnginx.paths";
|
||||
import { NginxConfig } from "./smartnginx.classes.nginxconfig";
|
||||
import { NginxHost } from "./smartnginx.classes.nginxhost";
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost';
|
||||
|
||||
import { Smartshell } from '@pushrocks/smartshell';
|
||||
|
||||
import { ChildProcess } from 'child_process';
|
||||
|
||||
/**
|
||||
* manages a nginxprocess for an NginxConfig
|
||||
*/
|
||||
export class NginxProcess {
|
||||
started: boolean = false;
|
||||
nginxConfig:NginxConfig;
|
||||
nginxChildProcess: plugins.childProcess.ChildProcess;
|
||||
constructor(nginxConfigArg) {
|
||||
this.nginxConfig = nginxConfigArg;
|
||||
};
|
||||
public started: boolean = false;
|
||||
public smartNginxRef: SmartNginx;
|
||||
private nginxChildProcess: ChildProcess;
|
||||
private smartshellInstance = new Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
/**
|
||||
* start nginx
|
||||
*/
|
||||
start() {
|
||||
let done = plugins.q.defer();
|
||||
if (typeof this.nginxChildProcess == "undefined"){
|
||||
this.nginxChildProcess = plugins.childProcess.exec(`nginx -c ${paths.nginxConfFile}`, function (error, stdout, stderr) {
|
||||
console.log(`stdout: ${stdout}`);
|
||||
console.log(`stderr: ${stderr}`);
|
||||
if (error !== null) {
|
||||
console.log(`exec error: ${error}`);
|
||||
};
|
||||
});
|
||||
};
|
||||
this.started = true;
|
||||
plugins.beautylog.info("started Nginx!");
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
constructor(nginxRefArg: SmartNginx) {
|
||||
this.smartNginxRef = nginxRefArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* reload config
|
||||
*/
|
||||
reloadConfig(){
|
||||
let done = plugins.q.defer();
|
||||
if(this.started == false){
|
||||
this.start();
|
||||
} else {
|
||||
plugins.shelljs.exec("nginx -s reload");
|
||||
};
|
||||
plugins.beautylog.ok("NginxProcess has loaded the new config!")
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
* start nginx
|
||||
*/
|
||||
public async start() {
|
||||
if (!this.nginxChildProcess) {
|
||||
this.nginxChildProcess = (await this.smartshellInstance.execStreaming(
|
||||
`nginx -c ${paths.nginxConfFile}`
|
||||
)).childProcess;
|
||||
}
|
||||
this.started = true;
|
||||
plugins.smartlog.defaultLogger.log('info', 'started Nginx!');
|
||||
}
|
||||
|
||||
/**
|
||||
* stop the nginx instance
|
||||
*/
|
||||
stop() {
|
||||
let done = plugins.q.defer();
|
||||
if (typeof this.nginxChildProcess != "undefined") {
|
||||
plugins.shelljs.exec("nginx -s quit");
|
||||
this.started = false;
|
||||
plugins.beautylog.info("stopped Nginx!");
|
||||
} else {
|
||||
plugins.beautylog.log("nginx already stopped!");
|
||||
};
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
* reload config
|
||||
*/
|
||||
public async reloadConfig() {
|
||||
if (!this.started) {
|
||||
this.start();
|
||||
} else {
|
||||
await this.smartshellInstance.exec('nginx -s reload');
|
||||
}
|
||||
this.smartNginxRef.logger.log('info', 'NginxProcess has loaded the new config!');
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if nginx is in path
|
||||
*/
|
||||
check(): boolean {
|
||||
return;
|
||||
};
|
||||
/**
|
||||
* stop the nginx instance
|
||||
*/
|
||||
public async stop() {
|
||||
if (this.nginxChildProcess) {
|
||||
this.smartshellInstance.exec('nginx -s quit');
|
||||
this.started = false;
|
||||
this.smartNginxRef.logger.log('info', 'stopped Nginx!');
|
||||
} else {
|
||||
this.smartNginxRef.logger.log('info', 'nginx already stopped!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if nginx is in path
|
||||
*/
|
||||
public check(): boolean {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
82
ts/smartnginx.classes.smartnginx.ts
Normal file
82
ts/smartnginx.classes.smartnginx.ts
Normal file
@ -0,0 +1,82 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import * as snippets from './smartnginx.snippets';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost';
|
||||
import { NginxProcess } from './smartnginx.classes.nginxprocess';
|
||||
import { IHostConfig } from './interfaces/hostconfig';
|
||||
|
||||
/**
|
||||
* main class that manages a NginxInstance
|
||||
*/
|
||||
export class SmartNginx {
|
||||
public logger: plugins.smartlog.Smartlog;
|
||||
private hosts = new plugins.lik.Objectmap<NginxHost>();
|
||||
public nginxProcess: NginxProcess = new NginxProcess(this);
|
||||
constructor(optionsArg: { logger?: plugins.smartlog.Smartlog }) {
|
||||
optionsArg.logger
|
||||
? (this.logger = optionsArg.logger)
|
||||
: (this.logger = plugins.smartlog.defaultLogger);
|
||||
}
|
||||
|
||||
// ===================
|
||||
// interact with Hosts
|
||||
// ===================
|
||||
|
||||
/**
|
||||
* add a host
|
||||
* @param nginxHostArg
|
||||
*/
|
||||
public addHost(optionsArg: IHostConfig): NginxHost {
|
||||
const nginxHost = new NginxHost(this, optionsArg);
|
||||
this.hosts.add(nginxHost);
|
||||
return nginxHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a NginxHost by hostname
|
||||
* @param hostNameArg
|
||||
*/
|
||||
public getNginxHostByHostName(hostNameArg: string): NginxHost {
|
||||
return this.hosts.find(nginxHost => {
|
||||
return nginxHost.hostName === hostNameArg;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* listHosts
|
||||
*/
|
||||
public listHosts(): NginxHost[] {
|
||||
return this.hosts.getArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* remove a Host
|
||||
* @param nginxHostArg
|
||||
*/
|
||||
public removeHost(nginxHostArg: NginxHost) {
|
||||
this.hosts.remove(nginxHostArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* clean all hosts
|
||||
*/
|
||||
public wipeHosts() {
|
||||
this.hosts.wipe();
|
||||
}
|
||||
|
||||
/**
|
||||
* deploy the current stack and restart nginx
|
||||
*/
|
||||
public async deploy() {
|
||||
// write base config
|
||||
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigDirPath);
|
||||
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(), paths.nginxConfFile);
|
||||
|
||||
// deploy hosts
|
||||
plugins.smartfile.fs.ensureEmptyDirSync(paths.nginxHostDirPath);
|
||||
for (const host of this.hosts.getArray()) {
|
||||
await host.deploy();
|
||||
this.logger.log('info', `Host ${host.hostName} deployed!`);
|
||||
}
|
||||
this.nginxProcess.reloadConfig();
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
import * as plugins from "./smartnginx.plugins"
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
|
||||
// directories
|
||||
export let packageBase = plugins.path.join(__dirname,"../");
|
||||
export let nginxConfigBase = plugins.path.join(packageBase,"nginxconfig");
|
||||
export let nginxHostFileBase = plugins.path.join(nginxConfigBase,"hosts");
|
||||
export let nginxCertBase = plugins.path.join(nginxConfigBase,"cert");
|
||||
export const packageBase = plugins.path.join(__dirname, '../');
|
||||
export const nginxConfigDirPath = plugins.path.join(packageBase, 'nginxconfig');
|
||||
export const nginxHostDirPath = plugins.path.join(nginxConfigDirPath, 'hosts');
|
||||
|
||||
// files
|
||||
export let nginxConfFile = plugins.path.join(nginxConfigBase,"nginx.conf");
|
||||
export const nginxConfFile = plugins.path.join(nginxConfigDirPath, 'nginx.conf');
|
@ -1,9 +1,14 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export import cert = require("cert");
|
||||
export import childProcess = require("child_process");
|
||||
export import path = require("path");
|
||||
export import q = require("q");
|
||||
export import shelljs = require("shelljs");
|
||||
export import smartfile = require("smartfile");
|
||||
export import smartstring = require("smartstring");
|
||||
// native
|
||||
import * as path from 'path';
|
||||
|
||||
export { path };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
|
||||
export { lik, smartlog, smartpromise, smartshell, smartfile, smartstring };
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as plugins from "./smartnginx.plugins";
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
export let getBaseConfigString = () => {
|
||||
let baseConfig = plugins.smartstring.indent.normalize(`
|
||||
let baseConfig = plugins.smartstring.indent.normalize(`
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
@ -62,17 +63,16 @@ export let getBaseConfigString = () => {
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include ${paths.nginxHostDirPath}/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
daemon off;
|
||||
`);
|
||||
return baseConfig;
|
||||
}
|
||||
return baseConfig;
|
||||
};
|
||||
|
||||
|
||||
export let getHostConfigString = (hostNameArg:string,destinationIpArg:string) => {
|
||||
let hostConfig = plugins.smartstring.indent.normalize(`
|
||||
export let getHostConfigString = (hostNameArg: string, destinationIpArg: string) => {
|
||||
let hostConfig = plugins.smartstring.indent.normalize(`
|
||||
upstream ${hostNameArg} {
|
||||
server ${destinationIpArg};
|
||||
}
|
||||
@ -86,18 +86,20 @@ export let getHostConfigString = (hostNameArg:string,destinationIpArg:string) =>
|
||||
server {
|
||||
listen *:443 ssl;
|
||||
server_name ${hostNameArg};
|
||||
ssl_certificate /LE_CERTS/${hostNameArg}/fullchain.pem;
|
||||
ssl_certificate_key /LE_CERTS/${hostNameArg}/privkey.pem;
|
||||
ssl_certificate ${paths.nginxHostDirPath}/${hostNameArg}.public.pem;
|
||||
ssl_certificate_key ${paths.nginxHostDirPath}/${hostNameArg}.private.pem;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://${hostNameArg};
|
||||
include /etc/nginx/proxy_params;
|
||||
}
|
||||
location ~ /\.git {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
`);
|
||||
return hostConfig;
|
||||
return hostConfig;
|
||||
};
|
||||
|
||||
|
17
tslint.json
Normal file
17
tslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Reference in New Issue
Block a user