diff --git a/.github/workflows/config/trivy.yaml b/.github/workflows/config/trivy.yaml index 298b3a3..014a329 100644 --- a/.github/workflows/config/trivy.yaml +++ b/.github/workflows/config/trivy.yaml @@ -1,3 +1,3 @@ db: repository: "public.ecr.aws/aquasecurity/trivy-db:2" - java-repository: "public.ecr.aws/aquasecurity/trivy-java-db:1" \ No newline at end of file + java-repository: "public.ecr.aws/aquasecurity/trivy-java-db:1" diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index 3783154..149c9da 100644 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -67,4 +67,4 @@ jobs: CVE_CRITICAL: ${{needs.BuildAndScan.outputs.CVE_CRITICAL}} CVE_HIGH: ${{needs.BuildAndScan.outputs.CVE_HIGH}} CVE_MEDIUM: ${{needs.BuildAndScan.outputs.CVE_MEDIUM}} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/send-notification.yml b/.github/workflows/send-notification.yml index 5820a14..acb0754 100644 --- a/.github/workflows/send-notification.yml +++ b/.github/workflows/send-notification.yml @@ -46,4 +46,4 @@ jobs: } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/README.md b/README.md index 83abf99..1ffe483 100644 --- a/README.md +++ b/README.md @@ -28,21 +28,26 @@ Here is a quick overview of the files and directories included in this repositor ## 🚀 Features ### 📜 OpenAPI + - Example OpenAPI specification file (`template-payments-java-repository.openapi.yaml`) to document your RESTful APIs. - Compatible with tools like Swagger and Postman. ### ⚙️ Helm + - Template Helm charts for deploying your Java application on Kubernetes. - Includes `values.yaml` for parameter configuration and pre-defined deployment manifests. ### 🔧 Gradle + - `build.gradle` file with dependencies and plugins for building, testing, and running your Java application. - Compatible with Java 21+. ### ☕ Java + - Example Java application structure with a simple `HelloWorld` class. ### ✅ JUnit + - Example JUnit test cases under the `test/` directory to help you get started with unit testing. --- @@ -50,7 +55,29 @@ Here is a quick overview of the files and directories included in this repositor ## 🛠️ Getting Started ### Prerequisites + Ensure the following tools are installed on your machine: + 1. **Java 21+** 2. **Gradle** (or use the Gradle wrapper included in the repository) 3. **Docker** (for Helm-related tasks, optional) + +### Building & Run + +#### Build + +```sh +./gradlew clean build +``` + +#### Run local + +```sh +./gradlew bootRun +``` + +#### Write Locks + +```sh +./gradlew dependencies --write-locks +``` diff --git a/build.gradle.kts b/build.gradle.kts index 3072ff7..0fdf645 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,8 +36,9 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("io.micrometer:micrometer-tracing-bridge-otel:$micrometerVersion") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:$springDocOpenApiVersion") + implementation("io.micrometer:micrometer-tracing-bridge-otel:$micrometerVersion") + implementation("io.micrometer:micrometer-registry-prometheus") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") implementation("org.openapitools:jackson-databind-nullable:$openApiToolsVersion") diff --git a/gradle.lockfile b/gradle.lockfile index dbe58cc..ab6de54 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -17,6 +17,7 @@ io.micrometer:micrometer-commons:1.14.2=compileClasspath io.micrometer:micrometer-core:1.14.2=compileClasspath io.micrometer:micrometer-jakarta9:1.14.2=compileClasspath io.micrometer:micrometer-observation:1.14.2=compileClasspath +io.micrometer:micrometer-registry-prometheus:1.14.2=compileClasspath io.micrometer:micrometer-tracing-bridge-otel:1.4.1=compileClasspath io.micrometer:micrometer-tracing:1.4.1=compileClasspath io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator:2.9.0-alpha=compileClasspath @@ -30,6 +31,10 @@ io.opentelemetry:opentelemetry-sdk-logs:1.43.0=compileClasspath io.opentelemetry:opentelemetry-sdk-metrics:1.43.0=compileClasspath io.opentelemetry:opentelemetry-sdk-trace:1.43.0=compileClasspath io.opentelemetry:opentelemetry-sdk:1.43.0=compileClasspath +io.prometheus:prometheus-metrics-config:1.3.5=compileClasspath +io.prometheus:prometheus-metrics-core:1.3.5=compileClasspath +io.prometheus:prometheus-metrics-model:1.3.5=compileClasspath +io.prometheus:prometheus-metrics-tracer-common:1.3.5=compileClasspath io.swagger.core.v3:swagger-annotations-jakarta:2.2.25=compileClasspath io.swagger.core.v3:swagger-core-jakarta:2.2.25=compileClasspath io.swagger.core.v3:swagger-models-jakarta:2.2.25=compileClasspath diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ccc1a9b..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -4,4 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 131e0da..a54b55a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,18 +1,37 @@ spring: application: - name: ${artifactId} - version: ${version} + name: ${artifactId} + version: ${version} jmx.enabled: true + threads: + virtual: + enabled: true management: + endpoints: + web: + exposure: + include: health, info, prometheus, metrics + base-path: /actuator endpoint: health: probes.enabled: true group: readiness.include: "*" liveness.include: livenessState,diskSpace,ping - endpoints: - jmx: - exposure.include: "*" - web: - exposure.include: info, health + prometheus: + enabled: true + metrics: + tags: + application: ${artifactId} + export: + prometheus: + enabled: true + step: 1m + descriptions: true + enable: + jvm: true + process: true + system: true + http: true + logback: true app: