Tips and References
Adding Dependencies
The starter project uses gradle. To add a dependency, such as quartz, modify the dependencies section of the build.grade file.
dependencies { ... implementation 'org.quartz-scheduler:quartz:2.3.2' implementation 'org.springframework.boot:spring-boot-starter-quartz' ... }
"implementation" (if you don't need transitivity)Â or "api" (if you need transitivity) replaces "compile", which is now deprecated but still works in gradle builds. See this Stack Overflow article.
To add that library to your classpath in Eclipse, right click on the project (must be a gradle project) → Gradle → Refresh Gradle Project
Adding external propertiesÂ
Spring Boot uses application.properties by default. With this project, we're using application.yml, which is equivalent to application.properties. Environment specific properties must go in docker-compose.yml.
Spring boot relaxed binding properties configuration
If you add environment properties to the docker-compose.yml or the secrets file, you need to bring the project stack down and then back up for the changes to take effect.
Deployment Process
For TEST, the mods should be in it's own branch.
- Commit all changes to local repo
- Push to the remote repo
- This will trigger a TEST jenkins build (continuous integration) to the TEST swarm for that branch
- Click on the continuous integration job → Deploy → Logs
- Access the api-docs for the url to test your apis
For QA/PROD,
- Create pull request off branch
- Commit pull request to master (fix any conflicts)
- this will trigger master to be redeployed to the TEST swarm (see steps above to access the urls)
- Delete the branch (which will undeploy the TEST branch version)
- Follow Releasing section in the README file at the project's root
- This will create an image once committed and deploy it to nexusÂ
- only changes to the src directory require a new image; files like the docker-compose or README do not require a new image
- Troubleshooting
- go to portainer and check the stack for startup errors
Logging
- GrayLog
- Impossible to read because it's mixed with logs from all the other containers
- Log file on the server
- Hard to get at because a docker swarm admin needs to manually pull down the file
- Portainer (recommended)
- Go to Services → Select your service
Monitoring
- Shaun will need to configure Grafana to monitor your app
- From the dashboard, go to Spring Boot Statistics and then select your application
References
Spring Boot
- Guilde to RestTemplate
- Profiles
- YAML Configuration
- Testing
- Tutorials (by TutorialsPoint)
- Configuration annotation
Quartz
Java Mail
Gradle
JSON