In this README:
This is a Java Spring Boot application that has been created using the LightHouse DI Starter Kit. It is intended to be used as a starting point for building Java APIs and should be customized to deliver whatever functionality is required. If no other changes have been made, this application will have these features included by default.
Before you run this application locally, you will need to make sure you have all the following required dependencies available in your local environment:
- Java 11
- This must be the version selected by your machine to run Gradle 6.9. Mac Guide|Other OS Guide
- Java 16
- This version must be available to Gradle to compile the application. Mac Guide|Other OS Guide
- docker
- hadolint
- spectral
- shellcheck
This application currently supports Mac OS for local development environments. Use the Mac OS Guide to make sure you have all the above dependencies available in your local environment. Otherwise, refer to the Other Operating Systems Guide.
You will also need to have a GitHub personal access token with the read:packages
permission exported in your local shell.
This is required to in order to download application artifacts that are published to the VA GitHub Package Registry.
You can generate a new access token by following this guide. When you have your token, make sure it is available in your local shell by running:
export GITHUB_ACCESS_TOKEN=<replace-with-token-from-github>
Once you have all the required dependencies, you can start the application in your local environment by navigating to the root of your application directory and running the following command:
./gradlew clean build check docker
This will build all the application artifacts and docker images
You can then start the application by running:
./gradlew :app:dockerComposeDown :app:dcPrune :app:dockerComposeUp
This should bring up a docker container with the app running at http://localhost:8081
Note that at this time,
./gradlew run
and./gradlew bootRun
require additional setup with database dependencies prior to use with a local development environment.
You can verify that the application is up and running by issuing the following commands in your terminal:
curl localhost:8081/health
curl localhost:8081/info
You should get back responses similar to the following:
curl localhost:8081/health
{
"status":"UP",
"components":{
"db":{
"status":"UP",
"details":{
"database":"PostgreSQL",
"validationQuery":"isValid()"
}
},
"diskSpace":{
"status":"UP",
"details":{
"total":62725623808,
"free":53279326208,
"threshold":10485760,
"exists":true
}
},
"livenessState":{
"status":"UP"
},
"ping":{
"status":"UP"
},
"readinessState":{
"status":"UP"
}
},
"groups":[
"liveness",
"readiness"
]
}
curl localhost:8081/info
{
"app": {
"description": "Java API Starter from Template",
"name": "lighthouse-di-starterkit-java"
}
}
-
Error: Cannot find plugin
Error Message:
* What went wrong: Plugin [id: 'gov.va.starter.plugin.cookiecutter', version: '0.1.20', apply: false] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'gov.va.starter.plugin.cookiecutter:gov.va.starter.plugin.cookiecutter.gradle.plugin:0.1.20') Searched in the following repositories: MavenLocal(file:/Users/aasare/.m2/repository/) Gradle Central Plugin Repository MavenRepo BintrayJCenter maven(https://palantir.bintray.com/releases) maven2(https://dl.bintray.com/adesso/junit-insights) starterBootPkgs(https://maven.pkg.github.com/department-of-veterans-affairs/lighthouse-di-starter-boot) nexus(https://tools.health.dev-developer.va.gov/nexus)
Fix: Set your Github token as per the instructions in the Required Dependencies section above.
Once you have verified that you are able to run the application successfully, you can now start customizing the application to deliver the functionality you would like.
By default, this application assumes the use of a build, test, release cycle as defined in this development guide. Take a look at that guide to see how you can make changes, test them and get them deployed to a target environment.
The application itself is organized into the following three tiers of functionality:
- API
- Service (business logic)
- Persistence
To see how each of these tiers is used by default, take a look at the Project Structure documentation.