Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
View odo-dotnet-demo.txt
# Get odo for linux
$ curl -OL https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.0.0/odo-linux-amd64 && mv odo-linux-amd64 odo && chmod u+x odo
$ export PATH=$PATH:$(pwd)
$ odo version
# Use git to check out the .NET Core application
$ git clone https://github.com/redhat-developer/s2i-dotnetcore-ex
$ cd s2i-dotnetcore-ex/app
$ git checkout dotnetcore-3.1
@jkeam
jkeam / Dockerfile-forever
Created Aug 8, 2022
Dockerfile to run container forever
View Dockerfile-forever
FROM docker.io/redhat/ubi8-micro
USER nobody
ENTRYPOINT ["tail", "-f", "/dev/null"]
@jkeam
jkeam / drop-forwarded-headers.java
Last active Aug 3, 2022
Drop all forwarded headers
View drop-forwarded-headers.java
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.context.annotation.Bean;
@Bean
public ForwardedHeaderFilter disabledForwardedHeaderFilter() {
ForwardedHeaderFilter filter = new ForwardedHeaderFilter();
filter.setRemoveOnly(true);
return filter;
}
@jkeam
jkeam / create-quarkus-project.sh
Last active Aug 2, 2022
Quarkus Command Examples
View create-quarkus-project.sh
#!/bin/bash
# standard api
quarkus create app --verbose --refresh --maven --java=11 --package-name=io.keam \
--extensions=resteasy-reactive,resteasy-reactive-jackson,hibernate-orm-rest-data-panache,jdbc-postgresql,smallrye-jwt,smallrye-jwt-build \
--app-config=quarkus.datasource.db-kind=postgresql,quarkus.datasource.username=root,quarkus.datasource.password=root,quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/todo_app,quarkus.hibernate-orm.database.generation=drop-and-create \
io.keam:quarkus-todo:1.0.0-SNAPSHOT
# reactive api
# quarkus create app --verbose --refresh --maven --java=11 --package-name=io.keam \
@jkeam
jkeam / firefox-websockets.md
Created Jul 19, 2022
How to enable insecure websockets in Firefox.
View firefox-websockets.md
  1. Go to this url in your Firefox browser: about:config
  2. Then search for network.websocket.allowInsecureFromHTTPS and toggle it on
@jkeam
jkeam / asp_dotnet_blazor_workshop_live.md
Last active Jul 19, 2022
ASP.NET Core 6 Blazor App Workshop - Instructor Live Readme
View asp_dotnet_blazor_workshop_live.md

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

Live workshop notes and flow are below. Use this as a reference day of the workshop to make sure you hit all the main points.

Introduction

Explain application here

Developer Setup

  1. Setup Developer Workspace (30min)
@jkeam
jkeam / asp_dotnet_blazor_workshop_prep.md
Last active Jul 22, 2022
ASP.NET Core 6 Blazor App Workshop - Instructor Prep Readme
View asp_dotnet_blazor_workshop_prep.md

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

@jkeam
jkeam / git-credentials-secret.yaml
Last active Jul 19, 2022
Secret needed by Dev Spaces for GitHub access.
View git-credentials-secret.yaml
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 / validation-tests.cs
Created Jul 15, 2022
Validation tests to add for todo application, found here: https://github.com/jkeam/TodoList
View validation-tests.cs
// 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 / web_terminal_operator.md
Last active Jun 7, 2022
Web Terminal Operator Readme
View web_terminal_operator.md

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.