remove: monitoring(replaced by statping-ng); fix: template naming
This commit is contained in:
parent
053b573758
commit
341b725d5f
7 changed files with 6 additions and 45 deletions
|
@ -1,8 +1,6 @@
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
WORKDIR /opt/
|
WORKDIR /opt/
|
||||||
|
|
||||||
ENV GIT_URL=https://git.adrianux.net
|
|
||||||
ENV WEBSITE_URL=https://adrianux.net
|
|
||||||
ENV DEBUG_MODE=False
|
ENV DEBUG_MODE=False
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
34
app.py
34
app.py
|
@ -10,43 +10,15 @@ 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():
|
|
||||||
global git_status
|
|
||||||
global website_status
|
|
||||||
executor = ThreadPoolExecutor(2)
|
|
||||||
executor.submit(monitor)
|
|
||||||
return render_template("monitoring.html", git_status = git_status, website_status = website_status)
|
|
||||||
|
|
||||||
|
|
||||||
def get_status(link):
|
|
||||||
requested_site = requests.get(link)
|
|
||||||
status_code = requested_site.status_code
|
|
||||||
try:
|
|
||||||
match status_code:
|
|
||||||
case 200:
|
|
||||||
return "ONLINE"
|
|
||||||
case _:
|
|
||||||
return "ERROR"
|
|
||||||
except:
|
|
||||||
return "OFFLINE"
|
|
||||||
|
|
||||||
def monitor():
|
|
||||||
while True:
|
|
||||||
git_status = get_status(os.environ['GIT_URL'])
|
|
||||||
website_status = get_status(os.environ['WEBSITE_URL'])
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.j2" %}
|
||||||
{% block title %}About{% endblock %}
|
{% block title %}About{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.j2" %}
|
||||||
{% block title %}Homepage{% endblock %}
|
{% block title %}Homepage{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.js" %}
|
||||||
{% 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
Reference in a new issue