/seed-jee

Seed for Systelab JEE projects

Primary LanguageJavaMIT LicenseMIT

Build Status Build status Codacy Badge Known Vulnerabilities

seed-jee — Seed for JEE Systelab projects

This project is an application skeleton for a typical JEE backend application. You can use it to quickly bootstrap your projects and dev environment.

The seed contains a Patient Management sample application and is preconfigured to install the JEE framework and a bunch of development and testing tools for instant development gratification.

The app just shows how to use different JEE standards and other suggested tools together:

You can also check out our Spring Boot implementation.

Getting Started

Prerequisites

You need git, OpenJDK 11 and Maven.

Ensure the environment variables are properly set: JAVA_HOME, MAVEN_HOME, M2_HOME and PATH.

Clone seed-jee

Clone the seed-jee repository using git.

git clone https://github.com/systelab/seed-jee.git
cd seed-jee

If you just want to start a new project without the seed-jee commit history then you can use the parameter "--depth=1" to only pull down one commit worth of historical data.

Install Dependencies

In order to install the dependencies you must run:

mvn install

In case of issues, refer to the Troubleshooting section

Run with Cargo

Run the application with Cargo using the following command:

mvn clean package cargo:run

In order to check it's properly deployed, check the server at http://127.0.0.1:13080/seed/swagger/

Use 'Systelab' as username and password

Considerations:

The port could changes as it is defined in the pom.xml file

If you are using the angular seed, remember to set the API_BASE_PATH in the seed-angular environment to match the same port.

As an alternative to use Cargo, you can also install a WildFly and MySQL database, and deploy the generated war file afterwards.

To generate the reports including the Allure test report, you must run "mvn site". Once the reports have been generated, you can check them by browsing the folder target/site and opening the file allure-maven.html

You need to install the Lombok library on your IDE such as eclipse.

Automatic Test

Refer to the test package at /src/test

Docker

Build docker image

There is an Automated Build Task in Docker Cloud in order to build the Docker Image. This task, triggers a new build with every git push to your source code repository to create a 'latest' image. There is another build rule to trigger a new tag and create a 'version-x.y.z' image

You can always manually create the image with the following command:

docker build -t systelab/seed-jee .

The image created, will contain a wildfly server with the application war deployed.

Run the container

docker run -e MYSQL_HOST=ip -e MYSQL_PORT=port -e MYSQL_DATABASE=database -e MYSQL_USER=user -e MYSQL_PASSWORD=password -p 8443:8443 -p 8080:8080 systelab/seed-jee

The app will be available at https://localhost:8443 http://localhost:8080

In the github root folder, you will find information on how to use docker-compose, a tool for define and run multi-container Docker applications.

Certificate

A self signed certificate is provided in order to show use how to setup the application.

The certificate was generated with the following commands:

keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 365 -keysize 2048
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype pkcs12

Do not use the certificate provided in production and never put any secret in your configuration files.

Kubernetes

In the github root folder, you will find information on how to run the solution in a Kubernetes cluster.

Troubleshooting

Maven in Windows

If you are working in a Windows environment, you could have some issues if the maven local repository is in a folder with a name containing white spaces (quite common as the default value is ${user.home}/.m2/repository). In order to avoid this, it is fully recommended that you specify another folder in your maven settings.xml file.

For example:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>/dev/repo</localRepository>

  ...