mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-01-22 00:41:07 +01:00
[deploy] Add support for bare metal installation and document the same
This commit is contained in:
25
.env.sample
Normal file
25
.env.sample
Normal file
@@ -0,0 +1,25 @@
|
||||
# General variables
|
||||
TZ="UTC"
|
||||
COLOR="blue-grey"
|
||||
HS_SERVER=http://localhost:8080
|
||||
KEY="GenerateYourOwnRandomKey"
|
||||
SCRIPT_NAME=/admin
|
||||
DOMAIN_NAME=http://localhost:8080
|
||||
AUTH_TYPE="Basic"
|
||||
LOG_LEVEL="Debug"
|
||||
|
||||
# BasicAuth variables
|
||||
BASIC_AUTH_USER="admin"
|
||||
BASIC_AUTH_PASS="admin"
|
||||
|
||||
# Flask OIDC Variables
|
||||
OIDC_AUTH_URL=https://localhost:8080
|
||||
OIDC_CLIENT_ID=Headscale-WebUI
|
||||
OIDC_CLIENT_SECRET=secret
|
||||
|
||||
# About section on the Settings page
|
||||
GIT_COMMIT=""
|
||||
GIT_BRANCH=""
|
||||
APP_VERSION=""
|
||||
BUILD_DATE=""
|
||||
HS_VERSION=""
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
__pycache__
|
||||
.venv
|
||||
poetry.lock
|
||||
.env
|
||||
poetry.lock
|
||||
|
||||
25
SETUP.md
25
SETUP.md
@@ -5,11 +5,32 @@
|
||||
* Containers are published to [GHCR](https://github.com/users/iFargle/packages/container/package/headscale-webui) and [Docker Hub](https://hub.docker.com/r/ifargle/headscale-webui)
|
||||
|
||||
# Contents
|
||||
* [Bare Metal](#bare-metal)
|
||||
* [Docker Compose](#docker-compose)
|
||||
* [Reverse Proxies](#reverse-proxies)
|
||||
* [Authentication](#authentication)
|
||||
|
||||
---
|
||||
# Bare Metal
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
```bash
|
||||
# Debian/Ubuntu
|
||||
apt install gcc python3-poetry --yes
|
||||
poetry install --only main
|
||||
```
|
||||
|
||||
2. Configurations: rename `.env.sample` -> `.env` and edit `.env` as per your requirements.
|
||||
|
||||
3. Run server
|
||||
|
||||
```bash
|
||||
poetry run gunicorn -b 0.0.0.0:5000 server:app
|
||||
```
|
||||
|
||||
That's it. Cheers.
|
||||
|
||||
# Docker Compose
|
||||
## Environment Settings
|
||||
* `TZ` - Set this to your current timezone. Example: `Asia/Tokyo`
|
||||
@@ -81,7 +102,7 @@ https://[DOMAIN] {
|
||||
reverse_proxy * [HS_SERVER]
|
||||
}
|
||||
```
|
||||
* Example:
|
||||
* Example:
|
||||
```
|
||||
https://example.com {
|
||||
reverse_proxy /admin* http://headscale-webui:5000
|
||||
@@ -90,7 +111,7 @@ https://example.com {
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
---
|
||||
# Authentication
|
||||
*If your OIDC provider isn't listed or doesn't work, please open up a [new issue](https://github.com/iFargle/headscale-webui/issues/new) and it will be worked on.*
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ from cryptography.fernet import Fernet
|
||||
from datetime import timedelta, date
|
||||
from dateutil import parser
|
||||
from flask import Flask
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
LOG_LEVEL = os.environ["LOG_LEVEL"].replace('"', '').upper()
|
||||
# Initiate the Flask application and logging:
|
||||
app = Flask(__name__, static_url_path="/static")
|
||||
|
||||
@@ -18,6 +18,7 @@ pyuwsgi = "^2.0.21"
|
||||
gunicorn = "^20.1.0"
|
||||
flask-basicauth = "^0.2.0"
|
||||
flask-providers-oidc = "^1.2.1"
|
||||
python-dotenv = "^1.0.0"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ from flask import Flask, escape, Markup, redirect, rende
|
||||
from dateutil import parser
|
||||
from flask_executor import Executor
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
# Global vars
|
||||
# Colors: https://materializecss.com/color.html
|
||||
COLOR = os.environ["COLOR"].replace('"', '').lower()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<i class="material-icons prefix">vpn_key</i>
|
||||
<input id="api_key" type="password">
|
||||
<label for="api_key">API Key</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<a href="#test_modal" class="modal-trigger" onclick="save_key()">Save</a>
|
||||
@@ -57,6 +57,7 @@
|
||||
<li>To generate your API key, run the command <a class="{{ COLOR_BTN }} white-text">headscale apikeys create</a> on your control server. Once you generate your first key, this UI will automatically renew the key near expiration.</li>
|
||||
<li>The Headscale server is configured via the <a class="{{ COLOR_BTN }} white-text">HS_SERVER</a> environment variable in Docker. Current server: <a class="{{ COLOR_BTN }} white-text"> {{url}} </a></li>
|
||||
<li>You must configure an encryption key via the <a class="{{ COLOR_BTN }} white-text">KEY</a> environment variable in Docker. One can be generated with the command <a class="{{ COLOR_BTN }} white-text">openssl rand -base64 32</a></li>
|
||||
<li>Enter the API key generated by headscale, press "Save" then "Test". Saving before using the "Test" button is important.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -81,4 +82,4 @@
|
||||
<a href="#!" class="modal-close btn-flat">Close</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user