Skip to content

Commit 6e7435c

Browse files
committed
Initial commit
1 parent dc830df commit 6e7435c

File tree

140 files changed

+19554
-0
lines changed

Some content is hidden

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

140 files changed

+19554
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DS_Store
2+
.idea
3+
._*
4+
manager/node_modules
5+
manager/core*
6+
manager/dist
7+
manager/webpack_stats.html
8+
config/*
9+
letsencrypt/*

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM jc21/nginx-proxy-manager-base
2+
3+
ENV SUPPRESS_NO_CONFIG_WARNING=1
4+
ENV S6_FIX_ATTRS_HIDDEN=1
5+
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf
6+
7+
# root filesystem
8+
COPY rootfs /
9+
10+
# s6 overlay
11+
RUN curl -L -o /tmp/s6-overlay-amd64.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-amd64.tar.gz" \
12+
&& tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
13+
14+
# App
15+
ENV NODE_ENV=production
16+
17+
#ADD LICENCE /srv/manager/LICENCE
18+
#ADD README.md /srv/manager/README.md
19+
ADD manager/dist /srv/manager/dist
20+
ADD manager/node_modules /srv/manager/node_modules
21+
ADD manager/src/backend /srv/manager/src/backend
22+
ADD manager/package.json /srv/manager/package.json
23+
24+
# Volumes
25+
VOLUME [ "/config", "/etc/letsencrypt" ]
26+
CMD [ "/init" ]
27+
28+
HEALTHCHECK --interval=15s --timeout=3s CMD curl -f http://localhost:9876/health || exit 1

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
![Nginx Proxy Manager](https://public.jc21.com/nginx-proxy-manager/github.png "Nginx Proxy Manager")
2+
3+
# Nginx Proxy Manager
4+
5+
![Build Status](http://bamboo.jc21.com/plugins/servlet/wittified/build-status/AB-NPM)
6+
7+
This NPM comes as a pre-built docker image that enables you to easily forward to your websites
8+
running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.
9+
10+
11+
## Features
12+
13+
- Clean and simple interface
14+
- Create an unlimited number of hosts and forward them to any IPv4/Port combination running HTTP
15+
- Secure your sites with SSL and optionally force SSL
16+
- Secure your sites with Basic HTTP Authentication Access Lists
17+
- Advanced Nginx config option for super users
18+
19+
20+
## Getting started
21+
22+
### Method 1: Using docker-compose
23+
24+
By far the easiest way to get up and running. Create this `docker-compose.yml`
25+
26+
```yml
27+
version: "2"
28+
services:
29+
app:
30+
image: jc21/nginx-proxy-manager
31+
restart: always
32+
ports:
33+
- 80:80
34+
- 81:81
35+
- 443:443
36+
volumes:
37+
- ./config:/config
38+
- ./letsencrypt:/etc/letsencrypt
39+
```
40+
41+
Then:
42+
43+
```bash
44+
docker-compose up -d
45+
```
46+
47+
48+
### Method 2: Using vanilla docker
49+
50+
```bash
51+
docker run -d \
52+
-p 80:80 \
53+
-p 81:81 \
54+
-p 443:443 \
55+
-v /path/to/config:/config \
56+
-v /path/to/letsencrypt:/etc/letsencrypt \
57+
--restart always \
58+
jc21/nginx-proxy-manager
59+
```
60+
61+
62+
## Administration
63+
64+
Now that your docker container is running, connect to it on port `81` for the admin interface.
65+
66+
[http://localhost:81](http://localhost:81)
67+
68+
There is no authentication on this interface to keep things simple. It is expected that you would not
69+
expose port 81 to the outside world.
70+
71+
From here, the rest should be self explanatory.
72+
73+
Note: Requesting SSL Certificates won't work until this project is accessible from the outside world, as explained below.
74+
75+
76+
## Hosting your home network
77+
78+
I won't go in to too much detail here but here are the basics for someone new to this self-hosted world.
79+
80+
1. Your home router will have a Port Forwarding section somewhere. Log in and find it
81+
2. Add port forwarding for port 80 and 443 to the server hosting this project
82+
3. Configure your domain name details to point to your home, either with a static ip or a service like DuckDNS
83+
4. Use the NPM here as your gateway to forward to your other web based services
84+
85+
86+
## Screenshots
87+
88+
[![Screenshot](https://public.jc21.com/nginx-proxy-manager/npm-1-sm.jpg "Screenshot")](https://public.jc21.com/nginx-proxy-manager/npm-1.jpg)
89+
[![Screenshot](https://public.jc21.com/nginx-proxy-manager/npm-2-sm.jpg "Screenshot")](https://public.jc21.com/nginx-proxy-manager/npm-2.jpg)
90+
[![Screenshot](https://public.jc21.com/nginx-proxy-manager/npm-3-sm.jpg "Screenshot")](https://public.jc21.com/nginx-proxy-manager/npm-3.jpg)
91+
[![Screenshot](https://public.jc21.com/nginx-proxy-manager/npm-4-sm.jpg "Screenshot")](https://public.jc21.com/nginx-proxy-manager/npm-4.jpg)
92+
93+
## TODO
94+
95+
- Pass on human readable ssl cert errors to the ui
96+
- Allow a host to be a redirection to another domain
97+
- Allow a host to return immediate 404's
98+
- UI: Allow column sorting on tables
99+
- UI: Allow filtering hosts by types
100+
- Advanced option to overwrite the default location block (or regex to do it automatically)
101+
- Change the renew ssl process to use the letsencrypt renew procedure so as to avoid rate limits

bin/gulp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
if hash realpath 2>/dev/null; then
5+
export CODEBASE=$(realpath $SCRIPT_DIR/..)
6+
elif hash grealpath 2>/dev/null; then
7+
export CODEBASE=$(grealpath $SCRIPT_DIR/..)
8+
else
9+
export CODEBASE=$(readlink -e $SCRIPT_DIR/..)
10+
fi
11+
12+
if [ -z "$CODEBASE" ]; then
13+
echo "Unable to determine absolute codebase directory"
14+
exit 1
15+
fi
16+
17+
cd "$CODEBASE"
18+
19+
docker-compose run --no-deps --rm -w /srv/manager app gulp $@
20+
exit $?

bin/npm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
if hash realpath 2>/dev/null; then
5+
export CODEBASE=$(realpath $SCRIPT_DIR/..)
6+
elif hash grealpath 2>/dev/null; then
7+
export CODEBASE=$(grealpath $SCRIPT_DIR/..)
8+
else
9+
export CODEBASE=$(readlink -e $SCRIPT_DIR/..)
10+
fi
11+
12+
if [ -z "$CODEBASE" ]; then
13+
echo "Unable to determine absolute codebase directory"
14+
exit 1
15+
fi
16+
17+
cd "$CODEBASE"
18+
19+
docker-compose run --no-deps --rm -w /srv/manager app npm $@
20+
exit $?

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "2"
2+
services:
3+
app:
4+
image: jc21/nginx-proxy-manager
5+
ports:
6+
- 80:80
7+
- 81:81
8+
- 443:443
9+
environment:
10+
- NODE_ENV=development
11+
volumes:
12+
- ./config:/config
13+
- ./letsencrypt:/etc/letsencrypt
14+
- ./manager:/srv/manager

manager/gulpfile.js

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/*jshint node:true */
2+
3+
'use strict';
4+
5+
const path = require('path');
6+
const gulp = require('gulp');
7+
const gutil = require('gulp-util');
8+
const concat = require('gulp-concat-util');
9+
const runSequence = require('run-sequence');
10+
const webpack = require('webpack-stream');
11+
const imagemin = require('gulp-imagemin');
12+
const del = require('del');
13+
const bump = require('gulp-bump');
14+
const sass = require('gulp-sass');
15+
const ejs = require('gulp-ejs');
16+
const PACKAGE = require('./package.json');
17+
18+
const assets = {
19+
views: {
20+
watch: 'src/frontend/views/**/*.ejs',
21+
src: 'src/frontend/views/*.ejs',
22+
dest: 'dist/'
23+
},
24+
fonts: {
25+
watch: 'src/frontend/fonts/**/*.{ttf,woff,woff2,eof,eot,svg,otf}',
26+
dest: 'dist/fonts'
27+
},
28+
images: {
29+
watch: 'src/frontend/images/**/*.{png,jpg,gif}',
30+
dest: 'dist/images'
31+
},
32+
scss: {
33+
watch: 'src/frontend/scss/**/*.scss',
34+
loadPath: 'src/frontend/scss',
35+
src: 'src/frontend/scss/styles.scss',
36+
dest: 'dist/css'
37+
},
38+
js: {
39+
watch: 'src/frontend/js/**/*',
40+
src: 'src/frontend/js/main.js',
41+
dest: 'dist/js/'
42+
}
43+
};
44+
45+
/**
46+
* @param color
47+
* @param label
48+
* @returns {Function}
49+
*/
50+
function logger (color, label) {
51+
return function () {
52+
let args = Array.prototype.slice.call(arguments);
53+
args.unshift(gutil.colors[color].bold(label.toUpperCase() + ':'));
54+
gutil.log.apply(null, args);
55+
};
56+
}
57+
58+
gutil.error = logger('red', 'error');
59+
gutil.warn = logger('yellow', 'warn');
60+
gutil.notice = logger('white', 'notice');
61+
62+
/**
63+
* @param err
64+
*/
65+
function handleError (err) {
66+
gutil.error(err.stack);
67+
}
68+
69+
/*****************************
70+
TASKS
71+
******************************/
72+
73+
/**
74+
* clean
75+
*/
76+
gulp.task('clean', function (cb) {
77+
del(['./dist/*'])
78+
.then(function () {
79+
cb();
80+
})
81+
.catch(handleError);
82+
});
83+
84+
/**
85+
* images
86+
*/
87+
gulp.task('images', function () {
88+
if (process.arch !== 'arm') {
89+
return gulp.src(assets.images.watch)
90+
.pipe(imagemin({
91+
optimizationLevel: 7
92+
}))
93+
.pipe(gulp.dest(assets.images.dest))
94+
.on('error', handleError);
95+
} else {
96+
return gulp.src(assets.images.watch)
97+
.pipe(gulp.dest(assets.images.dest))
98+
.on('error', handleError);
99+
}
100+
});
101+
102+
/**
103+
* fonts
104+
*/
105+
gulp.task('fonts', function () {
106+
return gulp.src(assets.fonts.watch)
107+
.pipe(gulp.dest(assets.fonts.dest))
108+
.on('error', handleError);
109+
});
110+
111+
/**
112+
* scss
113+
*/
114+
gulp.task('scss', function () {
115+
return gulp.src(assets.scss.src)
116+
.pipe(sass().on('error', sass.logError))
117+
.pipe(concat.header('@import url(\'https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700\');@import url(\'https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700|Roboto+Condensed:300,400,700\');'))
118+
.pipe(gulp.dest(path.resolve(assets.scss.dest)));
119+
});
120+
121+
/**
122+
* js
123+
*/
124+
gulp.task('js', function () {
125+
return gulp.src(assets.js.src)
126+
.pipe(webpack(require('./webpack.config.js')))
127+
.pipe(gulp.dest(assets.js.dest))
128+
.on('error', handleError);
129+
});
130+
131+
/**
132+
* views
133+
*/
134+
gulp.task('views', function () {
135+
return gulp.src(assets.views.src)
136+
.pipe(ejs({
137+
version: PACKAGE.version
138+
}, {}, {
139+
ext: '.html'
140+
}))
141+
.on('error', handleError)
142+
.pipe(gulp.dest(assets.views.dest));
143+
});
144+
145+
/**
146+
* bump
147+
*/
148+
gulp.task('bump', function () {
149+
gulp.src('./package.json')
150+
.pipe(bump({type: 'version'}))
151+
.pipe(gulp.dest('./'));
152+
});
153+
154+
/**
155+
* build
156+
*/
157+
gulp.task('build', function (cb) {
158+
runSequence('clean', ['images', 'fonts', 'scss', 'js', 'views'], cb);
159+
});
160+
161+
/**
162+
* default
163+
*/
164+
gulp.task('default', ['build'], function () {
165+
gulp.watch(assets.scss.watch, ['scss']);
166+
gulp.watch(assets.images.watch, ['images']);
167+
gulp.watch(assets.fonts.watch, ['fonts']);
168+
gulp.watch(assets.js.watch, ['js']);
169+
gulp.watch(assets.views.watch, ['views']);
170+
gulp.watch('./webpack.config.js', ['js']);
171+
});

0 commit comments

Comments
 (0)