Giter Site home page Giter Site logo

jo's Introduction

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

jo's People

Contributors

kameshsampath avatar manusa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

marcnuri-forks

jo's Issues

Could not find artifact io.quarkus:quarkus-maven-plugin:jar:999-SNAPSHOT

Issue

./mvnw clean install -DskipTests
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< dev.kameshs:jo >---------------------------
[INFO] Building jo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.quarkus:quarkus-maven-plugin:jar:999-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.162 s
[INFO] Finished at: 2020-06-11T10:45:45+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin io.quarkus:quarkus-maven-plugin:999-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact io.quarkus:quarkus-maven-plugin:jar:999-SNAPSHOT -> [Help 1]

Even If I change the version SNAPSHOT of quarkus, we got next another error

./mvnw clean install -DskipTests
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< dev.kameshs:jo >---------------------------
[INFO] Building jo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.quarkus:quarkus-bootstrap-maven-resolver:jar:1.5.0.Final is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.877 s
[INFO] Finished at: 2020-06-11T11:37:10+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project jo: Could not resolve dependencies for project dev.kameshs:jo:jar:0.0.1-SNAPSHOT: Failure to find io.quarkus:quarkus-bootstrap-maven-resolver:jar:1.5.0.Final in https://jitpack.io was cached in the local repository, resolution will not be reattempted until the update interval of jitpack.io has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Error downloading file https://github.com/kameshsampath/jo/examples/http/server.java: java.io.FileNotFoundException: /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T/kameshsampath-jo-examples-http/server.java (No such file or directory)

Issue

java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-jbang.yaml"
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2020-06-18 13:27:52,704 INFO  [io.quarkus] (main) jo 0.0.1-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 0.853s. Listening on: http://0.0.0.0:8080
2020-06-18 13:27:52,722 INFO  [io.quarkus] (main) Profile prod activated.
2020-06-18 13:27:52,722 INFO  [io.quarkus] (main) Installed features: [cdi, picocli, rest-client, resteasy, resteasy-jsonb, smallrye-context-propagation, smallrye-fault-tolerance]
2020-06-18 13:27:54,096 INFO  [dev.kam.act.JBangImageBuilder] (main) Destination file /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T/kameshsampath-jo-examples-http/server.java
2020-06-18 13:27:54,097 ERROR [dev.kam.act.JBangImageBuilder] (main) Error downloading file https://github.com/kameshsampath/jo/examples/http/server.java: java.io.FileNotFoundException: /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T/kameshsampath-jo-examples-http/server.java (No such file or directory)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
	at java.base/java.io.FileWriter.<init>(FileWriter.java:96)
	at dev.kameshs.actions.JBangImageBuilder.downloadScriptFile(JBangImageBuilder.java:165)
	at dev.kameshs.actions.JBangImageBuilder.newBuild(JBangImageBuilder.java:66)
	at dev.kameshs.actions.JBangImageBuilder_ClientProxy.newBuild(JBangImageBuilder_ClientProxy.zig:157)

No folder kameshsampath-jo-examples-http/ exists under /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.