https://github.com/excilys/training-java
- Prerequisite
- Installation
- You need to have maven installed, and the JRE 8 in order to compile the project.
- In order to test the project, you need a mysql database.
- In order to run the application, you need a tomcat server and a mysql server. The other way just require you to have maven
There is two way to run this project : with or without docker.
you can pull the images : mlemaile/mysql mlemaile/mysql-test mlemaile/tomcat mlemaile/javamaven mlemaile/jenkins
or build them via the dockerfile in dockerbuild/*/Dockerfile
Once you have the image, you can run them with the command indicated in each Dockerfile. You first need to set up two network, as indicated in the below images:
You also need to set up two named volumes. You can find all needed command in the file dockerbuild/binding You don't need to run the javamaven images, jenkins we'll run it for you, using DooD (Docker outside of Docker)
Just run both databases, tomcat, and jenkins. You now need to configure a bit jenkins. Install some plugins : checkstyle, Junit, and github. then create a new job, using the pipeline template. You just need to copy/paste the pipeline from the dockerbuild/jenkins/job_configuration.txt. Then run it, and it will deploy the application on the tomcat container.
Change the src/main/resources/hikari.properties to match your configuration. You can use dockerbuild/mysql/*.sql files to help setting up your database.
Package the project, using "mvn -DskipTests package" And deploy this into the tomcat container.
you need a mysql database, with a user defined in it. Edit both src/test/resources/database.properties and src/test/resources/hikari.properties. You can use dockerbuild/mysqlTest/*.sql to set up the database. Then run "mvn test"
