Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / start-db.sh
Last active October 1, 2021 02:05
Start Postgres DB in Docker
#!/bin/bash
docker run --rm --name postgres -p 5432:5432 -v /tmp/app/db:/var/lib/postgresql/data -e POSTGRES_PASSWORD=root -e POSTGRES_USER=postgres -e PGDATA=/var/lib/postgresql/data/pgdata postgres:bullseye
@jkeam
jkeam / s2i-exporter.sh
Last active October 30, 2021 21:48
After a source to image, this script will export all the import yamls
#!/bin/bash
set -e -u -o pipefail
function export_objects() {
app_name=$1
namespace=$2
items=( service deployment buildconfig imagestream route )
for i in "${items[@]}"
do
@jkeam
jkeam / Dashbuilder-Quickstart-Readme.md
Last active February 14, 2022 17:53
Dashbuilder Quickstart

Dashbuilder Quickstart

There are a few pieces to this. We need a KIE server running to generate data and then we need Dashbuilder to connect to that database and visualize some of the data. Also I'll be starting a few services which I'll explain below using Docker. I prefer to have them run foreground instead of background so I can send the SIGTERM signal with my keyboard to end it.

Database

  1. Start Postgresql DB (in one terminal)
mkdir /tmp/app/db
docker run --rm --name postgres -p 5432:5432 -v /tmp/app/db:/var/lib/postgresql/data -e POSTGRES_PASSWORD=root -e POSTGRES_USER=postgres -e PGDATA=/var/lib/postgresql/data/pgdata postgres:9.4.5
@jkeam
jkeam / himss_2022_scm_integration.md
Last active March 3, 2022 15:45
Installing HIMSS 2022 SCM Integration Demo

Installing HIMSS 2022 SCM Integration Demo

For the most part, just follow the instructions found here. GitHub Link

Setup

I'm assuming you have oc and are logged in as a cluster-admin to an OpenShift 4.9 cluster. Also assuming you have git so you can check out the github project.

The only extra setup instructions I had to perform was ansible related (notice jmespath which is required):

python3 -m venv venv
@jkeam
jkeam / test-fips.sh
Created March 1, 2022 18:38
Test if OCP is FIPs enabled
oc get cm cluster-config-v1 -n kube-system -o json | jq -r '.data' | grep -i "fips"
@jkeam
jkeam / anonymous_class.rb
Created April 14, 2022 20:02
Quick demonstration on how to create temporary anonymous classes as well as how to extend them
# encoding: UTF-8
# frozen_string_literal: true
Metric = Class.new do
def destroy
puts 'Metric destroyed'
end
end
MetricWithFiber = Class.new(Metric) do
@jkeam
jkeam / web_terminal_operator.md
Last active June 7, 2022 22:35
Web Terminal Operator Readme

Web Terminal Operator Readme

This is a really cool feature available within OpenShift that allows users to be able to use the Web Console and quickly pop open a terminal for those times when just typing the command is easier than finding the corresponding buttons in the browser.

For a quick brief intro, read this.

New App

For most oc commands, this works beautifully. There was one use case we ran into at our customer site where they wanted to hit their self-hosted GitHub repository when running oc new-app. Of course, their enterprise had their own certificate bundle that needed to be trusted.

Typically, within OpenShift, you would do something like this, which we did, however that did not work with this terminal pod.

@jkeam
jkeam / validation-tests.cs
Created July 15, 2022 15:14
Validation tests to add for todo application, found here: https://github.com/jkeam/TodoList
// Snippet to add to TodoListTest/Tests.cs
[Test]
public void NotAllowCreateShortTodo()
{
using (var scope = testContext.Services.CreateScope())
{
var service = scope.ServiceProvider.GetRequiredService<IDbContextFactory<DatabaseContext>>();
using (var context = service.CreateDbContext())
{
@jkeam
jkeam / git-credentials-secret.yaml
Last active July 19, 2022 05:45
Secret needed by Dev Spaces for GitHub access.
apiVersion: v1
kind: Secret
metadata:
name: git-credentials-secret
labels:
controller.devfile.io/git-credential: 'true'
controller.devfile.io/watch-secret: 'true'
annotations:
controller.devfile.io/mount-path: /etc/secret
stringData:
@jkeam
jkeam / asp_dotnet_blazor_workshop_prep.md
Last active August 25, 2022 02:32
ASP.NET Core 6 Blazor App Workshop - Instructor Prep Readme

ASP.NET Core 6 Blazor App Workshop - Instructor Prep Readme

These are the instructor notes for giving a hands-on workshop specifically for .NET developers doing cloud native development on OpenShift. OpenShift tends to have lots of enablement material around Java, Go, Python, and Ruby but not so much for .Net; even though it is a first class citizen on the platform. Microsoft has done a great job around making .Net Core 5 and after being cross platform and Linux friendly. The development experience using .NET with its live reloading makes it wonderful to use and being able to get that same experience even though the application is running on OpenShift and not a developer's local laptop is a critical part of cloud native development. Being able to utilize the resources of the cloud for development and for cloud deployment, but not sacrificing on the development experience is essential.

These notes are for an instructor that wants to prepare and run this workshop. This workshop gives developers first ha