Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
TDD & CI for IaC FTW!

Jonas Hecht jonashackt

:octocat:
TDD & CI for IaC FTW!
View GitHub Profile
@jonashackt
jonashackt / gitops.md
Created Jan 20, 2022
GitOps cheat sheet
View gitops.md
@jonashackt
jonashackt / docker-healthcheck-java.md
Last active May 5, 2021
Creating our own Java-based Docker Healthcheck without curl
View docker-healthcheck-java.md

Paketo.io / CloudNativeBuildPack created Container image doesn't have curl installed - and this is for good reasons (see https://stackoverflow.com/a/65393843/4964553 & https://blog.sixeyed.com/docker-healthchecks-why-not-to-use-curl-or-iwr/).

So we need another aproach... As suggested we should use the container inherited language (here: Java/JDK) to write our own healthcheck.

Creating our own Java-based Healthcheck without curl

So let's look at this great article https://mflash.dev/blog/2021/03/01/java-based-health-check-for-docker/ , where Naiyer explains how to write a simple healthcheck based on Java 11+

Here's my adoption leveraging an argument to provide a specific port. Just look into HealthCheck.java:

@jonashackt
jonashackt / paketo-cloud-native-buildpacks-cheat-sheet.sh
Last active Dec 21, 2020
Cheat sheet for Cloud Native Buildpacks / Paketo building Spring Boot apps
View paketo-cloud-native-buildpacks-cheat-sheet.sh
# Samples:
https://github.com/buildpacks/samples
# We can override the default ENTRYPOINT in a CNB build container
see https://buildpacks.io/docs/app-developer-guide/run-an-app/#user-provided-shell-process
So we need to know the default launch process of a CNB build Spring Boot container - and then add the needed installation command
@jonashackt
jonashackt / github-actions-maven.yml
Created Nov 29, 2020
DevOps lecture: GitHub actions configuration
View github-actions-maven.yml
name: devopsdemo
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
@jonashackt
jonashackt / HelloRouter.java
Last active Nov 29, 2020
DevOps lecture: Spring Boot reactive router & handler code
View HelloRouter.java
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.*;
import reactor.core.publisher.Mono;
@Component
public class HelloRouter {
@jonashackt
jonashackt / HelloRouterTest.java
Last active Nov 29, 2020
DevOps lecture: Spring Boot reactive test code
View HelloRouterTest.java
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class HelloRouterTest {
@Test void
View sdkman-cheatsheet.sh
# Use another Java version as currently active
sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 15.0.1.j9 | adpt | | 15.0.1.j9-adpt
| | 15.0.1.hs | adpt | installed | 15.0.1.hs-adpt
| | 14.0.2.j9 | adpt | | 14.0.2.j9-adpt
@jonashackt
jonashackt / mac-cheatsheet.sh
Last active Nov 4, 2020
Collecting some Mac related terminal commands I regularly need
View mac-cheatsheet.sh
# Show all processes that use a port
lsof -i 4tcp
# or
netstat -anvp tcp | awk 'NR<3 || /LISTEN/'
@jonashackt
jonashackt / backup_osmc.md
Last active Sep 26, 2020
Raspberry OSMC Backup
View backup_osmc.md