UI - basic read fixes

This commit is contained in:
bunkerity 2020-12-11 17:03:43 +01:00
parent e6b5f460c9
commit 3a3d527907
No known key found for this signature in database
GPG Key ID: 654FFF51CEF7CC47
8 changed files with 36 additions and 21 deletions

View File

@ -71,6 +71,9 @@ http {
# resolvers to use
resolver %DNS_RESOLVERS% ipv6=off;
# remove ports when sending redirects
port_in_redirect off;
# lua path and dicts
lua_package_path "/usr/local/lib/lua/?.lua;;";
%WHITELIST_IP_CACHE%

View File

@ -16,7 +16,7 @@ if [ "$MULTISITE" = "yes" ] ; then
for server in $servers ; do
SERVER_PREFIX="/etc/nginx/${server}/"
if grep "/etc/letsencrypt/live" ${SERVER_PREFIX}https.conf > /dev/null && [ ! -f /etc/letsencrypt/live/${server}/fullchain.pem ] ; then
/opt/scripts/certbot-new.sh "$1" "$(cat ${SERVER_PREFIX}email-lets-encrypt.txt)"
/opt/scripts/certbot-new.sh "$server" "$(cat ${SERVER_PREFIX}email-lets-encrypt.txt)"
fi
if grep "modsecurity.conf" ${SERVER_PREFIX}server.conf > /dev/null ; then
modsec_custom=""

View File

@ -13,21 +13,20 @@ services:
- ./web-files:/www:ro
- autoconf:/etc/nginx
environment:
- SERVER_NAME=admin.domain.com # replace with your domain
- SERVER_NAME=admin.website.com # replace with your domain
- MULTISITE=yes
- AUTO_LETS_ENCRYPT=yes
- REDIRECT_HTTP_TO_HTTPS=yes
- DISABLE_DEFAULT_SERVER=yes
- USE_CLIENT_CACHE=yes
- USE_GZIP=yes
- USE_BROTLI=yes
- admin.domain.com_SERVE_FILES=no
- admin.domain.com_USE_AUTH_BASIC=yes
- admin.domain.com_AUTH_BASIC_USER=admin # change it to something hard to guess
- admin.domain.com_AUTH_BASIC_PASSWORD=admin # change it to something hard to guess
- admin.domain.com_USE_REVERSE_PROXY=yes
- admin.domain.com_REVERSE_PROXY_URL=/admin/ # change it to something hard to guess
- admin.domain.com_REVERSE_PROXY_HOST=http://myui:5000/
- admin.website.com_SERVE_FILES=no
- admin.website.com_USE_AUTH_BASIC=yes
- admin.website.com_AUTH_BASIC_USER=admin # change it to something hard to guess
- admin.website.com_AUTH_BASIC_PASSWORD=admin # change it to something hard to guess
- admin.website.com_USE_REVERSE_PROXY=yes
- admin.website.com_REVERSE_PROXY_URL=/admin/ # change it to something hard to guess
- admin.website.com_REVERSE_PROXY_HOST=http://myui:5000/
labels:
- "bunkerized-nginx.UI"
@ -37,3 +36,8 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- autoconf:/etc/nginx
environment:
- ABSOLUTE_URI=https://admin.website.com/admin/ # change it to your full URI
volumes:
autoconf:

View File

@ -1,12 +1,19 @@
#!/usr/bin/python3
from flask import Flask, render_template
from flask import Flask, render_template, current_app
import wrappers
import os
app = Flask(__name__, static_url_path="/", static_folder="static", template_folder="templates")
ABSOLUTE_URI = ""
if "ABSOLUTE_URI" in os.environ :
ABSOLUTE_URI = os.environ["ABSOLUTE_URI"]
app.config["ABSOLUTE_URI"] = ABSOLUTE_URI
@app.route('/')
@app.route('/home')
def home():
check, instances = wrappers.get_instances()
if not check :
@ -17,14 +24,14 @@ def home():
return render_template("home.html", title="Home", instances_number=len(instances), services_number=len(services))
@app.route('/instances')
def home():
def instances():
check, instances = wrappers.get_instances()
if not check :
return render_template("error.html", title="Error", error=instances)
return render_template("instances.html", title="Instances", instances=instances)
@app.route('/services')
def home():
def services():
check, services = wrappers.get_services()
if not check :
return render_template("error.html", title="Error", error=services)

View File

@ -13,5 +13,5 @@
}
main > .container {
padding: 60px 15px 0;
padding: 100px 15px 0;
}

View File

@ -1 +1 @@
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>

View File

@ -1,10 +1,11 @@
<head>
<base href="{{ config["ABSOLUTE_URI"] }}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="bunkerized-nginx user interface">
<meta name="author" content="bunkerity">
<title>{{ title }}</title>
<title>bunkerized-nginx-ui - {{ title }}</title>
<!-- TODO : favicon -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
</head>

View File

@ -8,13 +8,13 @@
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
<a class="nav-link" href="home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/instances">Instances</a>
<a class="nav-link" href="instances">Instances</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/services">Services</a>
<a class="nav-link" href="services">Services</a>
</li>
</ul>
</div>