Skip to content

develop -> openidc #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e2e9835
Version bump
jc21 Jun 8, 2020
3f723b1
Merge pull request #454 from jc21/develop
jc21 Jun 8, 2020
157a12f
Update location-item.ejs
vrenjith Jun 18, 2020
d1786fe
Bump lodash from 4.17.15 to 4.17.19 in /frontend
dependabot[bot] Jul 19, 2020
f8edeb2
fixed migration and setup
tg44 Jul 19, 2020
a9e7222
introduced now_helper for multidb capabilities
tg44 Jul 19, 2020
6690b77
sqlite3 and psql support
tg44 Jul 19, 2020
8dfbcef
Bump lodash from 4.17.15 to 4.17.19 in /docs
dependabot[bot] Jul 19, 2020
1bc2df2
Merge pull request #514 from jc21/dependabot/npm_and_yarn/docs/lodash…
jc21 Jul 20, 2020
26f00ee
Merge branch 'master' into dependabot/npm_and_yarn/frontend/lodash-4.…
jc21 Jul 20, 2020
f9b8d76
Merge pull request #513 from jc21/dependabot/npm_and_yarn/frontend/lo…
jc21 Jul 20, 2020
d1a0780
Attempt to circumvent docker login token timeouts
jc21 Jul 29, 2020
85ac43b
Merge branch 'master' of github.com:jc21/nginx-proxy-manager into dev…
jc21 Jul 29, 2020
8312bc0
Use same tags for experiment
jc21 Jul 30, 2020
c41057b
Revert builx push experiment
jc21 Jul 30, 2020
04412f3
Merge pull request #510 from tg44/multidb-re
jc21 Aug 5, 2020
492d450
Sqlite Tweaks
jc21 Aug 5, 2020
b23d59d
Updated cypress to 4.12.1
jc21 Aug 5, 2020
7fd825b
Use development config file in CI
jc21 Aug 6, 2020
5be46b4
Cypress fixes
jc21 Aug 6, 2020
4a07bf6
Added users cypress tests
jc21 Aug 6, 2020
9ce4c3f
CI fix
jc21 Aug 6, 2020
bf2f134
Cypress fixes
jc21 Aug 6, 2020
5da6c97
Pull cypress tests from correct location
jc21 Aug 6, 2020
54d423a
Updated doc for sqlite
jc21 Aug 6, 2020
ae06b2d
Updated deps and added contributor
jc21 Aug 6, 2020
b4fc629
Bumped version
jc21 Aug 6, 2020
058f1e9
Merge pull request #464 from vrenjith/patch-1
jc21 Aug 6, 2020
7c7d255
Added another contributor
jc21 Aug 6, 2020
74010ac
Merge pull request #543 from jc21/develop
jc21 Aug 6, 2020
01660b5
Fixed now_helper for sqlite: it should also returns the time.
jlesage Aug 6, 2020
d686565
Merge pull request #544 from jlesage/sqlite-now-helper-fix
jc21 Aug 6, 2020
7034613
Bump prismjs from 1.20.0 to 1.21.0 in /docs
dependabot[bot] Aug 8, 2020
5d65166
Ignore local subnets for real IP determination
jc21 Aug 11, 2020
f539e81
Removed the hardcoded `--webroot` certbot argument to better support …
jlesage Aug 14, 2020
83fad8b
Removed usage of `FROM_UNIXTIME` mysql-specific function.
jlesage Aug 14, 2020
f78a4c6
Bump bcrypt from 4.0.1 to 5.0.0 in /backend
dependabot[bot] Aug 20, 2020
6694a42
Merge pull request #560 from jlesage/remove-from-unixtime
jc21 Aug 21, 2020
e5034a3
Merge pull request #570 from jc21/dependabot/npm_and_yarn/backend/bcr…
jc21 Aug 24, 2020
bf8beb5
Merge pull request #559 from jlesage/remove-webroot-certbot-arg
jc21 Aug 24, 2020
4bafc7f
Merge pull request #546 from jc21/dependabot/npm_and_yarn/docs/prismj…
jc21 Aug 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0
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.0-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
9 changes: 4 additions & 5 deletions backend/internal/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const internalCertificate = {
.where('id', certificate.id)
.andWhere('provider', 'letsencrypt')
.patch({
expires_on: certificateModel.raw('FROM_UNIXTIME(' + cert_info.dates.to + ')')
expires_on: moment(cert_info.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss')
});
})
.catch((err) => {
Expand Down Expand Up @@ -180,7 +180,7 @@ const internalCertificate = {
return certificateModel
.query()
.patchAndFetchById(certificate.id, {
expires_on: certificateModel.raw('FROM_UNIXTIME(' + cert_info.dates.to + ')')
expires_on: moment(cert_info.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss')
})
.then((saved_row) => {
// Add cert data for audit log
Expand Down Expand Up @@ -558,7 +558,7 @@ const internalCertificate = {
// TODO: This uses a mysql only raw function that won't translate to postgres
return internalCertificate.update(access, {
id: data.id,
expires_on: certificateModel.raw('FROM_UNIXTIME(' + validations.certificate.dates.to + ')'),
expires_on: moment(validations.certificate.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss'),
domain_names: [validations.certificate.cn],
meta: _.clone(row.meta) // Prevent the update method from changing this value that we'll use later
})
Expand Down Expand Up @@ -733,7 +733,6 @@ const internalCertificate = {
'--agree-tos ' +
'--email "' + certificate.meta.letsencrypt_email + '" ' +
'--preferred-challenges "dns,http" ' +
'--webroot ' +
'--domains "' + certificate.domain_names.join(',') + '" ' +
(le_staging ? '--staging' : '');

Expand Down Expand Up @@ -769,7 +768,7 @@ const internalCertificate = {
return certificateModel
.query()
.patchAndFetchById(certificate.id, {
expires_on: certificateModel.raw('FROM_UNIXTIME(' + cert_info.dates.to + ')')
expires_on: moment(cert_info.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss')
});
})
.then((updated_certificate) => {
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
Loading