refactor: use years parent folders (#82)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2022-03-13 12:11:46 +01:00
parent 5b987f9e51
commit d881c16333
24 changed files with 34 additions and 7 deletions

View File

@ -17,6 +17,9 @@ markup:
startLevel: 1 startLevel: 1
endLevel: 9 endLevel: 9
permalinks:
posts: /posts/:year/:month/:title/
taxonomies: taxonomies:
author: authors author: authors
tag: tags tag: tags

View File

@ -1,6 +1,8 @@
--- ---
title: "Ansible and the relations to the inventory" title: "Ansible and the relations to the inventory"
date: 2020-08-03T22:45:00+02:00 date: 2020-08-03T22:45:00+02:00
aliases:
- /posts/ansible-and-the-relations-to-the-inventory/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 258 KiB

View File

@ -1,6 +1,8 @@
--- ---
title: "Color palettes on Game Boy Color and Advance" title: "Color palettes on Game Boy Color and Advance"
date: 2020-09-15T21:45:00+02:00 date: 2020-09-15T21:45:00+02:00
aliases:
- /posts/color-palettes-on-gbc-and-gba/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
title: "Create a static site hosting platform" title: "Create a static site hosting platform"
date: 2020-07-30T01:05:00+02:00 date: 2020-07-30T01:05:00+02:00
aliases:
- /posts/create-a-static-site-hosting-platform/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:
@ -8,7 +10,7 @@ tags:
- Sysadmin - Sysadmin
resources: resources:
- name: feature - name: feature
src: 'images/feature.jpg' src: "images/feature.jpg"
params: params:
anchor: Center anchor: Center
credits: > credits: >
@ -17,7 +19,9 @@ resources:
--- ---
There are a lot of static site generators out there and users have a lot of possibilities to automate and continuously deploy static sites these days. Solutions like GitHub pages or Netlify are free to use and easy to set up, even a cheap webspace could work. If one of these services is sufficient for your use case you could stop reading at this point. There are a lot of static site generators out there and users have a lot of possibilities to automate and continuously deploy static sites these days. Solutions like GitHub pages or Netlify are free to use and easy to set up, even a cheap webspace could work. If one of these services is sufficient for your use case you could stop reading at this point.
<!--more--> <!--more-->
As I wanted to have more control over such a setup and because it might be fun I decided to create my own service. Before we look into the setup details, lets talk about some requirements: As I wanted to have more control over such a setup and because it might be fun I decided to create my own service. Before we look into the setup details, lets talk about some requirements:
- deploy multiple project documentation - deploy multiple project documentation
@ -90,13 +94,13 @@ server {
We will go through this configuration to understand how it works. We will go through this configuration to understand how it works.
__*Lines 1-3*__ defines a backend, in this case it's the Minio server running on `localhost:61000`. **_Lines 1-3_** defines a backend, in this case it's the Minio server running on `localhost:61000`.
__*Lines 5-10*__ should also be straight forward, this block will redirect HTTP to HTTPS. **_Lines 5-10_** should also be straight forward, this block will redirect HTTP to HTTPS.
__*Line 14*__ is where the magic starts. We are using a named regular expression to capture the first part of the subdomain and translate it into the bucket sub-directory. For a given URL like `demoproject.mydocs.com` Nginx will try to serve `mydocs/demoproject` from the Minio server. That's what __*Line 23*__ does. Some of you may notice that the used variable `${request_path}` is not defined in the vHost configuration. **_Line 14_** is where the magic starts. We are using a named regular expression to capture the first part of the subdomain and translate it into the bucket sub-directory. For a given URL like `demoproject.mydocs.com` Nginx will try to serve `mydocs/demoproject` from the Minio server. That's what **_Line 23_** does. Some of you may notice that the used variable `${request_path}` is not defined in the vHost configuration.
Right, we need to add another configuration snippet to the `nginx.conf`. But why do we need this variable at all? For me, that was the hardest part to solve. As the setup is using `proxy_pass` Nginx will *not* try to lookup `index.html` automatically. That's a problem because every folder will at least contain an `index.html`. In general, it's required to tell Nginx to rewrite the request URI to `/index.html` if the origin is a folder and ends with `/`. One way would be an `if` condition in the vHost configuration but such conditions are evil[^if-is-evil] in most cases and should be avoided if possible. Luckily there is a better option: Right, we need to add another configuration snippet to the `nginx.conf`. But why do we need this variable at all? For me, that was the hardest part to solve. As the setup is using `proxy_pass` Nginx will _not_ try to lookup `index.html` automatically. That's a problem because every folder will at least contain an `index.html`. In general, it's required to tell Nginx to rewrite the request URI to `/index.html` if the origin is a folder and ends with `/`. One way would be an `if` condition in the vHost configuration but such conditions are evil[^if-is-evil] in most cases and should be avoided if possible. Luckily there is a better option:
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
@ -113,7 +117,7 @@ map $request_uri $request_path {
[Nginx maps](https://nginx.org/en/docs/http/ngx_http_map_module.html) are a solid way to create conditionals. In this example set `$request_uri` as input and `$request_path` as output. Each line between the braces is a condition. The first line will simply apply `$request_uri` to the output variable if no other condition match. The second condition applies `${request_uri}index.html` to the output variable if the input variable ends with a slash (and therefor is a directory). [Nginx maps](https://nginx.org/en/docs/http/ngx_http_map_module.html) are a solid way to create conditionals. In this example set `$request_uri` as input and `$request_path` as output. Each line between the braces is a condition. The first line will simply apply `$request_uri` to the output variable if no other condition match. The second condition applies `${request_uri}index.html` to the output variable if the input variable ends with a slash (and therefor is a directory).
__*Line 38-41*__ of the vHost configuration tries to deliver the custom error page of your site and will fallback to the default Nginx error page. **_Line 38-41_** of the vHost configuration tries to deliver the custom error page of your site and will fallback to the default Nginx error page.
We are done! Nginx should now be able to server your static sites from a sub-directory of the Minio source bucket. I'm using it since a few weeks and I'm really happy with the current setup. We are done! Nginx should now be able to server your static sites from a sub-directory of the Minio source bucket. I'm using it since a few weeks and I'm really happy with the current setup.

View File

@ -1,6 +1,8 @@
--- ---
title: "Docker port publishing for localhost bindings" title: "Docker port publishing for localhost bindings"
date: 2020-09-08T22:15:00+02:00 date: 2020-09-08T22:15:00+02:00
aliases:
- /posts/docker-port-publishing-for-localhost-bindings/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 258 KiB

View File

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -1,6 +1,8 @@
--- ---
title: "How to modernize a Game Boy" title: "How to modernize a Game Boy"
date: 2020-09-13T23:45:00+02:00 date: 2020-09-13T23:45:00+02:00
aliases:
- /posts/modernize-a-game-boy-advance/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
title: "Run an ARM32 Docker daemon on ARM64 servers" title: "Run an ARM32 Docker daemon on ARM64 servers"
date: 2020-09-24T10:30:00+02:00 date: 2020-09-24T10:30:00+02:00
aliases:
- /posts/run-arm32-docker-daemon-on-arm64-servers/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

View File

@ -1,13 +1,15 @@
--- ---
title: "Welcome (back)" title: "Welcome (back)"
date: 2020-07-21T23:00:08+02:00 date: 2020-07-21T23:00:08+02:00
aliases:
- /posts/welcome/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:
- General - General
resources: resources:
- name: feature - name: feature
src: 'images/feature.jpg' src: "images/feature.jpg"
params: params:
anchor: Center anchor: Center
credits: > credits: >
@ -16,7 +18,9 @@ resources:
--- ---
As some former readers may have noticed, "geeklabor.de" has been renamed to "thegeeklab.de", welcome back nice to have you here again. If you are a first time visitor, a very warm welcome goes to you as well. This is my private blog, where I write about everything that comes to my mind but mainly about topics from the Linux and Open Source world. As some former readers may have noticed, "geeklabor.de" has been renamed to "thegeeklab.de", welcome back nice to have you here again. If you are a first time visitor, a very warm welcome goes to you as well. This is my private blog, where I write about everything that comes to my mind but mainly about topics from the Linux and Open Source world.
<!--more--> <!--more-->
For those of you who are interested in the backgrounds about the blog migration, here you go: For those of you who are interested in the backgrounds about the blog migration, here you go:
- my old theme had to be reworked, [hugo-geekblog](https://github.com/thegeeklab/hugo-geekblog) was born - my old theme had to be reworked, [hugo-geekblog](https://github.com/thegeeklab/hugo-geekblog) was born

View File

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 332 KiB

View File

@ -1,6 +1,8 @@
--- ---
title: "Toolbox 1: direnv" title: "Toolbox 1: direnv"
date: 2021-05-17T21:24:00+01:00 date: 2021-05-17T21:24:00+01:00
aliases:
- /posts/toolbox-1-direnv/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 332 KiB

View File

@ -1,6 +1,8 @@
--- ---
title: "Toolbox 2: git-plus" title: "Toolbox 2: git-plus"
date: 2021-06-19T09:50:00+01:00 date: 2021-06-19T09:50:00+01:00
aliases:
- /posts/toolbox-2-git-plus/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
title: "SSL certificate monitoring pitfalls" title: "SSL certificate monitoring pitfalls"
date: 2022-01-31T23:00:00+01:00 date: 2022-01-31T23:00:00+01:00
aliases:
- /posts/ssl-certificate-monitoring-pitfalls/
authors: authors:
- robert-kaussow - robert-kaussow
tags: tags: