Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 3.01 KB

File metadata and controls

96 lines (69 loc) · 3.01 KB

Devops-Challenge Project

CircleCI

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

Running the application in dev mode

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

mvn compile quarkus:dev

NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/dev/.

Preflight checklist

Checking known OWASP vulnerabilities using:

mvn verify -Dcheckstyle.skip -DskipUTs -DskipPTs -DskipFTs

Verifying dependencies updates using:

mvn versions:display-dependency-updates

Checking plugin updates using:

mvn versions:display-plugin-updates

Verifying checkstyle using:

mvn validate

Unit tests

Run Unit tests using:

mvn test -DskipDCs -Dcheckstyle.skip -DskipFTs -DskipPTs

Functional and Integrations tests

Run Functional and Integrations using:

mvn verify  -DskipDCs -Dcheckstyle.skip -DskipUTs -DskipPTs

Building a Docker image

You can build a Docker image using:

mvn clean package -Dquarkus.container-image.build=true

It builds a Docker image and tag as `jgaspar/devops-test:1.0.0

Running the application

Prerequisites

This application requires a PostgreSQL database server. Do you need a ready-to-use PostgreSQL server to try out the API?

docker run -d --restart always --name postgres \
-e POSTGRES_DB=devops_test \
-e POSTGRES_USER=devops \
-e POSTGRES_PASSWORD=password \
--network host postgres:10.6

You can then run the application using:

docker run -d --rm --network host jgaspar/devops-test:1.0.0

Access the API

You can test the API via a user-friendly user interface named Swagger UI. Swagger UI is a great tool permitting to visualize and interact with the API. The UI is automatically generated from the application OpenAPI specification. Once the application is started, you can go to http://localhost:8080/swagger-ui and play with the API.

Deploy the API in Kubernetes

By adding these dependencies, we enable the generation of Kubernetes manifests each time we perform a build while also enabling the build of a container image using Jib. For example, following the execution of ./mvnw package, you will notice amongst the other files that are created, two files named kubernetes.json and kubernetes.yml in the target/kubernetes/ directory.

The generated manifest can be applied to the cluster from the project root using kubectl:

kubectl apply -f target/kubernetes/kubernetes.yml

This assumes that a .kube/config is available in your user directory that points to the target Kubernetes cluster. In other words the extension will use whatever cluster kubectl uses.