Compare commits

...

16 commits

Author SHA1 Message Date
2b6885055b fix: syntax
All checks were successful
/ update (push) Successful in 1s
2025-01-23 07:17:21 +00:00
95d6497e93 add: removed caching from pip install
All checks were successful
/ update (push) Successful in 1s
2025-01-23 07:16:57 +00:00
e034601337 Merge pull request 'docs: updated README' (#8) from env into master
All checks were successful
/ update (push) Successful in 1s
Reviewed-on: #8
2025-01-21 11:31:34 +00:00
ahoemann
e9b32af7c7 docs: updated README
All checks were successful
/ update (push) Successful in 1s
2025-01-21 12:30:02 +01:00
4581e65109 Merge pull request 'env' (#7) from env into master
All checks were successful
/ update (push) Successful in 0s
Reviewed-on: #7
2025-01-17 07:37:29 +00:00
ahoemann
4f73502d00 fix: set default environment variables names
All checks were successful
/ update (push) Successful in 0s
2025-01-17 08:35:14 +01:00
ahoemann
a6aae99ed0 feat: set urls via environment variables; removed: configuration parser
All checks were successful
/ update (push) Successful in 0s
2025-01-17 08:29:25 +01:00
ahoemann
fda16a4744 fix: removed Copywrite symbol
All checks were successful
/ update (push) Successful in 0s
2025-01-16 12:38:13 +01:00
ahoemann
546a5ab34c fix: removed Copywrite
All checks were successful
/ update (push) Successful in 0s
2025-01-16 12:36:53 +01:00
ahoemann
eb0f406a51 fix: removed quotation in productive configuration
All checks were successful
/ update (push) Successful in 0s
2025-01-16 12:30:37 +01:00
b75e83c6c1 add: added no cache option
All checks were successful
/ update (push) Successful in 0s
2025-01-16 07:09:57 +00:00
b39983777b change: migrated from python image to alpine image
All checks were successful
/ update (push) Successful in 0s
2025-01-16 07:06:05 +00:00
c2bb0cc6cc fix: config
All checks were successful
/ update (push) Successful in 0s
2024-12-12 08:13:46 +01:00
4d2fe89cd5 add: config-parser; fix: offline status internal server error
All checks were successful
/ update (push) Successful in 0s
2024-12-12 08:11:13 +01:00
80a0affc4b add: dockerfile
All checks were successful
/ update (push) Successful in 0s
2024-12-06 08:09:40 +01:00
4c76eb3f1b Merge pull request 'monitor' (#6) from monitor into master
All checks were successful
/ update (push) Successful in 0s
Reviewed-on: #6
2024-12-06 07:05:09 +00:00
4 changed files with 41 additions and 27 deletions

16
Containerfile Normal file
View file

@ -0,0 +1,16 @@
FROM alpine:latest
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 git clone https://git.adrianux.net/ahoemann/Adrianux.net.git /opt
RUN python3 -m venv /opt/.venv
RUN /opt/.venv/bin/pip install --no-cache-dir -r requirements.txt
RUN apk del git
EXPOSE 8080
CMD [ "/opt/.venv/bin/waitress-serve", "--listen=0.0.0.0:8080", "app:app" ]

View file

@ -18,20 +18,15 @@ python3 -m venv .venv
pip install requirements.txt
```
```systemd
# /etc/systemd/system/adrianux.service
[Unit]
Description=WSGI app
After=network.target
## Building the container
[Service]
Type=simple
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
```
# <runtime> build -t adrianux:<tag> .
```
## Running the container
```
# <runtime> run adrianux:<tag>
```

15
app.py
View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from flask import Flask, render_template, redirect, url_for
import requests
import os
app = Flask(__name__)
@ -18,22 +19,24 @@ def homepage():
@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 )
git_url = os.environ['GIT_URL']
website_url = os.environ['WEBSITE_URL']
return render_template("monitoring.html", git_status = get_status(git_url), website_status = get_status(website_url) )
def get_status_code(link):
requested_site = requests.get(link)
return requested_site.status_code
def get_status(link):
try:
match get_status_code(link):
case 200:
return "ONLINE"
case 500:
return "ERROR"
case _:
return "ERROR"
except:
return "OFFLINE"
if __name__ == "__main__":
app.run(debug=False)
mode = os.environ['DEBUG_MODE']
app.run(debug=mode)

View file

@ -25,8 +25,8 @@
</main>
<footer class="container">
<p><a href="mailto:ahoemann@proton.me">ahoemann@proton.me</a></p>
&copy; Copyright 2024 by <a href="https://adrianux.net/">Adrian Hoemann</a>.
<p><a href="mailto:ahoemann@proton.me">ahoemann@proton.me</a>
</p>Authored by <a href="https://adrianux.net/">Adrian Hoemann</a>.
</footer>
</body>
</html>