Skip to content

Instantly share code, notes, and snippets.

View cvicens's full-sized avatar

Carlos Vicens cvicens

  • Red Hat
  • Madrid
View GitHub Profile
@cvicens
cvicens / build.gradle
Created July 1, 2019 12:52
Gradle with a task like fabric8:deploy... sort of...
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
@cvicens
cvicens / actuator-prometheus-service-monitor.yaml
Last active June 16, 2020 12:06
Prometheus Operator sample ServiceMonitor for Spring Boot
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
k8s-app: spring-boot-actuator-monitor
name: spring-boot-actuator-monitor
namespace: monitoring
spec:
endpoints:
- interval: 30s
#!/usr/bin/env bash
# Automating https://blog.dekstroza.io/ulimit-shenanigans-on-osx-el-capitan/
echo "Updating the ulimits on OSX to be able to run RHAMT tests."
sudo bash -c 'cat >/Library/LaunchDaemons/limit.maxfiles.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
apiVersion: v1
kind: BuildConfig
metadata:
name: inventory-spring-boot-maven-pipeline-complex
spec:
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
// Don't forget to run the commands to create the dev project, and grant the needed roles to the service accounts
// $ oc create sa cicd-central-jenkins -n cicd-ext
#!/bin/sh
export PROJECT_NAME="fruits-97"
export MY_DATABASE_SERVICE_HOST="my-database.${PROJECT_NAME}"
export MY_DATABASE_SERVICE_PORT=5432
export DB_USERNAME=luke
export DB_PASSWORD=secret
mvn spring-boot:run -Dspring-boot.run.profiles=openshift -Popenshift -DskipTests
package com.redhat.his.service;
import ...
@Configuration
public class KafkaConfig {
@Value("${kafka.bootstrap-servers}")
private String kafkaBrokers;
import ...
public class HL7ToEvents extends RouteBuilder {
@Override
public void configure() throws Exception {
from("kafka:{{kafka.from.topic}}?brokers={{kafka.bootstrap-servers}}&groupId={{kafka.groupId}}")
.routeId("hl7-to-patient-info")
.onException(Exception.class)
.handled(true)
import ...
public class EventsToTelegramBot extends RouteBuilder {
@Override
public void configure() throws Exception {
from("kafka:{{kafka.from.topic}}?brokers={{kafka.bootstrap-servers}}&groupId={{kafka.groupId}}")
.routeId("events-to-bot")
.onException(Exception.class)
.handled(true)
# 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