payara-micro-docker-starter-kit

Java ee microservices starter-kit with payara-micro and docker

View on GitHub

Java EE micro service starter for kit with docker, payara micro, arquillian and AWS Cloud

Requirements:

  1. JDK 1.8
  2. Gradle 3.x
  3. Docker
  4. AWS Cli

Setting up properties

Before changing properties you need to setup:

Change aws config in gradle.properties:

groupName=icoder
awsAccessKey=YOUR_ACCESS_KEY
awsSecretKey=YOUR_SECRET_KEY
## EC2 Container Repository
awsECR=YOUR_EC_REPOSITRY_URL
## Elastic beanstalk s3 deployment bucket
awsEBSBucket=YOUR_AWS_DEPLOYMENT_BUCKET_FOR_ELASTIC_BEANSTALK
## Elastic beanstalk config
awsEBSApp=YOUR_ELASTIC_BEANSTALK_APPLICATION_NAME
awsRegion=eu-central-1

Building project

gradle clean build -Penv=local

Starting embedded server

Server will be running on default port 8080

gradle startServer

Starting unit tests:

gradle test

Starting integration test with arquillian:

Before tests docker compose hast to be started because you may need an local data store which you can run in docker.

Run compose once:

gradle dockerCompose

Then start tests:

gradle itest

Starting/stopping docker server

gradle startDocker
gradle stopDoker

Publishing to ecr repository

This command creates elastic beanstalk application deployment version and publish baked container to EC2 Container Repository:

gradle clean publishToECR -Penv=prod 

Example running apps manually:

You can simply run them as jar applications or you can configure your ide to run jar application so you can debug it.

gradle build -Penv=local
java -jar ./pajara-micro.jar --deploy ./build/libs/starter-1.0.0.war

note if you did not download payara micro run

gradle downloadPayaraMicro