refactor: ready to move server

This commit is contained in:
phga 2021-04-20 16:39:56 +02:00
parent 7183a80c86
commit 66d584d72c
22 changed files with 109 additions and 42 deletions

14
.gitignore vendored
View File

@ -1,17 +1,7 @@
# ---> Go
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
*.jpg
*.png
*.woff
*.woff
cmd/phga.de/phga.de

7
build/app/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM golang:1.16.2
ENV GO111MODULE=off
RUN go get -u -d g.phga.de/phga/phga.de/...
WORKDIR /go/src/g.phga.de/phga/phga.de/cmd/phga.de
RUN go build
CMD ["./phga.de"]

13
build/docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3'
services:
tt:
build:
context: ./app
dockerfile: Dockerfile
restart: always
ports:
- 8099:8080
volumes:
- /srv/phga.de/web/data:/go/src/g.phga.de/phga/phga.de/web/data
- /srv/phga.de/web/static/fonts:/go/src/g.phga.de/phga/phga.de/web/static/fonts

View File

@ -9,11 +9,12 @@ import (
"io/ioutil"
"log"
"net/http"
"path"
"regexp"
)
// could be enabled after the implementation is complete.
// var t = template.Must(template.ParseFiles("tmpl/layouts/base.html", "tmpl/index.html", "tmpl/blog.html", "tmpl/about.html", "tmpl/contact.html", ))
// var t = template.Must(getTemplate("layouts/base.html", "index.html", "blog.html", "about.html", "contact.html", ))
// A regex used to identify valid Img requests
var validImg = regexp.MustCompile("^/info/([\\w_\\- ]+)")
var exhibit Exhibition
@ -28,7 +29,7 @@ func main() {
http.HandleFunc("/contact", handleContact)
http.HandleFunc("/info/", handleInfo)
// provide the inc directory to the useragent
http.Handle("/inc/", http.StripPrefix("/inc/", http.FileServer(http.Dir("inc"))))
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("../../web/static"))))
// listen on port 8080 (I use nginx to proxy this local server)
log.Fatalln(http.ListenAndServe(":8080", nil))
}
@ -51,24 +52,24 @@ type Exhibition struct {
// Funcions follow that handle the requests
func handleIndex(w http.ResponseWriter, r *http.Request) {
// that should also be somewhere else when there is another gallery
exhibit.parseExhibitions("./data")
exhibit.parseExhibitions("../../web/data")
// Parses all required html files to provide the actual html that is shipped.
t, _ := template.ParseFiles("tmpl/layouts/index.html", "tmpl/gallery.html", "tmpl/header.html")
t, _ := getTemplate("layouts/index.html", "gallery.html", "header.html")
t.Execute(w, exhibit)
}
func handleBlog(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("tmpl/layouts/base.html", "tmpl/soon.html", "tmpl/header.html")
t, _ := getTemplate("layouts/base.html", "soon.html", "header.html")
t.Execute(w, nil)
}
func handleAbout(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("tmpl/layouts/base.html", "tmpl/about.html", "tmpl/header.html")
t, _ := getTemplate("layouts/base.html", "about.html", "header.html")
t.Execute(w, nil)
}
func handleContact(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("tmpl/layouts/base.html", "tmpl/contact.html", "tmpl/header.html")
t, _ := getTemplate("layouts/base.html", "contact.html", "header.html")
t.Execute(w, nil)
}
@ -125,3 +126,21 @@ func (ex *Exhibition) parseExhibitions(dir string) {
}
}
}
func getTemplate(files ...string) (*template.Template, error) {
tmplFolder := "../../web/templates/"
for i, f := range files {
files[i] = tmplFolder + f
}
// Name has to be the basename of at least one of the template files
t := template.New(path.Base(files[0]))
// Add custom helper funcs to template
// t.Funcs(template.FuncMap{
// "UnwrapOID": unwrapObjectID,
// "GetSurveys": getSurveys,
// })
t, err := t.ParseFiles(files...)
return t, err
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module g.phga.de/phga/phga.de
go 1.16

View File

@ -1,5 +1,5 @@
@font-face {
src: url("/inc/fonts/HKGrotesk-Regular.woff");
src: url("/static/fonts/HKGrotesk-Regular.woff");
font-family: hkg;
}

View File

@ -101,7 +101,7 @@ function showOverlay(overlay, imgName) {
window.addEventListener("resize", resize);
img.addEventListener("load", () => {zoom(0.4, imgName)});
img.src = `/inc/images/${imgName}.jpg`;
img.src = `/static/images/${imgName}.jpg`;
img.id = imgName;
img.alt = imgName;

View File

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -22,7 +22,7 @@
Adresse
</div>
<div class="cv-column cv-content">
Lebzeltergasse 3, 85049 Ingolstadt
Johannesstr. 7, 85049 Ingolstadt
</div>
</div>
<div class="cv-row">
@ -87,7 +87,42 @@
Zeitspanne
</div>
<div class="cv-column cv-content">
01.03.2020 &ndash; heute
01.12.2020 &ndash; heute
</div>
</div>
<div class="cv-row">
<div class="cv-column cv-label">
Tätigkeit
</div>
<div class="cv-column cv-content">
Unterstützende Lehrkraft an der Staatlichen Berufsschule 1 Ingolstadt.
Hauptsächlich mache ich dort Prüfungsvorbereitung für alle
Abschlussklassen in den IT Fachrichtungen (FI-AE / FI-SI).
</div>
</div>
<div class="cv-row">
<div class="cv-column cv-label">
Unternehmen
</div>
<div class="cv-column cv-content">
BS1IN
</div>
</div>
<div class="cv-row">
<div class="cv-column cv-label">
Branche
</div>
<div class="cv-column cv-content">
Bildung / Duale Ausbildung
</div>
</div>
<h1 class="cv-sub-heading">Nebentätigkeiten</h1>
<div class="cv-row">
<div class="cv-column cv-label">
Zeitspanne
</div>
<div class="cv-column cv-content">
01.03.2020 &ndash; 30.06.2020
</div>
</div>
<div class="cv-row">
@ -97,7 +132,7 @@
<div class="cv-column cv-content">
Geringfügige Beschäftigung (450 € Basis)
Bearbeitung von Projekten im Bereich Server (Microsoft und GNU/Linux)
und Netzwerk (Diverse Technologien). Betreuung von Bestandskund*innen
und Netzwerk (Diverse Technologien). Betreuung von Bestandskund:innen
und deren IT-Umgebungen. Dokumentationserstellung.
</div>
</div>
@ -179,7 +214,7 @@
<div class="cv-column cv-content">
Weiterentwicklung und Instandhaltung der
bestehenden Netzwerkumgebung mit ca. 3000
Netzteilnehmer*innen und 150+ Netzwerkkomponenten
Netzteilnehmer:innen und 150+ Netzwerkkomponenten
Ausbildung der Azubis in der Abteilung Systemtechnik.
Projektplanung und Durchführung in diversen
Themengebieten.
@ -228,7 +263,7 @@
</div>
<div class="cv-column cv-content">
Schwerpunk während der Ausbildung war der Bereich
Netzwerk und die Unterstützung von Benutzer*innen vor Ort.
Netzwerk und die Unterstützung von Benutzer:innen vor Ort.
</div>
</div>
<div class="cv-row">
@ -284,7 +319,7 @@
<div class="cv-column cv-content">
Programmier und Technikkurse für Kinder an der Technischen Hochschule
Ingolstadt. Hier entwickle und betreue ich, zusammen mit anderen
Student*innen und den Mitarbeiter*innen aus dem Büro der Frauenbeauftragten,
Student:innen und den Mitarbeiter:innen aus dem Büro der Frauenbeauftragten,
Workshops rund um das Programmieren von Lego Robotern oder wie man einfache
Spiele in der Programmiersprache Scratch entwickelt. Die Workshops werden dann
an verschiedenen Tagen wie z.B. dem Girls/Boys Day durchgeführt.
@ -305,7 +340,7 @@
<div class="cv-column cv-content">
Seit Beginn meines Studiums an der THI bin ich Mitglied bei unserem Verein
N.I.C.E (Network International Culture Exchange). Hier steht der Austausch
zwischen Ausländischen Student*innen und Lokals bei verschiedenen Events im
zwischen Ausländischen Student:innen und Lokals bei verschiedenen Events im
Vordergrund. Ich hatte außerdem schon die Möglichkeit ein Buddy für eine
chinesische Austauschstudentin und einen brasilianischen Austauschstudenten zu sein
und konnte Ihnen über die ersten Bürokratischen Hürden in Deutschland hinweg helfen.
@ -346,7 +381,7 @@
Abschluss
</div>
<div class="cv-column cv-content">
Ausbilder*innen-Eignungsverordnung
Ausbilder:innen-Eignungsverordnung
</div>
</div>
<div class="cv-row">
@ -414,7 +449,7 @@
Zertifikate und Kurse
</div>
<div class="cv-column cv-content">
Seminarleiter*innen Workshop (FES), CCNA, ADA, Risikomanagement
Seminarleiter:innen Workshop (FES), CCNA, ADA, Risikomanagement
(Medizin / DIN 80001, Kurs), IINS (Kurs), CCNA Exploration,
MS Project 2013, Knigge
</div>
@ -428,7 +463,7 @@
</div>
<div class="cv-column cv-content">
Skateboard, Schwimmen, Ausgiebige Spaziergänge, Kompetitive Online Spiele,
Definitiv zu viel an Linux und Emacs Konfigurationen herum-optimieren,
Definitiv zu viel an Linux und Emacs Konfigurationen herum-optimieren, Tastaturen,
hier und da kleinere Elektrotechik Projekte realisieren, 3D-Design (Blender),
2D Design (Inkscape), FOSS
</div>

View File

@ -7,16 +7,16 @@
<b>Haftungsausschluss</b>
Angaben gemäß § 5 TMG:
Philip Gaber
Lebzeltergasse 3
Johannesstr. 9
85049 Ingolstadt
<b>Kontakt:</b>
E-Mail: phga@posteo.de
Telefon: +49 841 22064128
Telefon: +49 841 12818826
<b>Verantwortlich für den Inhalt nach § 55 Abs. 2 RStV:</b>
Philip Gaber
Lebzeltergasse 3
Johannesstr. 9
85049 Ingolstadt
<b>Streitschlichtung</b>

View File

@ -7,12 +7,12 @@
</div>
</section>
<section id="welcome">
<img id="avatar" alt="" src="/inc/logo/avatar.svg"/>
<img id="avatar" alt="" src="/static/logo/avatar.svg"/>
</section>
<section id="exhibition">
{{range $key, $val := .Pics}}
<div class="thumb-box">
<img alt="{{$val.Name}}" src="/inc/thumbs/t_{{$val.Name}}.jpg" data-img="{{$val.Name}}" class="thumb" />
<img alt="{{$val.Name}}" src="/static/thumbs/t_{{$val.Name}}.jpg" data-img="{{$val.Name}}" class="thumb" />
</div>
{{end}}
</section>

View File

@ -5,7 +5,7 @@
<a href="/blog">BLOG</a>
<!-- <a class="nav-center"></a> -->
<a id="logo" href="/"><img src="/inc/logo/logo.svg" alt="" /></a>
<a id="logo" href="/"><img src="/static/logo/logo.svg" alt="" /></a>
<!-- <a id="logo" href=""></a> -->
<!-- <a class="nav-center"></a> -->

View File

@ -9,7 +9,7 @@
<meta name="author" content="Philip Gaber" />
<meta name="copyright" content="Philip Gaber" />
<title>PHGA</title>
<link href="/inc/css/main.css" rel="stylesheet"/>
<link href="/static/css/main.css" rel="stylesheet"/>
</head>
<body>
{{block "header" .}}NO HEADER DEFINED{{end}}

View File

@ -9,10 +9,10 @@
<meta name="author" content="Philip Gaber" />
<meta name="copyright" content="Philip Gaber" />
<title>PHGA 🤓 teord</title>
<link href="/inc/css/main.css" rel="stylesheet"/>
<script src="/inc/js/main.js"></script>
<script src="/inc/js/zoom.js"></script>
<script src="/inc/js/text.js"></script>
<link href="/static/css/main.css" rel="stylesheet"/>
<script src="/static/js/main.js"></script>
<script src="/static/js/zoom.js"></script>
<script src="/static/js/text.js"></script>
</head>
<body>
<section id="gallery-wrapper">