Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
a72811ee25 | |||
ac9d9cdddd | |||
5ac0e3dc95 | |||
bbe02bc70a | |||
02b4def04a | |||
5dd723a864 | |||
d04f5a619a | |||
6542f4c2fe | |||
32d6bf83c8 | |||
a4b918e648 | |||
de367ae194 | |||
2226359cfe | |||
10e87d2e6f | |||
5b58fb3bd2 | |||
968750a856 | |||
673cfb0027 | |||
5b45312f17 | |||
95d9e87f51 | |||
1382350d3a | |||
353eeaa0ae | |||
3dee0eba4e | |||
2111d2913b | |||
36b014aa47 | |||
e2c6aedbfa | |||
cb449a8f5d |
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@ -6,7 +6,7 @@ pipeline {
|
|||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
IMAGE_NAME = "nginx-proxy-manager"
|
IMAGE_NAME = "nginx-proxy-manager"
|
||||||
BASE_IMAGE_NAME = "jc21/nginx-proxy-manager-base"
|
BASE_IMAGE_NAME = "jc21/nginx-proxy-manager-base:v2"
|
||||||
TEMP_IMAGE_NAME = "nginx-proxy-manager-build_${BUILD_NUMBER}"
|
TEMP_IMAGE_NAME = "nginx-proxy-manager-build_${BUILD_NUMBER}"
|
||||||
TEMP_IMAGE_NAME_ARM = "nginx-proxy-manager-arm-build_${BUILD_NUMBER}"
|
TEMP_IMAGE_NAME_ARM = "nginx-proxy-manager-arm-build_${BUILD_NUMBER}"
|
||||||
TAG_VERSION = getPackageVersion()
|
TAG_VERSION = getPackageVersion()
|
||||||
@ -21,13 +21,16 @@ pipeline {
|
|||||||
stage('Build') {
|
stage('Build') {
|
||||||
parallel {
|
parallel {
|
||||||
stage('x86_64') {
|
stage('x86_64') {
|
||||||
|
when {
|
||||||
|
branch 'master'
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
ansiColor('xterm') {
|
ansiColor('xterm') {
|
||||||
// Codebase
|
// Codebase
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:latest yarn --registry=$NPM_REGISTRY install'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME yarn --registry=$NPM_REGISTRY install'
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:latest npm run-script build'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME npm run-script build'
|
||||||
sh 'rm -rf node_modules'
|
sh 'rm -rf node_modules'
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:latest yarn --registry=$NPM_REGISTRY install --prod'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME yarn --registry=$NPM_REGISTRY install --prod'
|
||||||
sh 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS node-prune'
|
sh 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS node-prune'
|
||||||
|
|
||||||
// Docker Build
|
// Docker Build
|
||||||
@ -38,15 +41,19 @@ pipeline {
|
|||||||
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION'
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION'
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION'
|
sh 'docker tag $TEMP_IMAGE_NAME $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION'
|
||||||
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION'
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION'
|
||||||
|
sh 'docker tag $TEMP_IMAGE_NAME $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest'
|
||||||
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest'
|
||||||
|
|
||||||
// Dockerhub
|
// Dockerhub
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$TAG_VERSION'
|
sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$TAG_VERSION'
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION'
|
sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION'
|
||||||
|
sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:latest'
|
||||||
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
||||||
sh "docker login -u '${duser}' -p '$dpass'"
|
sh "docker login -u '${duser}' -p '$dpass'"
|
||||||
sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION'
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION'
|
||||||
sh 'docker push docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION'
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION'
|
||||||
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:latest'
|
||||||
}
|
}
|
||||||
|
|
||||||
sh 'docker rmi $TEMP_IMAGE_NAME'
|
sh 'docker rmi $TEMP_IMAGE_NAME'
|
||||||
@ -54,16 +61,19 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('armhf') {
|
stage('armhf') {
|
||||||
|
when {
|
||||||
|
branch 'master'
|
||||||
|
}
|
||||||
agent {
|
agent {
|
||||||
label 'armhf'
|
label 'armhf'
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
ansiColor('xterm') {
|
ansiColor('xterm') {
|
||||||
// Codebase
|
// Codebase
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:armhf yarn --registry=$NPM_REGISTRY install'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-armhf yarn --registry=$NPM_REGISTRY install'
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:armhf npm run-script build'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-armhf npm run-script build'
|
||||||
sh 'rm -rf node_modules'
|
sh 'rm -rf node_modules'
|
||||||
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME:armhf yarn --registry=$NPM_REGISTRY install --prod'
|
sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-armhf yarn --registry=$NPM_REGISTRY install --prod'
|
||||||
|
|
||||||
// Docker Build
|
// Docker Build
|
||||||
sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE_NAME_ARM -f Dockerfile.armhf .'
|
sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE_NAME_ARM -f Dockerfile.armhf .'
|
||||||
@ -73,15 +83,19 @@ pipeline {
|
|||||||
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf'
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf'
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME_ARM $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
sh 'docker tag $TEMP_IMAGE_NAME_ARM $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
||||||
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
||||||
|
sh 'docker tag $TEMP_IMAGE_NAME_ARM $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest-armhf'
|
||||||
|
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest-armhf'
|
||||||
|
|
||||||
// Dockerhub
|
// Dockerhub
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf'
|
sh 'docker tag $TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf'
|
||||||
sh 'docker tag $TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
sh 'docker tag $TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
||||||
|
sh 'docker tag $TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:latest-armhf'
|
||||||
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
||||||
sh "docker login -u '${duser}' -p '$dpass'"
|
sh "docker login -u '${duser}' -p '$dpass'"
|
||||||
sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf'
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf'
|
||||||
sh 'docker push docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-armhf'
|
||||||
|
sh 'docker push docker.io/jc21/$IMAGE_NAME:latest-armhf'
|
||||||
}
|
}
|
||||||
|
|
||||||
sh 'docker rmi $TEMP_IMAGE_NAME_ARM'
|
sh 'docker rmi $TEMP_IMAGE_NAME_ARM'
|
||||||
@ -107,3 +121,4 @@ def getPackageVersion() {
|
|||||||
ver = sh(script: 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS bash -c "cat /data/package.json|jq -r \'.version\'"', returnStdout: true)
|
ver = sh(script: 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS bash -c "cat /data/package.json|jq -r \'.version\'"', returnStdout: true)
|
||||||
return ver.trim()
|
return ver.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Nginx Proxy Manager
|
# Nginx Proxy Manager
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
@ -14,16 +14,16 @@ running at home or otherwise, including free SSL, without having to know too muc
|
|||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
* latest 1, 1.x.x ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/master/Dockerfile))
|
* latest 2, 2.x.x ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/master/Dockerfile))
|
||||||
* latest-armhf, 1-armhf, 1.x.x-armhf ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/master/Dockerfile.armhf))
|
* latest-armhf, 2-armhf, 2.x.x-armhf ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/master/Dockerfile.armhf))
|
||||||
* 2, 2.x.x ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/v2/Dockerfile))
|
* 1, 1.x.x ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/1.1.2/Dockerfile))
|
||||||
* 2-armhf, 2.x.x-armhf ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/v2/Dockerfile.armhf))
|
* 1-armhf, 1.x.x-armhf ([Dockerfile](https://github.com/jc21/nginx-proxy-manager/blob/1.1.2/Dockerfile.armhf))
|
||||||
|
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
Please consult the [installation instructions](https://github.com/jc21/nginx-proxy-manager/blob/v2/doc/INSTALL.md) for a complete guide or
|
Please consult the [installation instructions](https://github.com/jc21/nginx-proxy-manager/blob/master/doc/INSTALL.md) for a complete guide or
|
||||||
if you just want to get up and running in the quickest time possible, grab all the files in the [doc/example/](https://github.com/jc21/nginx-proxy-manager/tree/v2/doc/example) folder and run `docker-compose up -d`
|
if you just want to get up and running in the quickest time possible, grab all the files in the [doc/example/](https://github.com/jc21/nginx-proxy-manager/tree/master/doc/example) folder and run `docker-compose up -d`
|
||||||
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nginx-proxy-manager",
|
"name": "nginx-proxy-manager",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"description": "A beautiful interface for creating Nginx endpoints",
|
"description": "A beautiful interface for creating Nginx endpoints",
|
||||||
"main": "src/backend/index.js",
|
"main": "src/backend/index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -183,10 +183,7 @@ const internalCertificate = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return internalCertificate.writeCustomCert(certificate)
|
|
||||||
.then(() => {
|
|
||||||
return certificate;
|
return certificate;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).then(certificate => {
|
}).then(certificate => {
|
||||||
|
|
||||||
@ -409,9 +406,13 @@ const internalCertificate = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
writeCustomCert: certificate => {
|
writeCustomCert: certificate => {
|
||||||
return new Promise((resolve, reject) => {
|
if (debug_mode) {
|
||||||
|
logger.info('Writing Custom Certificate:', certificate);
|
||||||
|
}
|
||||||
|
|
||||||
let dir = '/data/custom_ssl/npm-' + certificate.id;
|
let dir = '/data/custom_ssl/npm-' + certificate.id;
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
if (certificate.provider === 'letsencrypt') {
|
if (certificate.provider === 'letsencrypt') {
|
||||||
reject(new Error('Refusing to write letsencrypt certs here'));
|
reject(new Error('Refusing to write letsencrypt certs here'));
|
||||||
return;
|
return;
|
||||||
@ -549,8 +550,13 @@ const internalCertificate = {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
expires_on: certificateModel.raw('FROM_UNIXTIME(' + validations.certificate.dates.to + ')'),
|
expires_on: certificateModel.raw('FROM_UNIXTIME(' + validations.certificate.dates.to + ')'),
|
||||||
domain_names: [validations.certificate.cn],
|
domain_names: [validations.certificate.cn],
|
||||||
meta: row.meta
|
meta: _.clone(row.meta) // Prevent the update method from changing this value that we'll use later
|
||||||
});
|
})
|
||||||
|
.then(certificate => {
|
||||||
|
console.log('ROWMETA:', row.meta);
|
||||||
|
certificate.meta = row.meta;
|
||||||
|
return internalCertificate.writeCustomCert(certificate);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return _.pick(row.meta, internalCertificate.allowed_ssl_files);
|
return _.pick(row.meta, internalCertificate.allowed_ssl_files);
|
||||||
|
@ -189,7 +189,9 @@ const internalDeadHost = {
|
|||||||
.then(row => {
|
.then(row => {
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(deadHostModel, 'dead_host', row)
|
return internalNginx.configure(deadHostModel, 'dead_host', row)
|
||||||
.then(() => {
|
.then(new_meta => {
|
||||||
|
row.meta = new_meta;
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -235,6 +237,7 @@ const internalDeadHost = {
|
|||||||
})
|
})
|
||||||
.then(row => {
|
.then(row => {
|
||||||
if (row) {
|
if (row) {
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
} else {
|
} else {
|
||||||
throw new error.ItemNotFoundError(data.id);
|
throw new error.ItemNotFoundError(data.id);
|
||||||
@ -322,6 +325,13 @@ const internalDeadHost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
})
|
||||||
|
.then(rows => {
|
||||||
|
if (typeof expand !== 'undefined' && expand !== null && expand.indexOf('certificate') !== -1) {
|
||||||
|
return internalHost.cleanAllRowsCertificateMeta(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6,6 +6,36 @@ const deadHostModel = require('../models/dead_host');
|
|||||||
|
|
||||||
const internalHost = {
|
const internalHost = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used by the getAll functions of hosts, this removes the certificate meta if present
|
||||||
|
*
|
||||||
|
* @param {Array} rows
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
cleanAllRowsCertificateMeta: function (rows) {
|
||||||
|
rows.map(function (row, idx) {
|
||||||
|
if (typeof rows[idx].certificate !== 'undefined' && rows[idx].certificate) {
|
||||||
|
rows[idx].certificate.meta = {};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used by the get/update functions of hosts, this removes the certificate meta if present
|
||||||
|
*
|
||||||
|
* @param {Object} row
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
cleanRowCertificateMeta: function (row) {
|
||||||
|
if (typeof row.certificate !== 'undefined' && row.certificate) {
|
||||||
|
row.certificate.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return row;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This returns all the host types with any domain listed in the provided domain_names array.
|
* This returns all the host types with any domain listed in the provided domain_names array.
|
||||||
* This is used by the certificates to temporarily disable any host that is using the domain
|
* This is used by the certificates to temporarily disable any host that is using the domain
|
||||||
|
@ -25,6 +25,8 @@ const internalNginx = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
configure: (model, host_type, host) => {
|
configure: (model, host_type, host) => {
|
||||||
|
let combined_meta = {};
|
||||||
|
|
||||||
return internalNginx.test()
|
return internalNginx.test()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Nginx is OK
|
// Nginx is OK
|
||||||
@ -39,30 +41,46 @@ const internalNginx = {
|
|||||||
return internalNginx.test()
|
return internalNginx.test()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// nginx is ok
|
// nginx is ok
|
||||||
|
combined_meta = _.assign({}, host.meta, {
|
||||||
|
nginx_online: true,
|
||||||
|
nginx_err: null
|
||||||
|
});
|
||||||
|
|
||||||
return model
|
return model
|
||||||
.query()
|
.query()
|
||||||
.where('id', host.id)
|
.where('id', host.id)
|
||||||
.patch({
|
.patch({
|
||||||
meta: _.assign({}, host.meta, {
|
meta: combined_meta
|
||||||
nginx_online: true,
|
|
||||||
nginx_err: null
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
// Remove the error_log line because it's a docker-ism false positive that doesn't need to be reported.
|
||||||
|
// It will always look like this:
|
||||||
|
// nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (6: No such device or address)
|
||||||
|
|
||||||
|
let valid_lines = [];
|
||||||
|
let err_lines = err.message.split("\n");
|
||||||
|
err_lines.map(function (line) {
|
||||||
|
if (line.indexOf('/var/log/nginx/error.log') === -1) {
|
||||||
|
valid_lines.push(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (debug_mode) {
|
if (debug_mode) {
|
||||||
logger.error('Nginx test failed:', err.message);
|
logger.error('Nginx test failed:', valid_lines.join("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// config is bad, update meta and delete config
|
// config is bad, update meta and delete config
|
||||||
|
combined_meta = _.assign({}, host.meta, {
|
||||||
|
nginx_online: false,
|
||||||
|
nginx_err: valid_lines.join("\n")
|
||||||
|
});
|
||||||
|
|
||||||
return model
|
return model
|
||||||
.query()
|
.query()
|
||||||
.where('id', host.id)
|
.where('id', host.id)
|
||||||
.patch({
|
.patch({
|
||||||
meta: _.assign({}, host.meta, {
|
meta: combined_meta
|
||||||
nginx_online: false,
|
|
||||||
nginx_err: err.message
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return internalNginx.deleteConfig(host_type, host, true);
|
return internalNginx.deleteConfig(host_type, host, true);
|
||||||
@ -71,7 +89,10 @@ const internalNginx = {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return internalNginx.reload();
|
return internalNginx.reload();
|
||||||
});
|
})
|
||||||
|
.then(() => {
|
||||||
|
return combined_meta;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +103,7 @@ const internalNginx = {
|
|||||||
logger.info('Testing Nginx configuration');
|
logger.info('Testing Nginx configuration');
|
||||||
}
|
}
|
||||||
|
|
||||||
return utils.exec('/usr/sbin/nginx -t');
|
return utils.exec('/usr/sbin/nginx -t -g "error_log off;"');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,9 @@ const internalProxyHost = {
|
|||||||
.then(row => {
|
.then(row => {
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
|
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
|
||||||
.then(() => {
|
.then(new_meta => {
|
||||||
|
row.meta = new_meta;
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -236,6 +238,7 @@ const internalProxyHost = {
|
|||||||
})
|
})
|
||||||
.then(row => {
|
.then(row => {
|
||||||
if (row) {
|
if (row) {
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
} else {
|
} else {
|
||||||
throw new error.ItemNotFoundError(data.id);
|
throw new error.ItemNotFoundError(data.id);
|
||||||
@ -323,6 +326,13 @@ const internalProxyHost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
})
|
||||||
|
.then(rows => {
|
||||||
|
if (typeof expand !== 'undefined' && expand !== null && expand.indexOf('certificate') !== -1) {
|
||||||
|
return internalHost.cleanAllRowsCertificateMeta(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -189,7 +189,9 @@ const internalRedirectionHost = {
|
|||||||
.then(row => {
|
.then(row => {
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(redirectionHostModel, 'redirection_host', row)
|
return internalNginx.configure(redirectionHostModel, 'redirection_host', row)
|
||||||
.then(() => {
|
.then(new_meta => {
|
||||||
|
row.meta = new_meta;
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -235,6 +237,7 @@ const internalRedirectionHost = {
|
|||||||
})
|
})
|
||||||
.then(row => {
|
.then(row => {
|
||||||
if (row) {
|
if (row) {
|
||||||
|
row = internalHost.cleanRowCertificateMeta(row);
|
||||||
return _.omit(row, omissions());
|
return _.omit(row, omissions());
|
||||||
} else {
|
} else {
|
||||||
throw new error.ItemNotFoundError(data.id);
|
throw new error.ItemNotFoundError(data.id);
|
||||||
@ -322,6 +325,13 @@ const internalRedirectionHost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
})
|
||||||
|
.then(rows => {
|
||||||
|
if (typeof expand !== 'undefined' && expand !== null && expand.indexOf('certificate') !== -1) {
|
||||||
|
return internalHost.cleanAllRowsCertificateMeta(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('user_id').notNull().unsigned();
|
table.integer('user_id').notNull().unsigned();
|
||||||
table.string('type', 30).notNull();
|
table.string('type', 30).notNull();
|
||||||
table.string('secret').notNull();
|
table.string('secret').notNull();
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -77,7 +77,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('caching_enabled').notNull().unsigned().defaultTo(0);
|
table.integer('caching_enabled').notNull().unsigned().defaultTo(0);
|
||||||
table.integer('block_exploits').notNull().unsigned().defaultTo(0);
|
table.integer('block_exploits').notNull().unsigned().defaultTo(0);
|
||||||
table.text('advanced_config').notNull().defaultTo('');
|
table.text('advanced_config').notNull().defaultTo('');
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -96,7 +96,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('ssl_forced').notNull().unsigned().defaultTo(0);
|
table.integer('ssl_forced').notNull().unsigned().defaultTo(0);
|
||||||
table.integer('block_exploits').notNull().unsigned().defaultTo(0);
|
table.integer('block_exploits').notNull().unsigned().defaultTo(0);
|
||||||
table.text('advanced_config').notNull().defaultTo('');
|
table.text('advanced_config').notNull().defaultTo('');
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -112,7 +112,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('certificate_id').notNull().unsigned().defaultTo(0);
|
table.integer('certificate_id').notNull().unsigned().defaultTo(0);
|
||||||
table.integer('ssl_forced').notNull().unsigned().defaultTo(0);
|
table.integer('ssl_forced').notNull().unsigned().defaultTo(0);
|
||||||
table.text('advanced_config').notNull().defaultTo('');
|
table.text('advanced_config').notNull().defaultTo('');
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -129,7 +129,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('forwarding_port').notNull().unsigned();
|
table.integer('forwarding_port').notNull().unsigned();
|
||||||
table.integer('tcp_forwarding').notNull().unsigned().defaultTo(0);
|
table.integer('tcp_forwarding').notNull().unsigned().defaultTo(0);
|
||||||
table.integer('udp_forwarding').notNull().unsigned().defaultTo(0);
|
table.integer('udp_forwarding').notNull().unsigned().defaultTo(0);
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -142,7 +142,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('owner_user_id').notNull().unsigned();
|
table.integer('owner_user_id').notNull().unsigned();
|
||||||
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
||||||
table.string('name').notNull();
|
table.string('name').notNull();
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -156,9 +156,9 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
table.integer('is_deleted').notNull().unsigned().defaultTo(0);
|
||||||
table.string('provider').notNull();
|
table.string('provider').notNull();
|
||||||
table.string('nice_name').notNull().defaultTo('');
|
table.string('nice_name').notNull().defaultTo('');
|
||||||
table.json('domain_names').notNull().defaultTo('[]');
|
table.json('domain_names').notNull();
|
||||||
table.dateTime('expires_on').notNull();
|
table.dateTime('expires_on').notNull();
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -171,7 +171,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.integer('access_list_id').notNull().unsigned();
|
table.integer('access_list_id').notNull().unsigned();
|
||||||
table.string('username').notNull();
|
table.string('username').notNull();
|
||||||
table.string('password').notNull();
|
table.string('password').notNull();
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -185,7 +185,7 @@ exports.up = function (knex/*, Promise*/) {
|
|||||||
table.string('object_type').notNull().defaultTo('');
|
table.string('object_type').notNull().defaultTo('');
|
||||||
table.integer('object_id').notNull().unsigned().defaultTo(0);
|
table.integer('object_id').notNull().unsigned().defaultTo(0);
|
||||||
table.string('action').notNull();
|
table.string('action').notNull();
|
||||||
table.json('meta').notNull().defaultTo('{}');
|
table.json('meta').notNull();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -14,6 +14,11 @@ class AccessList extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
|
@ -12,6 +12,11 @@ class AccessListAuth extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
|
@ -13,6 +13,11 @@ class AuditLog extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
|
@ -29,6 +29,11 @@ class Auth extends Model {
|
|||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
return encryptPassword.apply(this, queryContext);
|
return encryptPassword.apply(this, queryContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,13 +14,31 @@ class Certificate extends Model {
|
|||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for expires_on
|
||||||
if (typeof this.expires_on === 'undefined') {
|
if (typeof this.expires_on === 'undefined') {
|
||||||
this.expires_on = Model.raw('NOW()');
|
this.expires_on = Model.raw('NOW()');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default for domain_names
|
||||||
|
if (typeof this.domain_names === 'undefined') {
|
||||||
|
this.domain_names = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.domain_names.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Sort domain_names
|
||||||
|
if (typeof this.domain_names !== 'undefined') {
|
||||||
|
this.domain_names.sort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get name () {
|
static get name () {
|
||||||
|
@ -14,10 +14,27 @@ class DeadHost extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for domain_names
|
||||||
|
if (typeof this.domain_names === 'undefined') {
|
||||||
|
this.domain_names = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.domain_names.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Sort domain_names
|
||||||
|
if (typeof this.domain_names !== 'undefined') {
|
||||||
|
this.domain_names.sort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get name () {
|
static get name () {
|
||||||
|
@ -15,11 +15,24 @@ class ProxyHost extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for domain_names
|
||||||
|
if (typeof this.domain_names === 'undefined') {
|
||||||
|
this.domain_names = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
this.domain_names.sort();
|
this.domain_names.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Sort domain_names
|
||||||
if (typeof this.domain_names !== 'undefined') {
|
if (typeof this.domain_names !== 'undefined') {
|
||||||
this.domain_names.sort();
|
this.domain_names.sort();
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,27 @@ class RedirectionHost extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for domain_names
|
||||||
|
if (typeof this.domain_names === 'undefined') {
|
||||||
|
this.domain_names = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.domain_names.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Sort domain_names
|
||||||
|
if (typeof this.domain_names !== 'undefined') {
|
||||||
|
this.domain_names.sort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get name () {
|
static get name () {
|
||||||
|
@ -13,6 +13,11 @@ class Stream extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for meta
|
||||||
|
if (typeof this.meta === 'undefined') {
|
||||||
|
this.meta = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
|
@ -19,7 +19,6 @@ module.exports = function () {
|
|||||||
let token_data = {};
|
let token_data = {};
|
||||||
|
|
||||||
let self = {
|
let self = {
|
||||||
//return {
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} payload
|
* @param {Object} payload
|
||||||
* @param {Object} [user_options]
|
* @param {Object} [user_options]
|
||||||
|
@ -13,6 +13,11 @@ class User extends Model {
|
|||||||
$beforeInsert () {
|
$beforeInsert () {
|
||||||
this.created_on = Model.raw('NOW()');
|
this.created_on = Model.raw('NOW()');
|
||||||
this.modified_on = Model.raw('NOW()');
|
this.modified_on = Model.raw('NOW()');
|
||||||
|
|
||||||
|
// Default for roles
|
||||||
|
if (typeof this.roles === 'undefined') {
|
||||||
|
this.roles = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate () {
|
$beforeUpdate () {
|
||||||
|
@ -16,9 +16,9 @@ server {
|
|||||||
{% include "_forced_ssl.conf" %}
|
{% include "_forced_ssl.conf" %}
|
||||||
|
|
||||||
{% if preserve_path == 1 or preserve_path == true %}
|
{% if preserve_path == 1 or preserve_path == true %}
|
||||||
return 301 $scheme://{{ forward_domain_name }}$request_uri$request_uri;
|
|
||||||
{% else %}
|
|
||||||
return 301 $scheme://{{ forward_domain_name }}$request_uri;
|
return 301 $scheme://{{ forward_domain_name }}$request_uri;
|
||||||
|
{% else %}
|
||||||
|
return 301 $scheme://{{ forward_domain_name }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user