DevOps Knowledge Share API is a Spring Boot application that provides a RESTful API for the DevOps Knowledge Share application.
The API is used to manage the data for the DevOps Knowledge Share application. It is used to create, read, and delete data for the application.
Application data is stored in a database. The application works in conjunction with the DevOps Knowledge Share UI, which is a React application containing a simple form and table.
The purpose of this application is to act as an example of a simple Java Spring Boot application allowing us to demonstrate how one might build, test, and deploy a Java Spring Boot application.
This project requires the following tools to be installed on your machine:
- Make
- Docker
- Docker Compose (v2.11.2+)
- pre-commit
We use make
to run commands during local development and leverage Docker and Docker Compose for execution so users do not need to install Java, Gradle, or other dependencies - everything runs in a consistent, containerized manner.
After cloning this repository you can run make
or make help
to see a list of available commands.
git clone <repository-url>
cd dks-api
make
There are a number of make
targets available for this project but the most common ones are listed below.
You can see a full list of available targets by running make
or make help
.
make build
make up
make smoke-test
make functional-test
⚠️ NOTE: Contract Testing content is outdated and will be reviewed and updated in the near future.
To run the contract tests, you can either run Pact Broker locally using the resources in this repository, or you can connect to the production Pact Broker instance with the following environment variables set
NOTE: If you decide to run Pact Broker locally, this will also require that the contract has been published from the consumer side. See the DKS UI to see how to run the consumer contract tests and publish.
export PACT_BROKER_URL=<url>
export PACT_BROKER_SCHEME=https
export PACT_BROKER_PORT=443
export PACT_BROKER_USERNAME=<username>
export PACT_BROKER_PASSWORD=<password>
Run the contract tests using this Gradle task
./gradlew contractTest
<DKS API URL>/swagger-ui.html
(e.g. http://localhost:8080/swagger-ui.html)
With the application running, navigate to the Swagger UI page to view and test existing DKS API endpoints.
<DKS API URL>/v3/api-docs
(e.g. http://localhost:8080/v3/api-docs)
With the application running, navigate to the OpenAPI v3 definition page to see the Open API V3 definition for DKS API.
This application has Spring Boot Actuator enabled. This provides a number of endpoints for monitoring and managing the application.
Endpoints are enabled/disabled in src/main/resources/application.properties
(link to file).
Available endpoints can be found in the Spring Boot Actuator documentation (v2.7.18).
<DKS API URL>/actuator/health
(e.g. http://localhost:8080/actuator/health)
With the application running, navigate to the health check endpoint to see the current health of the application.