5

Deploying Serverless Quarkus Applications

 3 years ago
source link: http://heidloff.net/article/deploying-serverless-quarkus-applications/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Deploying Serverless Quarkus Applications

Quarkus is a Kubernetes native Java stack crafted from the best of breed Java libraries and standards. Since Quarkus applications start very fast and consume little memory, they are well suited for serverless workloads.

IBM’s new offering Code Engine is a fully-managed serverless platform that runs your containerized workloads without having to understand any of the Kubernetes complexity. As developer you can focus on your business logic without having to worry about infrastructure.

Let’s take a look at a simple sample. Quarkus provides a Start Coding page to generate new Quarkus applications. The generated code can directly be put on GitHub.

code-engine-quarkus-1.png

Dockerfiles are generated for the different ways to run Quarkus, for example in the JVM or binary modes. Unfortunately these Dockerfiles assume that the code is built previously with Maven which wouldn’t work when deploying Java applications to serverless platforms like Code Engine.

Instead the Maven build step needs to be added to the Dockerfile. Check out my article Multistage Dockerfiles for Quarkus for details.

Once you have defined your image, you can navigate to the dashboard of Code Engine. From the landing page pick ‘Run your source code’.

code-engine-quarkus-2.png

Choose ‘Application’ and create a new project.

code-engine-quarkus-3.png

In the build details refer to your GitHub repo.

code-engine-quarkus-4.png

Define the location of your multi-stage Dockerfile and choose ‘Medium’ in the combobox at the bottom.

Note: The label ‘Runtime resources’ will be changed soon, since these are actually not the runtime resources, but the resources used for building the image. That’s why you need ‘Medium’ and not only ‘Small’.

code-engine-quarkus-5.png

The actual runtime resources are defined on the Configuration page. I use 1024 MiB, but obviously this is too much for simple Quarkus applications. 128 MiB is the minimum you can choose here.

code-engine-quarkus-6.png

Next you need to define your image registry, for example quay.io.

code-engine-quarkus-7.png

Enter your namespace and image name.

code-engine-quarkus-8.png

After this you can start the deployment. Depending on the size of your application, the build can take some time. After the build is done, the route will be created, so that you can access your application.

code-engine-quarkus-9.png

To find out more, check out the documentation or just give it a try. It’s really easy and IBM provides a free trial account without requiring a credit card.

Share this:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK