Skip to content

Commit 8d925de

Browse files
author
Jamie Curnow
committed
Access polish, import v1 stsarted
1 parent 7d9e716 commit 8d925de

File tree

27 files changed

+525
-120
lines changed

27 files changed

+525
-120
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ data/*
1010
yarn-error.log
1111
yarn.lock
1212
tmp
13+
certbot.log
14+

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
![Stars](https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge)
77
![Pulls](https://img.shields.io/docker/pulls/jc21/nginx-proxy-manager.svg?style=for-the-badge)
88

9-
**NOTE: Version 2 is a work in progress. Not all of the areas are complete and is definitely not ready for production use.**
10-
119
This project comes as a pre-built docker image that enables you to easily forward to your websites
1210
running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.
1311

12+
----------
13+
14+
**WARNING: Version 2 a complete rewrite!** If you are using the `latest` docker tag and update to version 2
15+
without preparation, horrible things might happen. Refer to the [Migrating Documentation](doc/MIGRATING.md).
16+
17+
----------
1418

1519
## Features
1620

1721
- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io/)
1822
- Easily create forwarding domains, redirections, streams and 404 hosts without knowing anything about Nginx
1923
- Free SSL using Let's Encrypt or provide your own custom SSL certificates
2024
- Access Lists and basic HTTP Authentication for your hosts
21-
- Advanced Nginx configuration available for super users
25+
- -Advanced Nginx configuration available for super users- TODO
2226
- User management, permissions and audit log
2327

24-
#### Future Features
25-
26-
- Live log tail
27-
2828

2929
## Screenshots
3030

TODO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
In order of importance, somewhat..
44

5-
- Manual certificate writing to disk and usage in nginx configs - MIGRATING.md
6-
- Access Lists UI and Nginx usage
7-
- Make modal dialogs unclosable in overlay
5+
- Custom ssl certificate saving to disk and usage in nginx configs
86
- Dashboard stats are caching instead of querying
97
- Create a nice way of importing from v1 let's encrypt certs and config data
108
- UI Log tail
9+
- Custom Nginx Config Editor
1110

12-
Testing
11+
Testing:
1312

1413
- Access Levels
14+
- Adding a proxy host without access to read certs or access lists
1515
- Visibility
1616
- Forwarding
1717
- Cert renewals

doc/INSTALL.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
There's a few ways to configure this app depending on:
44

55
- Whether you use `docker-compose` or vanilla docker
6-
- Which Database you want to use (mysql or postgres)
76
- Which architecture you're running it on (raspberry pi also supported)
87

98
### Configuration File
@@ -12,9 +11,9 @@ There's a few ways to configure this app depending on:
1211

1312
Don't worry, this is easy to do.
1413

15-
The app requires a configuration file to let it know what database you're using and where it is.
14+
The app requires a configuration file to let it know what database you're using.
1615

17-
Here's an example configuration for `mysql`:
16+
Here's an example configuration for `mysql` (or mariadb):
1817

1918
```json
2019
{
@@ -29,22 +28,6 @@ Here's an example configuration for `mysql`:
2928
}
3029
```
3130

32-
and here's one for `postgres`:
33-
34-
```json
35-
{
36-
"database": {
37-
"engine": "pg",
38-
"version": "7.2",
39-
"host": "127.0.0.1",
40-
"name": "nginxproxymanager",
41-
"user": "nginxproxymanager",
42-
"password": "password123",
43-
"port": 5432
44-
}
45-
}
46-
```
47-
4831
Once you've created your configuration file it's easy to mount it in the docker container, examples below.
4932

5033
**Note:** After the first run of the application, the config file will be altered to include generated encryption keys unique to your installation. These keys
@@ -138,3 +121,24 @@ docker run -d \
138121
-v /path/to/letsencrypt:/etc/letsencrypt \
139122
jc21/nginx-proxy-manager:2-armhf
140123
```
124+
125+
126+
### Initial Run
127+
128+
After the app is running for the first time, the following will happen:
129+
130+
- The database will initialize with table structures
131+
- GPG keys will be generated and saved in the configuration file
132+
- A default admin user will be created
133+
134+
This process can take a couple of minutes depending on your machine.
135+
136+
137+
### Default Administrator User
138+
139+
```
140+
141+
Password: changeme
142+
```
143+
144+
Immediately after logging in with this default user you will be asked to modify your details and change your password.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"body-parser": "^1.18.3",
4242
"compression": "^1.7.2",
4343
"config": "^2.0.1",
44+
"diskdb": "^0.1.17",
4445
"ejs": "^2.6.1",
4546
"express": "^4.16.3",
4647
"express-fileupload": "^0.4.0",
@@ -56,7 +57,6 @@
5657
"node-rsa": "^1.0.0",
5758
"objection": "^1.1.10",
5859
"path": "^0.12.7",
59-
"pg": "^7.4.3",
6060
"restler": "^3.4.0",
6161
"signale": "^1.2.1",
6262
"temp-write": "^3.4.0",

rootfs/etc/services.d/manager/run

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ mkdir -p /data/letsencrypt-acme-challenge
44

55
cd /app
66
node --abort_on_uncaught_exception --max_old_space_size=250 /app/src/backend/index.js
7-

rootfs/etc/services.d/nginx/run

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
mkdir -p /tmp/nginx/body \
44
/var/log/nginx \
5-
/data/{nginx,logs,access} \
6-
/data/nginx/{proxy_host,redirection_host,stream,dead_host,temp} \
7-
/var/lib/nginx/cache/{public,private}
5+
/data/nginx \
6+
/data/logs \
7+
/data/access \
8+
/data/nginx/proxy_host \
9+
/data/nginx/redirection_host \
10+
/data/nginx/stream \
11+
/data/nginx/dead_host \
12+
/data/nginx/temp \
13+
/var/lib/nginx/cache/public \
14+
/var/lib/nginx/cache/private
815

916
touch /var/log/nginx/error.log && chmod 777 /var/log/nginx/error.log
1017
chown root /tmp/nginx

src/backend/importer.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const logger = require('./logger').import;
5+
const utils = require('./lib/utils');
6+
7+
module.exports = function () {
8+
return new Promise((resolve, reject) => {
9+
if (fs.existsSync('/config') && !fs.existsSync('/config/v2-imported')) {
10+
11+
logger.info('Beginning import from V1 ...');
12+
13+
// Setup
14+
const batchflow = require('batchflow');
15+
const db = require('diskdb');
16+
module.exports = db.connect('/config', ['hosts', 'access']);
17+
18+
// Create a fake access object
19+
const Access = require('./lib/access');
20+
let access = new Access(null);
21+
resolve(access.load(true)
22+
.then(access => {
23+
24+
25+
26+
// Import access lists first
27+
let lists = db.access.find();
28+
lists.map(list => {
29+
logger.warn('List:', list);
30+
31+
});
32+
33+
})
34+
);
35+
36+
/*
37+
let hosts = db.hosts.find();
38+
hosts.map(host => {
39+
logger.warn('Host:', host);
40+
});
41+
*/
42+
43+
// Looks like we need to import from version 1
44+
// There are numerous parts to this import:
45+
//
46+
// 1. The letsencrypt certificates, the need to be added to the database and files renamed
47+
// 2. The access lists from the previous datastore
48+
// 3. The Hosts from the previous datastore
49+
50+
// get all hosts:
51+
// resolve(db.hosts.find());
52+
53+
// get specific host:
54+
// existing_host = db.hosts.findOne({incoming_port: payload.incoming_port});
55+
56+
// remove host:
57+
// db.hosts.remove({hostname: payload.hostname});
58+
59+
// get all access:
60+
// resolve(db.access.find());
61+
62+
resolve();
63+
64+
} else {
65+
resolve();
66+
}
67+
});
68+
};

src/backend/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const logger = require('./logger').global;
77
function appStart () {
88
const migrate = require('./migrate');
99
const setup = require('./setup');
10+
const importer = require('./importer');
1011
const app = require('./app');
1112
const apiValidator = require('./lib/validator/api');
1213
const internalCertificate = require('./internal/certificate');
1314

1415
return migrate.latest()
15-
.then(() => {
16-
return setup();
17-
})
16+
.then(setup)
17+
.then(importer)
1818
.then(() => {
1919
return apiValidator.loadSchemas;
2020
})

0 commit comments

Comments
 (0)