Merge commit 'eca50e8e00ce7e66a406cfdd09632f90063f183d'

This commit is contained in:
LordMathis 2023-11-22 20:58:05 +01:00
commit bdf6335c83
14 changed files with 286 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux
# Temporary lock file while building
/.hugo_build.lock

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM golang:1.20 as build
WORKDIR /app
RUN go install -tags extended github.com/gohugoio/hugo@latest
COPY . /app
RUN hugo mod get -u && \
hugo
FROM nginx:stable-alpine
COPY --from=build /app/public /usr/share/nginx/html/
RUN wget https://github.com/LordMathis/resume/releases/download/2023-08-16/resume.pdf -O /usr/share/nginx/html/namesny_matus_resume.pdf

6
archetypes/default.md Normal file
View File

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

47
config.toml Normal file
View File

@ -0,0 +1,47 @@
baseURL = 'https://namesny.com/'
languageCode = 'en-us'
[module]
[[module.imports]]
path = "github.com/LordMathis/hugo-theme-nightfall"
[menu]
[[menu.header]]
name = "blog"
weight = 0
url = "blog"
[[menu.header]]
name = "about"
weight = 1
url = "about"
[params]
author = "Matúš Námešný"
user = "hello"
hostname = "namesny.com"
[[params.social]]
key = 0
name = "github"
url = "https://github.com/LordMathis"
[[params.social]]
key = 1
name = "gitea"
url = "https://git.namesny.com/Mathis"
[[params.social]]
key = 2
name = "linkedin"
url = "https://www.linkedin.com/in/matus-namesny/"
[[params.social]]
key = 3
name = "mastodon"
url = "https://toot.io/@mathis"
rel = "me"
[[params.social]]
key = 4
name = "email"
url = "mailto:matus@namesny.com"

16
content/about.md Normal file
View File

@ -0,0 +1,16 @@
---
title: 'About Me'
showMetadata: false
---
Hello there.
I am Matúš [ˈmatuːʃ] a Software Engineer based in Darmstadt, Germany. I focus on MLOps bridging the gap between Data Science, DevOps and Software Engineering. I am interested in broad range of topics including Machine Learning, Cloud, DevOps, Linux and open source.
After graduating in Artificial Inteligence and Natural Language Processing I joined Konica Minolta in Brno, Czechia, where I worked as an R&D Engineer developing a Python application that provides a unified approach for production ML model deployment. I was also deploying ML applications and MLOps tools to the cloud with Docker and Kubernetes which sparked my interest in DevOps and Cloud.
Currently I work at Telespazio as Software Engineer. I am developing a Kubeflow based Machine Learning Platform for Spacecraft Operational datasets. The platform is supposed to allow varius universities and researches to use the data to train ML models while keeping the data safe inside the platform which brings an interesting set of challenges.
I am usually open to discuss MLOps and ML Engineer opportunities. Here's my [resume](/namesny_matus_resume.pdf).
In my free time I selfhost a bunch of usefull applications such as Gitea, Nextcloud and this website. I am learning Go and working on [GitEcho](https://github.com/LordMathis/GitEcho).

3
content/blog/_index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: "Blog"
---

View File

@ -0,0 +1,47 @@
---
title: "Back to Hugo"
date: "2023-08-13"
tags:
- gatsby
- hugo
---
Over the years, this website was running on WordPress, Hugo, a custom React SPA, server-side rendered React, Gatsby, and now I'm back to Hugo.
<!--more-->
## First Hugo Website
I created my first Hugo website in 2016 while still in University studying Computer Science. I started looking for internships and thought that having a personal website would enhance my appeal. I created the [Nix theme](https://github.com/LordMathis/hugo-theme-nix), a minimalistic theme inspired by Unix and the terminal. Looking back at the code, it's actually not that bad considering I had zero experience with web development. But I think it speaks more about the simplicity of Hugo and Bootstrap rather than my skills.
If I were to rewrite this theme from scratch, I would implement many things differently. However, many people use the theme, so I continue to maintain it.
## Here Comes React
Hugo was working perfectly fine for my needs, but for some reason, I wanted something more. Since I was already learning React and Node.js, I decided to build my website using React. Initially, I started building the website as a standard React app. I created all the components that I thought I might need, and the website quickly grew.
Then I learned about universal (isomorphic) rendering and decided to give it a try. This part of development took me the longest. My challenge with implementing universal rendering was a distinct lack of up-to-date tutorials. They all used outdated versions of Webpack or React Router, or didn't utilize React Router at all. Another issue was that some tutorials were using babel-node in production, which is not recommended.
After finally implementing universal rendering, the next issue to solve was how to deliver content. A simpler approach would be to create a new React component for each blog post and "hard code" the content. However, that's not very React-like. Instead, I implemented a simple API in Express.
There are many more aspects that I didn't mention, things I spent hours working on, only to change my mind after implementation. An honorable mention goes to the CSS and the overall style of the website, which underwent several changes. I also reinvented the wheel multiple times, opting to build features from scratch rather than using existing modules.
So now, I had a new website that was much more complex but had fewer features than my initial Hugo website.
## The Great Gatsby
My React-based website wasn't fully server-side rendered. The only server-rendered element was the page layout, while the content was served via an API and rendered on the client side. Thus, I found myself running a Node.js app at all times for a relatively simple website with minimal visitors and content. Instead of embarking on creating my own server-side renderer, I got sidetracked by a captivating newcomer: Gatsby.
Migrating to Gatsby wasn't overly challenging since I already had all my styles and components ready. I just needed to grasp how to write GraphQL queries to fetch content and assemble a set of Gatsby plugins for website building. The initial implementation of the Gatsby website was enjoyable, but ongoing maintenance proved to be a hassle.
## Move Fast and Break Things
The JavaScript landscape evolves at breakneck speed. Libraries that emerged yesterday risk deprecation tomorrow. Not to mention the ceaseless discovery of vulnerabilities every day. To mitigate this, I established dependabot security alerts for my website's GitHub repository. At one point, dependabot became the primary contributor.
While the detected vulnerabilities didn't directly threaten my server, as the website generated static HTML files and was served by nginx, a chain of vulnerabilities encompassing Gatsby, nginx, and Docker would be necessary for a genuine threat. Nevertheless, uncertainty lingered.
In the end, I opted to return to Hugo. You can still explore the archived React/Gatsby source code [here](https://git.namesny.com/Mathis/namesny-com-gatsby-archive).
## Full Circle
Instead of revisiting my old Nix theme, I chose to create a new theme: [Nightfall](https://github.com/LordMathis/hugo-theme-nightfall), based on the layout of my Gatsby website. Migrating to Hugo was relatively straightforward, thanks to React components. I only needed to replace JSX tags with appropriate HTML tags and integrate Hugo partials. I welcome all contributions to both the Nix and Nightfall themes.

69
content/blog/gitea.md Normal file
View File

@ -0,0 +1,69 @@
---
title: "Replicating Gitea Docker SSH Passthrough on K8s"
date: "2023-02-12"
---
If you are selfhosting Gitea on a single node Kubernetes cluster and want to enable git through SSH while keeping SSH connection to the cluster, this guide is for you.
<!--more-->
## Background
I am currently in the process of migrating my selfhosted applications from docker-compose to Kubernetes. One of my most used selfhosted app is Gitea. I use it to host my projects, dotfiles and config files where I don't expect any contributions or I simply want to keep it more private. In my docker-compose setup I used SSH Container Passthrough from [Gitea docs](https://docs.gitea.io/en-us/install-with-docker/#SSH-container-passthrough) but when I moved Gitea to k8s I couldn't find any guides on how to achieve the same thing.
I installed Gitea using the official [Helm Chart](https://gitea.com/gitea/helm-chart/). The documentation says this about enabling SSH:
> If you're using ingress and want to use SSH, keep in mind, that ingress is not able to forward SSH Ports. You will need a LoadBalancer like metallb and a setting in your SSH service annotations.
However using this method will route all incoming SSH connections to the Gitea container, essentialy disabling SSH connection to the host. Therefore we need a way to pass SSH connections to user `git` to our Gite container running on Kubernetes and at the same time allow SSH connections to host for some other user(s)
## Kubernetes Setup
Create user git on your host and deploy Gitea to Kubernetes (e.g. using Helm). You don't need to expose port 22 using a service.
First we are going to create a new login shell for user git. Create file `/usr/local/bin/gitea-shell` with content:
{{< highlight bash >}}
#!/bin/sh
/usr/local/bin/kubectl exec -i -n gitea gitea-0 -c gitea -- env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" /bin/sh "$@"
{{< / highlight >}}
Your namespace might be different.
Then run as root (or sudo):
{{< highlight bash >}}
chmod +x /usr/local/bin/gitea-shell
usermod -s /usr/local/bin/gitea-shell git
{{< / highlight >}}
Now everytime the user git logs in (i.e. using git via SSH) `/usr/local/bin/gitea-shell` gets executed which means our original SSH command will be executed in the gitea container.
Finally we need to make sure that the SSH keys we add through Gitea interface allow us to 'login' as git user.
Edit `/etc/SSH/SSHd_config` and add the following:
{{< highlight yaml>}}
Match User git
AuthorizedKeysCommandUser git
AuthorizedKeysCommand /usr/local/bin/kubectl exec -i -n gitea gitea-0 -c gitea -- /usr/local/bin/gitea keys -e git -u %u -t %t -k %k
{{< / highlight >}}
If you are using `AllowUsers` directive don't forget to add user git
## Testing
Open Gitea in web browser and add you SSH key. Then try to SSH into the Gitea container.
{{< highlight bash >}}
ssh git@<your gitea url>
{{< / highlight >}}
You should get a message like this:
> PTY allocation request failed on channel 0
> Hi there, test! You've successfully authenticated with the key named <your ssh key>, but Gitea does not provide shell access.
> If this is unexpected, please log in with password and setup Gitea under another user.
> Connection to <your gitea url> closed.
Now you can create a repo and you should be able to clone and push via SSH.

View File

@ -0,0 +1,62 @@
---
title: "Building My Resume with GitHub Actions"
date: "2023-10-02"
---
Even if you are not actively looking for a new job, it is a good idea to have an up to date resume. I'm using Overleaf's GitHub integration and GitHub Actions to build PDF from my LaTeX resume and release it on GitHub
<!--more-->
## LaTeX
LaTeX is a typesetting system and document preparation tool known for its professional-quality typography and precise formatting capabilities. Widely used in academia, it's popular for creating resumes and academic documents due to its superior handling of complex formatting, mathematical equations, and citations. One of the benefits of using LaTeX is that it separates the content and formatting of a document, which makes it easier to focus on the content without worrying about the layout.
TeXLive is a comprehensive distribution of the LaTeX typesetting system, providing a wide range of packages, fonts, and utilities for users. It includes everything needed to create LaTeX documents, making it a go-to choice for many LaTeX users.
## Compiling PDF on Overleaf
I have been using [Overleaf](https://www.overleaf.com/) to edit, update and build my resume. Overleaf is a cloud-based LaTeX editor with countless templates for resumes, theses, presentations, cover letters, scientific papers and more. Overleaf uses TeXLive distribution, enabling their compile servers to provide a real-time preview of the typeset PDFs. This makes editing LaTeX on Overleaf very convenient since it is not necessary to understand the intricacies of document processing. Overleaf handles the complexities of LaTeX compilation, allowing you to concentrate on creating a standout resume. However, replicating the same results outside of Overleaf's environment requires deeper knowledge of the compilation process.
Overleaf uses [latexmk](https://ctan.org/pkg/latexmk?lang=en) package to automate the compilation. The package uses a system-wide configuration, which can be customized by a user-level configuration on a document-by-document basis. This customization might include adjusting the sequence of commands, specifying which files to include or exclude, defining custom dependencies, or setting up personalized error-handling procedures. You can access the `latexmk` configuration file used by Overleaf to typeset your document by compiling [this project](https://www.overleaf.com/learn/how-to/How_does_Overleaf_compile_my_project%3F#How_to_access_a_copy_of_Overleaf%E2%80%99s_LatexMk_file).
Because the template of my resume is quite simple it was not necessary to get the exact `latexmk` config file or to customize it in any way.
## Compiling and Releasing with GitHub Actions
Leveraging the power of GitHub Actions has streamlined my document compilation and release process significantly. Within the GitHub Actions Marketplace, there's a wealth of workflows tailored for various tasks, including LaTeX compilation. I've opted for [xu-cheng/latex-action](https://github.com/xu-cheng/latex-action) which utilizes the TeXLive environment and `latexmk` compiler, mirroring the setup used on Overleaf. And indeed without any configuration changes, my resume compiled to PDF correctly.
But automation doesn't stop there. To simplify the release procedure, I've incorporated [softprops/action-gh-release](https://github.com/softprops/action-gh-release). This action automates the creation of new tags, and releases, and even handles file attachments seamlessly. I've configured it to generate new releases marked with the current date, effortlessly adding the compiled `resume.pdf`. This automated process not only saves valuable time but also streamlines the release workflow, eliminating the need for manual login to Overleaf, recompilation, and downloading. It ensures that each new version of my resume is promptly available to the public.
You can check the full repository [here](https://github.com/LordMathis/resume). Alternatively here's just the workflow file:
```yaml
name: Release Compiled PDF
on:
push:
branches:
- master
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set up Git repository
uses: actions/checkout@v3
- name: Compile
uses: xu-cheng/latex-action@v2
with:
root_file: resume.tex
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NOW }}
files: ./resume.pdf
```

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module git.namesny.com/Mathis/namesny.com
go 1.20
require github.com/LordMathis/hugo-theme-nightfall v0.5.1 // indirect

4
go.sum Normal file
View File

@ -0,0 +1,4 @@
github.com/LordMathis/hugo-theme-nightfall v0.0.0-20230212210243-f116fbf0bdbb h1:31cDOpojmeNh9kpnwdPSe+Umzc1UaMc9vFM5N/7e5Yc=
github.com/LordMathis/hugo-theme-nightfall v0.0.0-20230212210243-f116fbf0bdbb/go.mod h1:0tCPxAeg5+tWhv17517Q8Lti/TPh0KNyON/uferEU30=
github.com/LordMathis/hugo-theme-nightfall v0.5.1 h1:xeycc74MTnikZ7tv+V8Lhuu9zrqRpVkaNjqw9eQYVNc=
github.com/LordMathis/hugo-theme-nightfall v0.5.1/go.mod h1:0tCPxAeg5+tWhv17517Q8Lti/TPh0KNyON/uferEU30=

BIN
static/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

BIN
static/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB