Compare commits

..

39 commits
=go ... master

Author SHA1 Message Date
ec4edea536 feat: removed old depedencies 2025-04-03 08:49:00 +00:00
4f882b8dad add: theia-workspace to gitignore 2025-04-03 07:22:10 +00:00
0ba3df6778 fix: image registry 2025-04-03 08:12:26 +02:00
1b5dd6e7d5 Delete .forgejo/workflows/build-image.yml 2025-04-03 08:08:29 +02:00
251b1c8a0b Update templates/base.j2
Some checks failed
/ build (push) Failing after 6s
2025-04-01 15:02:01 +02:00
1236a024ef Update .forgejo/workflows/build-image.yml
Some checks failed
/ build (push) Failing after 57s
2025-03-28 13:54:29 +01:00
a76cbd86f0 Update .forgejo/workflows/build-image.yml
Some checks are pending
/ build (push) Waiting to run
2025-03-28 13:52:39 +01:00
7e5819f8b8 feat: added pytsebin link
Some checks are pending
/ build (push) Waiting to run
2025-03-28 12:55:48 +01:00
2186a11e4a Update .forgejo/workflows/build-image.yml
Some checks are pending
/ build (push) Waiting to run
2025-03-27 12:56:24 +01:00
e3afb17d07 Update .forgejo/workflows/build-image.yml
Some checks are pending
/ build (push) Waiting to run
2025-03-27 12:56:14 +01:00
4dc4e78572 Update .forgejo/workflows/build-image.yml
Some checks failed
/ test (push) Has been cancelled
2025-03-27 12:41:46 +01:00
44cd8886f7 Update .forgejo/workflows/build-image.yml
Some checks failed
/ test (push) Has been cancelled
2025-03-27 12:41:19 +01:00
c2591e8432 Update .forgejo/workflows/build-image.yml
Some checks failed
/ test (push) Has been cancelled
2025-03-27 12:39:51 +01:00
0704dc6ba3 Add .forgejo/workflows/build-image.yml
Some checks failed
/ test (push) Has been cancelled
2025-03-27 12:37:34 +01:00
f6db4212fd change: to new build environment 2025-03-27 12:16:32 +01:00
50552d7245 fix: link uri 2025-03-27 09:19:42 +01:00
0fd8db9749 fix: site monitoring on homepage link 2025-03-27 09:17:26 +01:00
40306538ba fix: remove url variables; docs: updated to current 2025-03-21 08:36:35 +01:00
d74916f2c7 typo: Jinja -> Jinja2 2025-03-20 18:11:51 +01:00
77508a984e feat: links defined by environment variables 2025-03-20 18:08:08 +01:00
6750c17306 Update Jenkinsfile 2025-03-20 14:41:11 +01:00
4b5a9fc9c6 Update Jenkinsfile 2025-03-20 14:40:18 +01:00
20b4a54a67 Update Jenkinsfile 2025-03-20 14:38:24 +01:00
d8c836d212 feat: force light mode 2025-03-20 14:12:23 +01:00
70eb980887 Update templates/base.j2 2025-03-20 12:21:09 +01:00
cff6024fde fix: typo in imprint template 2025-03-14 17:31:27 +01:00
341b725d5f remove: monitoring(replaced by statping-ng); fix: template naming 2025-03-14 17:19:35 +01:00
053b573758 Update templates/about.html 2025-03-12 17:44:53 +01:00
bdb8898adc Update Dockerfile 2025-02-14 12:05:28 +01:00
dec236e2f9 Delete latest.dockerfile 2025-02-14 12:05:14 +01:00
06bb092b37 Update Jenkinsfile 2025-02-14 09:03:48 +01:00
e1e1584214 Update Jenkinsfile 2025-02-14 08:53:29 +01:00
4253e606eb Update Jenkinsfile 2025-02-14 08:52:22 +01:00
38b91d6fc9 Update Jenkinsfile 2025-02-14 08:52:08 +01:00
eff59303bf add: initial Jenkinsfile 2025-02-13 17:29:42 +01:00
c001c5f0b8 Delete .forgejo/workflows/update.yaml 2025-02-12 16:48:53 +01:00
ee4c6978e6 fix: ignore all things containing git information
Some checks failed
/ update (push) Has been cancelled
2025-02-12 10:40:57 +01:00
c9d61cd9fb docs: updated for docker; feat: local and latest dockerfiles; add: .dockerignore file; feat: implemented health check for adrianux app
Some checks failed
/ update (push) Has been cancelled
2025-02-05 18:29:37 +01:00
fa730cac1b docs: updated for docker; feat: local and latest dockerfiles; add: .dockerignore file; feat: implemented health check for adrianux app 2025-02-05 18:28:17 +01:00
16 changed files with 104 additions and 116 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
.forgejo
*compose.yml
Dockerfile
.git*
Jenkinsfile
LICENSE
README.md

