This demo application supports three user roles:
- USER can CRUD own data
- MANAGER can CRU other users' data
- ADMIN can CRUD everybody's data
POST /users create a new user
''
Java, Spring, Spring Security, Hibernate, Bean Validation, Jackson, JWT, Gradle, Liquibase, Docker
- Install your tools 1.1 Gradle Manually: http://gradle.org/gradle-download/
With Homebrew:
brew install gradle
1.2 Docker Engine and Docker Compose http://docs.docker.com/
Docker allows to manage the infrastructure required to run your app in a system-independent fashion. Compose is a tool for defining and running multi-container Docker applications.
In this case, you will be running two containers: a Tomcat container hosting the application and a MySQL container with the database. Docker handles images for the systems,
and Compose takes care of the choreography of multiple containers talking to each other.
See docker/appserver/Dockerfile and docker-compose.yml
- Bring Docker environments up From the project root directory
docker-compose up
A running db instance is required for a successful build as during the build process Liquibase will need it to run database management scripts, generate schema and load application seed data.
- Build the application From the project root directory
gradle build
build/exploded is the application working folder which is mapped directly to the Tomcat webapps folder. This is where the application runs from.
Every time the application is rebuilt Tomcat will pick up the changes.
build/logs is mapped to Tomcat logs folder and allows to view log files without remoting into the container.
See docker-compose.yml for configuration details.
- Restart Tomcat From the project root directory
docker restart tomcat
This is necessary since when the Tomcat container was first started the application was not yet built. Now that build/exploded folder has the binaries, we need Tomcat to reload load this context.
Remote debugging is enabled in Tomcat on port 9001, see docker/appserver/Dockerfile.
Remoting into a Docker container is possible with the following command:
docker exec -it <container_name> bash
Root password for MySQL instance is specified in docker-compose.yml