This project is the backend part of the Software: the REST API that sits on a server receiving calls from two types of clients:
- Chronometers that sends the pings to compute the lap times
- End users that consult the lap times or Administrators
The backend part is based on Quarkus that receives API calls implemented with Jax-RS. Persistence is implemented with Hibernate and JPA. The testing part of the project is based on JUnits (very few), QuarkusTest and Python end to end tests that simulate real activity.
- Java 11
- Maven 3.6
mvn clean verify
The CI is done thanks to GitHub actions and runs the following:
- Server tests
- JUnits
- Quarkus Integration tests
- A docker image is built with the Python Integration Tests integrated and pushed to dockerhub along with the server itself
- Code coverage for sever side code is gathered
- A staging environment is started on a private Kubernetes cluster
- Python integration tests are ran against this staging environment
- Client tests
- When the staging environment is loaded, the client is started in demo mode which simulates random Bluetooth reception
- Auto update of the client is tested
- Test coverage is gathered and sent to codecov
- Releasing
- Version is bumped automatically. Add
#major
or#patch
in your commit tags if you want to bump the corresponding number. By default, the minor is bumped. - Repository is tagged for each version
- All changes are gathered in a ChangeLog and GH releases are used
- Builds of the
master
branch are directly loaded on the Production environment
- Version is bumped automatically. Add
There are three profiles. See in src/main/resources/application.properties
.
mvn quarkus:dev
Note: you can connect your IDE for debugging on port 5005.
First:
kubectl port-forward -n teknichrono $(kubectl get pod -n teknichrono -l app=mysql -o jsonpath='{.items[0].metadata.name}') 3306:3306
kubectl port-forward -n teknichrono service/mysql-service 3306:3306
then
mvn -Dquarkus.datasource.password=xxx quarkus:dev -Dquarkus-profile=localmariadb
or
java -Dquarkus.datasource.password=xxx -Dquarkus-profile=localmariadb -jar target/teknichrono-runner.jar
mvn clean test
mvn clean verify
Run the E2E tests : ./src/test/scripts/bash/moto_tests.sh
(or any bash script in this folder)
TODO List of the REST API services here
For the time being, you can have a look in: src/main/java/org/trd/app/teknichrono/rest
- Thorntail
- thorntail documentation
- create-a-datasource
- command_line
- thorntail-examples
- https://docs.thorntail.io/
- https://docs.thorntail.io/2.2.0.Final/#configuring-a-thorntail-application-using-yaml-files_thorntail
- https://docs.thorntail.io/2.2.0.Final/#using-thorntail-maven-plugin_thorntail
- https://github.com/thorntail/thorntail/blob/master/docs/index.adoc
- JPA
- Examples
- thorntail documentation
- Fabric8
- OpenShift io
- GitHub setup
- Jenkins
- Database
- Python
- Proper health check as per https://quarkus.io/guides/health-guide
- Remote dev mode
OpenShift support has been discarded for Kubernetes plain commands. In case it is needed, here were the commands for OpenShift:
oc new-build --binary --name teknichrono-quarkus --to='teknichrono-quarkus:local'
oc patch bc/teknichrono-quarkus -p "{\"spec\":{\"strategy\":{\"dockerStrategy\":{\"dockerfilePath\":\"src/main/docker/Dockerfile\"}}}}"
oc start-build teknichrono-quarkus --from-dir=. --follow
oc port-forward mariadb-3-qgvwj 3306:3306
The project relies on the Kubernetes plugin to run its CI in Jenkins. The podTemplate referenced here has the following settings:
podTemplate(label:label , cloud: 'openshift', serviceAccount:'jenkins', containers: [
containerTemplate(name: 'maven', image: 'maven:3.6-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'python', image: 'docker.io/python:3.6-slim', ttyEnabled: true, command: 'cat')]) {
...
}
I did not provide the configuration inline because, I integrated a Nexus proxy to speed up the builds in my case. It requires providing a custom build image in order to customize the settings.xml
.
oc new-app --image-stream=teknichrono-quarkus:local
oc expose service teknichrono-quarkus --name=teknichrono-quarkus-route --port=8080 --hostname=teknichrono-quarkus.h-y.fr
- Delete
src/main/webapp
- In Ecipse run Forge (Command + ' or Ctrl + 4) with default settings and AngularJS