Compare commits
No commits in common. "4581e65109d3517cd6f50abcc31f13be93345a78" and "fda16a4744f8e61b50d419e266e055e64b8c1227" have entirely different histories.
4581e65109
...
fda16a4744
3 changed files with 16 additions and 9 deletions
|
@ -1,10 +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
|
|
||||||
|
|
||||||
RUN apk add --no-cache git python3
|
RUN apk add --no-cache git python3
|
||||||
RUN git clone https://git.adrianux.net/ahoemann/Adrianux.net.git /opt
|
RUN git clone https://git.adrianux.net/ahoemann/Adrianux.net.git /opt
|
||||||
RUN python3 -m venv /opt/.venv
|
RUN python3 -m venv /opt/.venv
|
||||||
|
@ -13,4 +9,4 @@ RUN apk del git
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD [ "/opt/.venv/bin/waitress-serve", "--listen=0.0.0.0:8080", "app:app" ]
|
CMD [ "/opt/.venv/bin/waitress-serve", "--listen=0.0.0.0:8080", "app:app" ]
|
5
adrianux.toml
Normal file
5
adrianux.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[site]
|
||||||
|
git_url=https://git.adrianux.net
|
||||||
|
website_url=https://adrianux.net
|
||||||
|
[mode]
|
||||||
|
debug_mode=False
|
14
app.py
14
app.py
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from flask import Flask, render_template, redirect, url_for
|
from flask import Flask, render_template, redirect, url_for
|
||||||
import requests
|
import requests
|
||||||
import os
|
import configparser
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -19,8 +20,8 @@ def homepage():
|
||||||
|
|
||||||
@app.route("/monitoring")
|
@app.route("/monitoring")
|
||||||
def monitoring():
|
def monitoring():
|
||||||
git_url = os.environ['GIT_URL']
|
git_url = parser("site", "git_url")
|
||||||
website_url = os.environ['WEBSITE_URL']
|
website_url = parser("site", "website_url")
|
||||||
return render_template("monitoring.html", git_status = get_status(git_url), website_status = get_status(website_url) )
|
return render_template("monitoring.html", git_status = get_status(git_url), website_status = get_status(website_url) )
|
||||||
|
|
||||||
def get_status_code(link):
|
def get_status_code(link):
|
||||||
|
@ -37,6 +38,11 @@ def get_status(link):
|
||||||
except:
|
except:
|
||||||
return "OFFLINE"
|
return "OFFLINE"
|
||||||
|
|
||||||
|
def parser(section, attribute):
|
||||||
|
config = configparser.RawConfigParser()
|
||||||
|
config.read("./adrianux.toml")
|
||||||
|
return config.get(section, attribute)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
mode = os.environ['DEBUG_MODE']
|
mode = parser("mode","debug_mode")
|
||||||
app.run(debug=mode)
|
app.run(debug=mode)
|
||||||
|
|
Loading…
Reference in a new issue