Compare commits
55 commits
Author | SHA1 | Date | |
---|---|---|---|
ec4edea536 | |||
4f882b8dad | |||
0ba3df6778 | |||
1b5dd6e7d5 | |||
251b1c8a0b | |||
1236a024ef | |||
a76cbd86f0 | |||
7e5819f8b8 | |||
2186a11e4a | |||
e3afb17d07 | |||
4dc4e78572 | |||
44cd8886f7 | |||
c2591e8432 | |||
0704dc6ba3 | |||
f6db4212fd | |||
50552d7245 | |||
0fd8db9749 | |||
40306538ba | |||
d74916f2c7 | |||
77508a984e | |||
6750c17306 | |||
4b5a9fc9c6 | |||
20b4a54a67 | |||
d8c836d212 | |||
70eb980887 | |||
cff6024fde | |||
341b725d5f | |||
053b573758 | |||
bdb8898adc | |||
dec236e2f9 | |||
06bb092b37 | |||
e1e1584214 | |||
4253e606eb | |||
38b91d6fc9 | |||
eff59303bf | |||
c001c5f0b8 | |||
ee4c6978e6 | |||
c9d61cd9fb | |||
fa730cac1b | |||
2b6885055b | |||
95d6497e93 | |||
e034601337 | |||
![]() |
e9b32af7c7 | ||
4581e65109 | |||
![]() |
4f73502d00 | ||
![]() |
a6aae99ed0 | ||
![]() |
fda16a4744 | ||
![]() |
546a5ab34c | ||
![]() |
eb0f406a51 | ||
b75e83c6c1 | |||
b39983777b | |||
c2bb0cc6cc | |||
4d2fe89cd5 | |||
80a0affc4b | |||
4c76eb3f1b |
13 changed files with 93 additions and 69 deletions
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.forgejo
|
||||||
|
*compose.yml
|
||||||
|
Dockerfile
|
||||||
|
.git*
|
||||||
|
Jenkinsfile
|
||||||
|
LICENSE
|
||||||
|
README.md
|
1
.env.example
Normal file
1
.env.example
Normal file
|
@ -0,0 +1 @@
|
||||||
|
DEBUG_MODE=False
|
|
@ -1,7 +0,0 @@
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
update:
|
|
||||||
runs-on: self-hosted
|
|
||||||
steps:
|
|
||||||
- run: sudo git -C /opt/Adrianux.net/ pull
|
|
||||||
- run: sudo systemctl restart adrianux
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
.venv
|
.venv*
|
||||||
|
.env
|
||||||
__pycache__
|
__pycache__
|
||||||
|
*theia-workspace
|
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
WORKDIR /opt/
|
||||||
|
|
||||||
|
ENV DEBUG_MODE=False
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN apk add --no-cache python3 py3-flask py3-waitress
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=5m CMD wget --delete-after http://localhost:8080
|
||||||
|
|
||||||
|
CMD [ "waitress-serve", "--listen=0.0.0.0:8080", "app:app" ]
|
61
README.md
61
README.md
|
@ -1,37 +1,62 @@
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
|
|
||||||
## Setting up the environment
|
## Setting up the environment
|
||||||
|
|
||||||
1. Create a virtual environment:
|
1. Create a virtual environment:
|
||||||
```bash
|
|
||||||
|
```sh
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Activate the virtual environment:
|
2. Activate the virtual environment:
|
||||||
```bash
|
|
||||||
|
```sh
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install dependencies:
|
3. Install dependencies:
|
||||||
```bash
|
|
||||||
|
```sh
|
||||||
pip install requirements.txt
|
pip install requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
```systemd
|
4. Set the environment variables:
|
||||||
# /etc/systemd/system/adrianux.service
|
|
||||||
[Unit]
|
|
||||||
Description=WSGI app
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
```sh
|
||||||
Type=simple
|
export DEBUGMODE=False
|
||||||
User=adrianux
|
|
||||||
WorkingDirectory=/opt/Adrianux.net
|
|
||||||
ExecStart=/opt/Adrianux.net/.venv/bin/waitress-serve --listen=127.0.0.1:8080 app:app
|
|
||||||
Restart=always
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or source the .env file:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cp .env.example .env # change the variables to suit your environment as needed
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
. .env
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run the app:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
waitress-serve --listen=0.0.0.0:8080 app:app
|
||||||
|
```
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
|
||||||
|
## Building the container
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t adrianux:latest .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the container
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run adrianux:latest
|
||||||
|
```
|
||||||
|
# Docker Compose
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker compose up adrianux
|
||||||
|
```
|
||||||
|
|
31
app.py
31
app.py
|
@ -1,39 +1,22 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from flask import Flask, render_template, redirect, url_for
|
from flask import Flask, render_template, url_for
|
||||||
import requests
|
import os
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route("/imprint")
|
@app.route("/imprint")
|
||||||
def root():
|
def root():
|
||||||
return render_template("imprint.html")
|
return render_template("imprint.j2")
|
||||||
|
|
||||||
@app.route("/about")
|
@app.route("/about")
|
||||||
def about():
|
def about():
|
||||||
return render_template("about.html")
|
return render_template("about.j2")
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def homepage():
|
def homepage():
|
||||||
return render_template("homepage.html")
|
return render_template("homepage.j2")
|
||||||
|
|
||||||
@app.route("/monitoring")
|
|
||||||
def monitoring():
|
|
||||||
git_status = get_status("https://git.adrianux.net")
|
|
||||||
website_status = get_status("https://adrianux.net")
|
|
||||||
return render_template("monitoring.html", git_status = git_status, website_status = website_status )
|
|
||||||
|
|
||||||
def get_status_code(link):
|
|
||||||
requested_site = requests.get(link)
|
|
||||||
return requested_site.status_code
|
|
||||||
|
|
||||||
def get_status(link):
|
|
||||||
match get_status_code(link):
|
|
||||||
case 200:
|
|
||||||
return "ONLINE"
|
|
||||||
case 500:
|
|
||||||
return "ERROR"
|
|
||||||
case _:
|
|
||||||
return "OFFLINE"
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=False)
|
app.run(debug=os.environ['DEBUG_MODE'])
|
||||||
|
|
7
docker-compose.yml
Normal file
7
docker-compose.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
container_name: "adrianux"
|
||||||
|
image: "git.adrianux.net/ahoemann/adrianux.net:1.2.0"
|
||||||
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:8080:8080"
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.j2" %}
|
||||||
{% block title %}About{% endblock %}
|
{% block title %}About{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<p>Languages: German, English</p>
|
<p>Languages: German, English</p>
|
||||||
<p>Programming languages: Python, Bash, POSIX Shell, Powershell</p>
|
<p>Programming languages: Python, Bash, POSIX Shell, Powershell</p>
|
||||||
<p>Markup languages: HTML, MD</p>
|
<p>Markup languages: HTML, MD</p>
|
||||||
<p>Structure languages: JSON, XML, YAML, TOML</p>
|
<p>Structure languages: JSON, XML, YAML, TOML, Jinja2</p>
|
||||||
<p>Query languages: SQL(MariaDB, SQLite3)</p>
|
<p>Query languages: SQL(MariaDB, SQLite3)</p>
|
||||||
<p>Services managed: SSH, DNS, DHCP, AD, PF, UFW, NF-Tables,
|
<p>Services managed: SSH, DNS, DHCP, AD, PF, UFW, NF-Tables,
|
||||||
RDP(XRDP, Microsoft RDP), Webserver(Apache24, Nginx, OpenBSD-httpd,
|
RDP(XRDP, Microsoft RDP), Webserver(Apache24, Nginx, OpenBSD-httpd,
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" data-theme="light">
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
@ -14,8 +14,9 @@
|
||||||
<li><a href="/">Homepage</a></li>
|
<li><a href="/">Homepage</a></li>
|
||||||
<li><a href="imprint">Imprint</a></li>
|
<li><a href="imprint">Imprint</a></li>
|
||||||
<li><a href="about">About</a></li>
|
<li><a href="about">About</a></li>
|
||||||
<li><a href="monitoring">Monitoring</a></li>
|
<li><a href="https://cloud.adrianux.net">Monitoring</a></li>
|
||||||
<li><a href="https://git.adrianux.net/ahoemann">Git</a></li>
|
<li><a href="https://git.adrianux.net/explore/repos">Git</a></li>
|
||||||
|
<li><a href="https://bin.adrianux.net">Bin</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<body>
|
<body>
|
||||||
|
@ -25,8 +26,8 @@
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
<p><a href="mailto:ahoemann@proton.me">ahoemann@proton.me</a></p>
|
<p><a href="mailto:ahoemann@proton.me">ahoemann@proton.me</a>
|
||||||
© Copyright 2024 by <a href="https://adrianux.net/">Adrian Hoemann</a>.
|
</p>Authored by <a href="https://adrianux.net/">Adrian Hoemann</a>.
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,9 +1,9 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.j2" %}
|
||||||
{% block title %}Homepage{% endblock %}
|
{% block title %}Homepage{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>This is Adrian's homepage, checkout his running services and their state <a href="monitoring">here</a></p>
|
<p>This is Adrian's homepage, checkout his running services and their state <a href="https://cloud.adrianux.net">here</a></p>
|
||||||
<p>Yes, Adrian is refering to himself in the third person.</p>
|
<p>Yes, Adrian is refering to himself in the third person.</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.j2" %}
|
||||||
{% block title %}Imprint{% endblock %}
|
{% block title %}Imprint{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
|
@ -1,9 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
{% block title %}Monitoring{% endblock %}
|
|
||||||
{% block head %}
|
|
||||||
{{ super() }}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content %}
|
|
||||||
<p>Git status: {{ git_status }}</p>
|
|
||||||
<p>Website status: {{ website_status }}</p>
|
|
||||||
{% endblock %}
|
|
Loading…
Add table
Add a link
Reference in a new issue