1
.env.example Normal file
View file

@ -0,0 +1 @@
DEBUG_MODE=False

View file

@ -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
View file

@ -1,2 +1,4 @@
.venv
.venv*
.env
__pycache__
*theia-workspace

View file

@ -1,14 +0,0 @@
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 go
COPY . .
RUN chmod +x website
EXPOSE 8080
CMD [ "/opt/./website" ]

14
Dockerfile Normal file
View 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" ]

View file

@ -1,32 +1,62 @@
# Installation
## Setting up the environment
1. Create a virtual environment:
```bash
```sh
python3 -m venv .venv
```
2. Activate the virtual environment:
```bash
```sh
. .venv/bin/activate
```
3. Install dependencies:
```bash
```sh
pip install requirements.txt
```
4. Set the environment variables:
```sh
export DEBUGMODE=False
```
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 .
```
# <runtime> build -t adrianux:<tag> .
```
## Running the container
```sh
docker run adrianux:latest
```
# <runtime> run adrianux:<tag>
# Docker Compose
```sh
docker compose up adrianux
```

22
app.py Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env python3
from flask import Flask, render_template, url_for
import os
app = Flask(__name__)
@app.route("/imprint")
def root():
return render_template("imprint.j2")
@app.route("/about")
def about():
return render_template("about.j2")
@app.route("/")
def homepage():
return render_template("homepage.j2")
if __name__ == "__main__":
app.run(debug=os.environ['DEBUG_MODE'])

7
docker-compose.yml Normal file
View 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"

3
requirements.txt Normal file
View file

@ -0,0 +1,3 @@
flask
waitress
requests

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.j2" %}
{% block title %}About{% endblock %}
{% block head %}
{{ super() }}
@ -10,7 +10,7 @@
<p>Languages: German, English</p>
<p>Programming languages: Python, Bash, POSIX Shell, Powershell</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>Services managed: SSH, DNS, DHCP, AD, PF, UFW, NF-Tables,
RDP(XRDP, Microsoft RDP), Webserver(Apache24, Nginx, OpenBSD-httpd,

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-theme="light">
<head>
{% block head %}
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
@ -14,8 +14,9 @@
<li><a href="/">Homepage</a></li>
<li><a href="imprint">Imprint</a></li>
<li><a href="about">About</a></li>
<li><a href="monitoring">Monitoring</a></li>
<li><a href="https://git.adrianux.net/ahoemann">Git</a></li>
<li><a href="https://cloud.adrianux.net">Monitoring</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>
</nav>
<body>

View file

@ -1,9 +1,9 @@
{% extends "base.html" %}
{% extends "base.j2" %}
{% block title %}Homepage{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% 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>
{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.j2" %}
{% block title %}Imprint{% endblock %}
{% block head %}
{{ super() }}

View file

@ -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 %}

View file

@ -1,69 +0,0 @@
package main
import (
"net/http"
"os"
"html/template"
"log"
)
var templates = template.Must(template.ParseGlob("*.html"))
func main() {
mode := os.Getenv("DEBUG_MODE")
if mode == "true" {
log.Println("Debug mode is on")
}
http.HandleFunc("/imprint", imprint)
http.HandleFunc("/about", about)
http.HandleFunc("/", homepage)
http.HandleFunc("/monitoring", monitoring)
log.Fatal(http.ListenAndServe(":8080", nil))
}
func imprint(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "imprint.html")
}
func about(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "about.html")
}
func homepage(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "homepage.html")
}
func monitoring(w http.ResponseWriter, r *http.Request) {
gitURL := os.Getenv("GIT_URL")
websiteURL := os.Getenv("WEBSITE_URL")
gitStatus := getStatus(gitURL)
websiteStatus := getStatus(websiteURL)
data := struct {
GitStatus string
WebsiteStatus string
}{
GitStatus: gitStatus,
WebsiteStatus: websiteStatus,
}
renderTemplate(w, "monitoring.html", data)
}
func renderTemplate(w http.ResponseWriter, tmpl string, data ...interface{}) {
err := templates.ExecuteTemplate(w, tmpl, data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
func getStatus(link string) string {
resp, err := http.Get(link)
if err != nil {
return "OFFLINE"
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
return "ONLINE"
}
return "ERROR"
}