Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Krummenauer kekru

View GitHub Profile
@kekru
kekru / 01nginx-tls-sni.md
Last active May 6, 2021
nginx TLS SNI routing, based on subdomain pattern
View 01nginx-tls-sni.md

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@kekru
kekru / Docker connect to remote server.md
Last active May 5, 2021
Connect to another host with your docker client, without modifying your local Docker installation
View Docker connect to remote server.md

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@kekru
kekru / 01-sonar-aggregate-generic-testdata.md
Last active Apr 27, 2021
Aggregate Sonar Generic Test Data Execution
View 01-sonar-aggregate-generic-testdata.md

Sonarqube aggregate Generic Test Data Execution

This is how to combine multiple SonarQube test data reports in the Generic Execution format, using node js.

This can be useful, if you run multiple jest tests, exporting with jest-sonar-reporter and want to combine the results to pass it to SonarQube

We will use glob to find files and xml2js to combine them.

@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active Apr 23, 2021
Docker Remote API with client verification via daemon.json
View 1-Enable Docker Remote API with TLS client verification.md

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@kekru
kekru / 01-Openshift3-WSL2.md
Last active Apr 22, 2021
Openshift 3.11 in WSL2
View 01-Openshift3-WSL2.md

Running Openshift 3.11 inside WSL2

This is not running yet, but nearly almost

Install WSL2 and oc client

First install a WSL2 with Ubuntu 20.04 as described at Microsoft

Enter wsl shell

@kekru
kekru / git-copy-files-to-empty-branch.md
Last active Apr 15, 2021
git: Copy files to new branch without history, using a squash merge
View git-copy-files-to-empty-branch.md

Git: New branch with files but no history

This is how to copy your files from a given git branch to a new empty branch, using a squash merge.
This example will copy files from branch old-branch to target-branch

# First be sure, that you don't have uncommitted working changes. They will be deleted

# Checkout a new empty branch without history
git checkout --orphan target-branch
@kekru
kekru / 01-VSCode-foreach-project.md
Last active Apr 14, 2021
Command for each project in VS Code workspace
View 01-VSCode-foreach-project.md

Run a command in every directory of a VSCode workspace

Currently only for Windows using GitBash.
Deno must be installed.

Setup an alias and then run a command in every project of a VSCode workspace

# Store alias in $HOME/.bashrc
alias vsforeach="deno run --allow-run --allow-read https://gist.githubusercontent.com/kekru/256d73c7819efc35e55cd88c5903ab46/raw/d14aa519cd4709c66d4a57ec5487a11c800589ad/vsforeach.js"
@kekru
kekru / 01-IntelliJ-Multiple-Gradle-Projects.md
Last active Apr 4, 2021
IntelliJ Multiple Gradle Projects
View 01-IntelliJ-Multiple-Gradle-Projects.md

Multiple Gradle projects in IntelliJ

This is how to open multiple gradle projects in a single IntelliJ window.

  • File -> New -> Project ... -> Empty Project
  • File -> Project Structure ... -> Modules -> Plus Sign -> Import Module
    • Choose your Module -> Import module from external model -> Gradle -> Next
    • Activate Checkbox: "Create separate module per source set"
    • Activate Radio: "Use gradle wrapper task configuration"
    • Finish
@kekru
kekru / traefik-redirect-path.md
Last active Mar 14, 2021
Traefik redirect / (root) to sub path with Docker labels
View traefik-redirect-path.md

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect