Skip to content

Commit

Permalink
Merge pull request #543 from jc21/develop
Browse files Browse the repository at this point in the history
v2.4.0
  • Loading branch information
jc21 authored Aug 6, 2020
2 parents f9b8d76 + 7c7d255 commit 74010ac
Show file tree
Hide file tree
Showing 40 changed files with 4,912 additions and 4,439 deletions.
File renamed without changes.
11 changes: 11 additions & 0 deletions .jenkins/config-sqlite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"database": {
"engine": "knex-native",
"knex": {
"client": "sqlite3",
"connection": {
"filename": "/data/database.sqlite"
}
}
}
}
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.4.0
41 changes: 34 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,49 @@ pipeline {
'''
}
}
stage('Test') {
stage('Integration Tests Sqlite') {
steps {
// Bring up a stack
sh 'docker-compose up -d fullstack'
sh './scripts/wait-healthy $(docker-compose ps -q fullstack) 120'
sh 'docker-compose up -d fullstack-sqlite'
sh './scripts/wait-healthy $(docker-compose ps -q fullstack-sqlite) 120'

// Run tests
sh 'rm -rf test/results'
sh 'docker-compose up cypress'
sh 'docker-compose up cypress-sqlite'
// Get results
sh 'docker cp -L "$(docker-compose ps -q cypress):/results" test/'
sh 'docker cp -L "$(docker-compose ps -q cypress-sqlite):/test/results" test/'
}
post {
always {
// Dumps to analyze later
sh 'mkdir -p debug'
sh 'docker-compose logs fullstack | gzip > debug/docker_fullstack.log.gz'
sh 'docker-compose logs fullstack-sqlite | gzip > debug/docker_fullstack_sqlite.log.gz'
sh 'docker-compose logs db | gzip > debug/docker_db.log.gz'
// Cypress videos and screenshot artifacts
dir(path: 'test/results') {
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
}
junit 'test/results/junit/*'
}
}
}
stage('Integration Tests Mysql') {
steps {
// Bring up a stack
sh 'docker-compose up -d fullstack-mysql'
sh './scripts/wait-healthy $(docker-compose ps -q fullstack-mysql) 120'

// Run tests
sh 'rm -rf test/results'
sh 'docker-compose up cypress-mysql'
// Get results
sh 'docker cp -L "$(docker-compose ps -q cypress-mysql):/test/results" test/'
}
post {
always {
// Dumps to analyze later
sh 'mkdir -p debug'
sh 'docker-compose logs fullstack-mysql | gzip > debug/docker_fullstack_mysql.log.gz'
sh 'docker-compose logs db | gzip > debug/docker_db.log.gz'
// Cypress videos and screenshot artifacts
dir(path: 'test/results') {
Expand Down Expand Up @@ -136,8 +162,9 @@ pipeline {
}
steps {
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
// Docker Login
sh "docker login -u '${duser}' -p '${dpass}'"
// Buildx with push
// Buildx with push from cache
sh "./scripts/buildx --push ${BUILDX_PUSH_TAGS}"
}
}
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img src="https://nginxproxymanager.com/github.png">
<br><br>
<img src="https://img.shields.io/badge/version-2.3.1-green.svg?style=for-the-badge">
<img src="https://img.shields.io/badge/version-2.4.0-green.svg?style=for-the-badge">
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
</a>
Expand Down Expand Up @@ -155,14 +155,24 @@ Special thanks to the following contributors:
<br /><sub><b>OhHeyAlan</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/dogmatic69">
<img src="https://avatars2.githubusercontent.com/u/94674?s=460&u=ca7647de53145c6283b6373ade5dc94ba99347db&v=4" width="80px;" alt=""/>
<br /><sub><b>Carl Sutton</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/tg44">
<img src="https://avatars0.githubusercontent.com/u/31839?s=460&u=ad32f4cadfef5e5fb09cdfa4b7b7b36a99ba6811&v=4" width="80px;" alt=""/>
<br /><sub><b>Gergő Törcsvári</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/vrenjith">
<img src="https://avatars3.githubusercontent.com/u/2093241?s=460&u=96ce93a9bebabdd0a60a2dc96cd093a41d5edaba&v=4" width="80px;" alt=""/>
<br /><sub><b>vrenjith</b></sub>
</a>
</td>
</tr>
</table>
<!-- markdownlint-enable -->
Expand Down
26 changes: 26 additions & 0 deletions backend/config/sqlite-test-db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"database": {
"engine": "knex-native",
"knex": {
"client": "sqlite3",
"connection": {
"filename": "/app/backend/config/mydb.sqlite"
},
"pool": {
"min": 0,
"max": 1,
"createTimeoutMillis": 3000,
"acquireTimeoutMillis": 30000,
"idleTimeoutMillis": 30000,
"reapIntervalMillis": 1000,
"createRetryIntervalMillis": 100,
"propagateCreateError": false
},
"migrations": {
"tableName": "migrations",
"stub": "src/backend/lib/migrate_template.js",
"directory": "src/backend/migrations"
}
}
}
}
34 changes: 21 additions & 13 deletions backend/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ if (!config.has('database')) {
throw new Error('Database config does not exist! Please read the instructions: https://github.com/jc21/nginx-proxy-manager/blob/master/doc/INSTALL.md');
}

let data = {
client: config.database.engine,
connection: {
host: config.database.host,
user: config.database.user,
password: config.database.password,
database: config.database.name,
port: config.database.port
},
migrations: {
tableName: 'migrations'
}
};
function generateDbConfig() {
if (config.database.engine === 'knex-native') {
return config.database.knex;
} else
return {
client: config.database.engine,
connection: {
host: config.database.host,
user: config.database.user,
password: config.database.password,
database: config.database.name,
port: config.database.port
},
migrations: {
tableName: 'migrations'
}
};
}


let data = generateDbConfig();

if (typeof config.database.version !== 'undefined') {
data.version = config.database.version;
Expand Down
16 changes: 0 additions & 16 deletions backend/migrations/20190227065017_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ exports.up = function (knex/*, Promise*/) {
})
.then(() => {
logger.info('[' + migrate_name + '] setting Table created');

// TODO: add settings
let settingModel = require('../models/setting');

return settingModel
.query()
.insert({
id: 'default-site',
name: 'Default Site',
description: 'What to show when Nginx is hit with an unknown Host',
value: 'congratulations',
meta: {}
});
})
.then(() => {
logger.info('[' + migrate_name + '] Default settings added');
});
};

Expand Down
7 changes: 4 additions & 3 deletions backend/models/access_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ const Model = require('objection').Model;
const User = require('./user');
const AccessListAuth = require('./access_list_auth');
const AccessListClient = require('./access_list_client');
const now = require('./now_helper');

Model.knex(db);

class AccessList extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for meta
if (typeof this.meta === 'undefined') {
Expand All @@ -21,7 +22,7 @@ class AccessList extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();
}

static get name () {
Expand Down
7 changes: 4 additions & 3 deletions backend/models/access_list_auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

const db = require('../db');
const Model = require('objection').Model;
const now = require('./now_helper');

Model.knex(db);

class AccessListAuth extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for meta
if (typeof this.meta === 'undefined') {
Expand All @@ -18,7 +19,7 @@ class AccessListAuth extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();
}

static get name () {
Expand Down
7 changes: 4 additions & 3 deletions backend/models/access_list_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

const db = require('../db');
const Model = require('objection').Model;
const now = require('./now_helper');

Model.knex(db);

class AccessListClient extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for meta
if (typeof this.meta === 'undefined') {
Expand All @@ -18,7 +19,7 @@ class AccessListClient extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();
}

static get name () {
Expand Down
7 changes: 4 additions & 3 deletions backend/models/audit-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
const db = require('../db');
const Model = require('objection').Model;
const User = require('./user');
const now = require('./now_helper');

Model.knex(db);

class AuditLog extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for meta
if (typeof this.meta === 'undefined') {
Expand All @@ -19,7 +20,7 @@ class AuditLog extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();
}

static get name () {
Expand Down
7 changes: 4 additions & 3 deletions backend/models/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const bcrypt = require('bcrypt');
const db = require('../db');
const Model = require('objection').Model;
const User = require('./user');
const now = require('./now_helper');

Model.knex(db);

Expand All @@ -24,8 +25,8 @@ function encryptPassword () {

class Auth extends Model {
$beforeInsert (queryContext) {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for meta
if (typeof this.meta === 'undefined') {
Expand All @@ -36,7 +37,7 @@ class Auth extends Model {
}

$beforeUpdate (queryContext) {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();
return encryptPassword.apply(this, queryContext);
}

Expand Down
9 changes: 5 additions & 4 deletions backend/models/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
const db = require('../db');
const Model = require('objection').Model;
const User = require('./user');
const now = require('./now_helper');

Model.knex(db);

class Certificate extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for expires_on
if (typeof this.expires_on === 'undefined') {
this.expires_on = Model.raw('NOW()');
this.expires_on = now();
}

// Default for domain_names
Expand All @@ -31,7 +32,7 @@ class Certificate extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();

// Sort domain_names
if (typeof this.domain_names !== 'undefined') {
Expand Down
7 changes: 4 additions & 3 deletions backend/models/dead_host.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const db = require('../db');
const Model = require('objection').Model;
const User = require('./user');
const Certificate = require('./certificate');
const now = require('./now_helper');

Model.knex(db);

class DeadHost extends Model {
$beforeInsert () {
this.created_on = Model.raw('NOW()');
this.modified_on = Model.raw('NOW()');
this.created_on = now();
this.modified_on = now();

// Default for domain_names
if (typeof this.domain_names === 'undefined') {
Expand All @@ -27,7 +28,7 @@ class DeadHost extends Model {
}

$beforeUpdate () {
this.modified_on = Model.raw('NOW()');
this.modified_on = now();

// Sort domain_names
if (typeof this.domain_names !== 'undefined') {
Expand Down
Loading

0 comments on commit 74010ac

Please sign in to comment.