Skip to content

kameshsampath/jo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jo

Highly inspired from ko, a similar tool for deploying any Java microservices (uber jars) as Kubernetes application

Important
Under active development so lots change and at times breaking :D

Pre-requisites

Note
If you are using Docker for Windows, then Windows subsytem for Linux (WSL) is recommended.

Build jo

git clone https://github.com/kameshsampath/jo
cd jo
export $PROJECT_HOME=`pwd`
./mvnw clean install -DskipTests

Start Kubernetes Cluster

Important
Currently the application is tested only with local clusters. Working on to add support to hosted clusters
$PROJECT_HOME/bin/start-kind.sh

Kubernetes Example

Jbang

cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-jbang.yaml"

The command above should do the deployment of the jbang script github.com/kameshsampath/jo/examples/http/server.java as Kubernetes application.

Quarkus

Important

Since quarkus does not do uberjar by default, you need to configure Quarkus app to build uberjar so that the runner jar is deployed with classifier:

<plugin>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-maven-plugin</artifactId>
  <version>${quarkus-plugin.version}</version>
  <executions>
    <execution>
      <goals>
        <goal>build</goal>
      </goals>
    </execution>
  </executions>
  <!-- Make your application deployable as uber jar -->
  <configuration>
    <uberJar>true</uberJar>
  </configuration>
</plugin>
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-quarkus.yaml"

The command above should do the deployment of the Quarkus Applicationt github.com/kameshsampath/jo-quarkus-helloworld as Kubernetes application.

SpringBoot

cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-spring-boot.yaml"

The command above should do the deployment of the Quarkus Applicationt github.com/kameshsampath/jo-sb-helloworld as Kubernetes application.

Wait for the hello-world pod to come up:

watch kubectl get pods

Once the pods is up try creating the Service and Ingress to access it:

cd $PROJECT_HOME
kubectl apply --filename="$PROJECT_HOME/examples/kubernetes/service.yaml"

Now doing curl localhost/greeting should show a response like Hello World or Hello from Quarkus or Hello from SpringBoot

Knative Example

Jbang

cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-jbang.yaml"

The command above should do the Knative service deployment of the jbang script github.com/kameshsampath/jo/examples/http/server.java as Kubernetes application.

Quarkus

cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-quarkus.yaml"

The command above should do the Knative service deployment of the Quarkus Application github.com/kameshsampath/jo-quarkus-helloworld as Kubernetes application.

SpringBoot

cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-spring-boot.yaml"

The command above should do the Knative service deployment of the Quarkus Applicationt github.com/kameshsampath/jo-sb-helloworld as Kubernetes application.

Wait for the greeter Knative service to come up:

watch kubectl get pods

Once Knative service is up access the service using:

SVC_URL=$(kubectl get ksvc greeter -ojsonpath="{.status.url}")
# the curl will return an Hello World response
curl $SVC_URL

The curl $SVC_URL should show a response like Hello World or Hello from Quarkus or Hello from SpringBoot

Powered by