Skip to content

Commit 79e0ab2

Browse files
committed
Merge branch 'zh-v2.11.3' into develop-zh
2 parents 8f2be0d + 3cfa92b commit 79e0ab2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2644
-5925
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
._*
44
.vscode
55
certbot-help.txt
6+
test/node_modules
7+
*/node_modules
8+
docker/dev/dnsrouter-config.json.tmp
9+
docker/dev/resolv.conf

.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.11.2
1+
2.11.3

Jenkinsfile

+56-90
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ pipeline {
1818
BUILD_VERSION = getVersion()
1919
MAJOR_VERSION = '2'
2020
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\.', '-')}"
21-
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
22-
COMPOSE_FILE = 'docker/docker-compose.ci.yml'
21+
BUILDX_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
2322
COMPOSE_INTERACTIVE_NO_CLI = 1
24-
BUILDX_NAME = "${COMPOSE_PROJECT_NAME}"
2523
}
2624
stages {
2725
stage('Environment') {
@@ -92,81 +90,63 @@ pipeline {
9290
sh 'yarn install'
9391
sh 'yarn build'
9492
}
95-
dir(path: 'docs/.vuepress/dist') {
96-
sh 'tar -czf ../../docs.tgz *'
97-
}
98-
archiveArtifacts(artifacts: 'docs/docs.tgz', allowEmptyArchive: false)
9993
}
10094
}
101-
stage('Cypress') {
102-
steps {
103-
// Creating will also create the network prior to
104-
// using it in parallel stages below and mitigating
105-
// a race condition.
106-
sh 'docker-compose build cypress-sqlite'
107-
sh 'docker-compose build cypress-mysql'
108-
sh 'docker-compose create cypress-sqlite'
109-
sh 'docker-compose create cypress-mysql'
110-
}
95+
}
96+
}
97+
stage('Test Sqlite') {
98+
environment {
99+
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}_sqlite"
100+
COMPOSE_FILE = 'docker/docker-compose.ci.yml:docker/docker-compose.ci.sqlite.yml'
101+
}
102+
when {
103+
not {
104+
equals expected: 'UNSTABLE', actual: currentBuild.result
105+
}
106+
}
107+
steps {
108+
sh 'rm -rf ./test/results/junit/*'
109+
sh './scripts/ci/fulltest-cypress'
110+
}
111+
post {
112+
always {
113+
// Dumps to analyze later
114+
sh 'mkdir -p debug/sqlite'
115+
sh 'docker logs $(docker-compose ps --all -q fullstack) > debug/sqlite/docker_fullstack.log 2>&1'
116+
sh 'docker logs $(docker-compose ps --all -q stepca) > debug/sqlite/docker_stepca.log 2>&1'
117+
sh 'docker logs $(docker-compose ps --all -q pdns) > debug/sqlite/docker_pdns.log 2>&1'
118+
sh 'docker logs $(docker-compose ps --all -q pdns-db) > debug/sqlite/docker_pdns-db.log 2>&1'
119+
sh 'docker logs $(docker-compose ps --all -q dnsrouter) > debug/sqlite/docker_dnsrouter.log 2>&1'
120+
junit 'test/results/junit/*'
121+
sh 'docker-compose down --remove-orphans --volumes -t 30 || true'
111122
}
112123
}
113124
}
114-
stage('Integration Tests') {
115-
parallel {
116-
stage('Sqlite') {
117-
steps {
118-
// Bring up a stack
119-
sh 'docker-compose up -d fullstack-sqlite'
120-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
121-
// Stop and Start it, as this will test it's ability to restart with existing data
122-
sh 'docker-compose stop fullstack-sqlite'
123-
sh 'docker-compose start fullstack-sqlite'
124-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
125-
126-
// Run tests
127-
sh 'rm -rf test/results-sqlite'
128-
sh 'docker-compose up cypress-sqlite'
129-
// Get results
130-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/results-sqlite'
131-
}
132-
post {
133-
always {
134-
// Dumps to analyze later
135-
sh 'mkdir -p debug/sqlite'
136-
sh 'docker-compose logs fullstack-sqlite > debug/sqlite/docker_fullstack_sqlite.log'
137-
// Cypress videos and screenshot artifacts
138-
dir(path: 'test/results-sqlite') {
139-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
140-
}
141-
junit 'test/results-sqlite/junit/*'
142-
}
143-
}
125+
stage('Test Mysql') {
126+
environment {
127+
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}_mysql"
128+
COMPOSE_FILE = 'docker/docker-compose.ci.yml:docker/docker-compose.ci.mysql.yml'
129+
}
130+
when {
131+
not {
132+
equals expected: 'UNSTABLE', actual: currentBuild.result
144133
}
145-
stage('Mysql') {
146-
steps {
147-
// Bring up a stack
148-
sh 'docker-compose up -d fullstack-mysql'
149-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
150-
151-
// Run tests
152-
sh 'rm -rf test/results-mysql'
153-
sh 'docker-compose up cypress-mysql'
154-
// Get results
155-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/results-mysql'
156-
}
157-
post {
158-
always {
159-
// Dumps to analyze later
160-
sh 'mkdir -p debug/mysql'
161-
sh 'docker-compose logs fullstack-mysql > debug/mysql/docker_fullstack_mysql.log'
162-
sh 'docker-compose logs db > debug/mysql/docker_db.log'
163-
// Cypress videos and screenshot artifacts
164-
dir(path: 'test/results-mysql') {
165-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
166-
}
167-
junit 'test/results-mysql/junit/*'
168-
}
169-
}
134+
}
135+
steps {
136+
sh 'rm -rf ./test/results/junit/*'
137+
sh './scripts/ci/fulltest-cypress'
138+
}
139+
post {
140+
always {
141+
// Dumps to analyze later
142+
sh 'mkdir -p debug/mysql'
143+
sh 'docker logs $(docker-compose ps --all -q fullstack) > debug/mysql/docker_fullstack.log 2>&1'
144+
sh 'docker logs $(docker-compose ps --all -q stepca) > debug/mysql/docker_stepca.log 2>&1'
145+
sh 'docker logs $(docker-compose ps --all -q pdns) > debug/mysql/docker_pdns.log 2>&1'
146+
sh 'docker logs $(docker-compose ps --all -q pdns-db) > debug/mysql/docker_pdns-db.log 2>&1'
147+
sh 'docker logs $(docker-compose ps --all -q dnsrouter) > debug/mysql/docker_dnsrouter.log 2>&1'
148+
junit 'test/results/junit/*'
149+
sh 'docker-compose down --remove-orphans --volumes -t 30 || true'
170150
}
171151
}
172152
}
@@ -185,30 +165,17 @@ pipeline {
185165
}
186166
stage('Docs / Comment') {
187167
parallel {
188-
stage('Master Docs') {
189-
when {
190-
allOf {
191-
branch 'master'
192-
not {
193-
equals expected: 'UNSTABLE', actual: currentBuild.result
194-
}
195-
}
196-
}
197-
steps {
198-
npmDocsReleaseMaster()
199-
}
200-
}
201-
stage('Develop Docs') {
168+
stage('Docs Job') {
202169
when {
203170
allOf {
204-
branch 'develop'
171+
branch pattern: "^(develop|master)\$", comparator: "REGEXP"
205172
not {
206173
equals expected: 'UNSTABLE', actual: currentBuild.result
207174
}
208175
}
209176
}
210177
steps {
211-
npmDocsReleaseDevelop()
178+
build wait: false, job: 'nginx-proxy-manager-docs', parameters: [string(name: 'docs_branch', value: "$BRANCH_NAME")]
212179
}
213180
}
214181
stage('PR Comment') {
@@ -231,9 +198,8 @@ pipeline {
231198
}
232199
post {
233200
always {
234-
sh 'docker-compose down --remove-orphans --volumes -t 30'
235201
sh 'echo Reverting ownership'
236-
sh 'docker run --rm -v $(pwd):/data jc21/ci-tools chown -R $(id -u):$(id -g) /data'
202+
sh 'docker run --rm -v "$(pwd):/data" jc21/ci-tools chown -R "$(id -u):$(id -g)" /data'
237203
}
238204
success {
239205
juxtapose event: 'success'

README-en.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<img src="https://nginxproxymanager.com/github.png">
33
<br><br>
4-
<img src="https://img.shields.io/badge/version-2.11.2-green.svg?style=for-the-badge">
4+
<img src="https://img.shields.io/badge/version-2.11.3-green.svg?style=for-the-badge">
55
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
66
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
77
</a>

README.md.rej

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
diff a/README.md b/README.md (rejected hunks)
2+
@@ -1,66 +1,35 @@
3+
-<p align="center">
4+
- <img src="https://nginxproxymanager.com/github.png">
5+
- <br><br>
6+
- <img src="https://img.shields.io/badge/version-2.11.3-green.svg?style=for-the-badge">
7+
- <a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
8+
- <img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
9+
- </a>
10+
- <a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
11+
- <img src="https://img.shields.io/docker/pulls/jc21/nginx-proxy-manager.svg?style=for-the-badge">
12+
- </a>
13+
-</p>
14+
-
15+
-This project comes as a pre-built docker image that enables you to easily forward to your websites
16+
-running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.
17+
-
18+
-- [Quick Setup](#quick-setup)
19+
-- [Full Setup](https://nginxproxymanager.com/setup/)
20+
-- [Screenshots](https://nginxproxymanager.com/screenshots/)
21+
-
22+
-## Project Goal
23+
24+
-I created this project to fill a personal need to provide users with an easy way to accomplish reverse
25+
-proxying hosts with SSL termination and it had to be so easy that a monkey could do it. This goal hasn't changed.
26+
-While there might be advanced options they are optional and the project should be as simple as possible
27+
-so that the barrier for entry here is low.
28+
+[Original English README](https://github.com/xiaoxinpro/nginx-proxy-manager-zh/blob/develop-zh/README-en.md)
29+
30+
-<a href="https://www.buymeacoffee.com/jc21" target="_blank"><img src="http://public.jc21.com/github/by-me-a-coffee.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
31+
-
32+
-
33+
-## Features
34+
-
35+
-- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io/)
36+
-- Easily create forwarding domains, redirections, streams and 404 hosts without knowing anything about Nginx
37+
-- Free SSL using Let's Encrypt or provide your own custom SSL certificates
38+
-- Access Lists and basic HTTP Authentication for your hosts
39+
-- Advanced Nginx configuration available for super users
40+
-- User management, permissions and audit log
41+
+<p align="center">
42+
+ <img src="https://nginxproxymanager.com/github.png">
43+
+ <br>
44+
+</p>
45+
46+
+本项目是基于 [NginxProxyManager/nginx-proxy-manager](https://github.com/NginxProxyManager/nginx-proxy-manager) 翻译的中文版本,该项目属于一个预构建的docker映像,它可以让你轻松地部署到你的网站上运行,包括免费的SSL,而不需要知道太多关于 Nginx 或 Let's Encrypt 的信息。
47+
48+
-## Hosting your home network
49+
+![](http://image.xiaoxin.pro/2022/05/16/75687b5bfffbe.png)
50+
51+
-I won't go in to too much detail here but here are the basics for someone new to this self-hosted world.
52+
+## 快速部署
53+
54+
-1. Your home router will have a Port Forwarding section somewhere. Log in and find it
55+
-2. Add port forwarding for port 80 and 443 to the server hosting this project
56+
-3. Configure your domain name details to point to your home, either with a static ip or a service like DuckDNS or [Amazon Route53](https://github.com/jc21/route53-ddns)
57+
-4. Use the Nginx Proxy Manager as your gateway to forward to your other web based services
58+
+### 1. 环境部署
59+
60+
-## Quick Setup
61+
+安装Docker和Docker-compose
62+
63+
-1. Install Docker and Docker-Compose
64+
+- [Docker官方安装文档(英文)](https://docs.docker.com/install/)
65+
+- [Docker-Compose官方安装文档(英文)](https://docs.docker.com/compose/install/)
66+
+- **[Docker和Docker-compose安装文档(中文)](https://blog.csdn.net/zhangzejin3883/article/details/124778945)**
67+
68+
-- [Docker Install documentation](https://docs.docker.com/install/)
69+
-- [Docker-Compose Install documentation](https://docs.docker.com/compose/install/)
70+
+### 2. 创建YAML文件
71+
72+
-2. Create a docker-compose.yml file similar to this:
73+
+创建一个 `docker-compose.yml` 文件:
74+
75+
```yml
76+
-version: '3.8'
77+
+version: '3'
78+
services:
79+
app:
80+
- image: 'docker.io/jc21/nginx-proxy-manager:latest'
81+
- restart: unless-stopped
82+
+ image: 'chishin/nginx-proxy-manager-zh:release'
83+
+ restart: always
84+
ports:
85+
- '80:80'
86+
- '81:81'

backend/internal/certificate.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,8 @@ const internalCertificate = {
861861
logger.info(`Requesting Let'sEncrypt certificates via ${dnsPlugin.name} for Cert #${certificate.id}: ${certificate.domain_names.join(', ')}`);
862862

863863
const credentialsLocation = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
864-
// Escape single quotes and backslashes
865-
const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
866-
const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
864+
fs.mkdirSync('/etc/letsencrypt/credentials', { recursive: true });
865+
fs.writeFileSync(credentialsLocation, certificate.meta.dns_provider_credentials, {mode: 0o600});
867866

868867
// Whether the plugin has a --<name>-credentials argument
869868
const hasConfigArg = certificate.meta.dns_provider !== 'route53';
@@ -898,17 +897,15 @@ const internalCertificate = {
898897
mainCmd = mainCmd + ' --dns-duckdns-no-txt-restore';
899898
}
900899

901-
logger.info('Command:', `${credentialsCmd} && && ${mainCmd}`);
900+
logger.info('Command:', mainCmd);
902901

903902
try {
904-
await utils.exec(credentialsCmd);
905903
const result = await utils.exec(mainCmd);
906904
logger.info(result);
907905
return result;
908906
} catch (err) {
909-
// Don't fail if file does not exist
910-
const delete_credentialsCmd = `rm -f '${credentialsLocation}' || true`;
911-
await utils.exec(delete_credentialsCmd);
907+
// Don't fail if file does not exist, so no need for action in the callback
908+
fs.unlink(credentialsLocation, () => {});
912909
throw err;
913910
}
914911
},

backend/lib/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const generateKeys = () => {
9393
try {
9494
fs.writeFileSync(keysFile, JSON.stringify(keys, null, 2));
9595
} catch (err) {
96-
logger.error('Could not write JWT key pair to config file: ' + keysFile + ': ' . err.message);
96+
logger.error('Could not write JWT key pair to config file: ' + keysFile + ': ' + err.message);
9797
process.exit(1);
9898
}
9999
logger.info('Wrote JWT key pair to config file: ' + keysFile);

backend/setup.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ const setupDefaultUser = () => {
2121
.then((row) => {
2222
if (!row.count) {
2323
// Create a new user and set password
24-
logger.info('Creating a new user: [email protected] with password: changeme');
24+
let email = process.env.INITIAL_ADMIN_EMAIL || '[email protected]';
25+
let password = process.env.INITIAL_ADMIN_PASSWORD || 'changeme';
26+
27+
logger.info('Creating a new user: ' + email + ' with password: ' + password);
2528

2629
let data = {
2730
is_deleted: 0,
28-
31+
email: email,
2932
name: 'Administrator',
3033
nickname: 'Admin',
3134
avatar: '',
@@ -41,7 +44,7 @@ const setupDefaultUser = () => {
4144
.insert({
4245
user_id: user.id,
4346
type: 'password',
44-
secret: 'changeme',
47+
secret: password,
4548
meta: {},
4649
})
4750
.then(() => {

backend/templates/_location.conf

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
location {{ path }} {
2+
{{ advanced_config }}
3+
24
proxy_set_header Host $host;
35
proxy_set_header X-Forwarded-Scheme $scheme;
46
proxy_set_header X-Forwarded-Proto $scheme;
@@ -17,8 +19,5 @@
1719
proxy_set_header Connection $http_connection;
1820
proxy_http_version 1.1;
1921
{% endif %}
20-
21-
22-
{{ advanced_config }}
2322
}
2423

0 commit comments

Comments
 (0)