GithubHelp home page GithubHelp logo

elinavalieva / quarkus-quickstarts Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 5.0 4.52 MB

:cyclone: Openshift and AWS Lambda Deployment With Quarkus

Home Page: https://dzone.com/articles/openshift-and-aws-lambda-deployment-with-quarkus

Java 43.86% Dockerfile 0.31% JavaScript 4.81% HTML 0.68% Vue 14.63% CSS 35.71%
quarkus quarkus-gradle openshift openshift-deployment aws-lambda aws-lambda-java aws-deploy docker-jib quarkus-quickstarts

quarkus-quickstarts's Introduction

Quarkus QuickStart Project - Simple Blog

Java CI with Gradle Update Docker Hub Description Quarkus

Simple blog api with Quarkus - the Supersonic Subatomic Java Framework.

 

Prerequisites ❗

  1. JDK 11 at least - for running app
  2. Gradle 6+ - for building package
  3. Docker - for containerization
  4. OpenShift Client - for deploying app on OpenShift
  5. AWS CLI, AWS SAM CLI - for deploying AWS Lambda

 

Quarkus lifecycle 🔨

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./gradlew quarkusDev

Packaging and running the application

The application can be packaged using ./gradlew quarkusBuild. It produces the blog-1.0.0-SNAPSHOT-runner.jar file in the build directory.

./gradlew quarkusBuild

java -jar build/blog-1.0.0-SNAPSHOT-runner.jar

Creating a native executable

Using GraalVM:

./gradlew build -Dquarkus.package.type=native

Without GraalVM:

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true

Docker run

Run server:

docker run -p 8090:8090 elvaliev/blog-api

Run application with the UI:

docker-compose up

OpenApi and Health Check

Application support open api - swagger and health check

 

Docker build 🐳

Build and run image manually

Application supports multiple Dockerfiles with different extentions .jvm, .multistage and .native. Extention .jvm used in quarkus-container-image-docker in packaging with next push to docker registry.

Specify Dockerfile native or multistage build in command parameter with option -f and run image:

docker build -t blog-api -f src/main/docker/Dockerfile.multistage .

docker run -i --rm -p 8090:8090 blog-api

Push your image with Quarkus

Override parameters in application.properties:

Properties Description
quarkus.container-image.name Name of your image [application name]
quarkus.container-image.tag Version [latest]
quarkus.container-image.registry Docker registry [docker.io]
quarkus.container-image.username Credentials
quarkus.container-image.password Credentials
quarkus.container-image.push Flag for pushing image [false]

 

To push a container image for your project, quarkus.container-image.push=true needs to be set using any of the ways that Quarkus supports:

./gradlew  quarkusBuild -Dquarkus.container-image.username=<USERNAME> \
                        -Dquarkus.container-image.password=<PASSWORD> \
                        -Dquarkus.container-image.push=true

 

Openshift deployment 🚩

Deployment using kubernetes template:

oc create -f build/kubernetes/openshift.yml

oc tag elvaliev/blog-api blog:1.0.0-SNAPSHOT

Note: from version 1.5.1 use for tagging image stream: latest version instead of 1.0.0-SNAPSHOT

Deployment using docker image:

oc new-app elvaliev/blog-api:latest

oc expose svc/blog-api

Deployment using template:

oc tag elvaliev/blog-api:latest

oc process NAMESPACE_NAME=<OPENSHIFT-PROJECT> \
           SELECTOR_APP_NAME=<SELECTOR> \
           HOST_NAME=<APPLICATION_HOST> \
           -f OpenShiftTemplate.yaml | oc apply -f-

 

AWS deployment 🚩

Enable property awsLambdaEnabled = true when you package jar

./gradlew -PawsLambdaEnabled=true quarkusBuild

For native build use template build/sam.native.yaml.

sam local start-api --template build/sam.jvm.yaml

sam package --template-file build/sam.jvm.yaml --output-template-file packaged.yaml --s3-bucket <YOUR_S3_BUCKET>

sam deploy --template-file packaged.yaml --capabilities CAPABILITY_IAM --stack-name <YOUR_STACK_NAME>

To avoiding timeout error (502 - BAD GATEWAY) - increase Timeout in build/sam.jvm.yaml

quarkus-quickstarts's People

Contributors

dependabot[bot] avatar elinavalieva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.