-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SELC-5740] Feat: Added module for user-group-cdc (#198)
Co-authored-by: Giulia Tremolada <giulia.tremolada@nttdata.com>
- Loading branch information
1 parent
a41d07f
commit ca3ce97
Showing
41 changed files
with
1,679 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Code Review - user-group-cdc | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
- releases/** | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
paths: | ||
- 'apps/user-group-cdc/**' | ||
- '.github/workflows/pr_user_cdc.yml' | ||
- '.github/workflows/call_code_review.yml' | ||
|
||
jobs: | ||
code_review: | ||
uses: ./.github/workflows/call_code_review.yml | ||
name: User cdc Code Review | ||
secrets: inherit | ||
with: | ||
pr_number: ${{ github.event.pull_request.number }} | ||
source_branch: ${{ github.head_ref }} | ||
target_branch: ${{ github.base_ref }} | ||
sonar_key: 'pagopa_selfcare-user' | ||
module: 'user-group-cdc' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Deploy SELC - user-group-cdc | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- releases/* | ||
paths: | ||
- "apps/user-group-cdc/**" | ||
- "infra/container_apps/user-group-cdc/**" | ||
- "apps/pom.xml" | ||
- "pom.xml" | ||
|
||
workflow_dispatch: | ||
inputs: | ||
env: | ||
type: choice | ||
description: Environment | ||
options: | ||
- dev | ||
- uat | ||
- prod | ||
|
||
jobs: | ||
|
||
release_dev: | ||
uses: pagopa/selfcare-commons/.github/workflows/call_release_docker.yml@main | ||
name: '[Dev] User cdc Release' | ||
if: ${{ (startsWith(github.ref_name, 'releases/') != true && inputs.env == null) || inputs.env == 'dev' }} | ||
secrets: inherit | ||
with: | ||
environment: dev | ||
tf_environment: dev | ||
dir: 'infra/container_apps/user-group-cdc' | ||
dockerfile_path: ./apps/user-group-cdc/Dockerfile | ||
docker_image_name: pagopa/selfcare-user-group-cdc | ||
upload_openapi_enabled: false | ||
|
||
release_uat: | ||
uses: pagopa/selfcare-commons/.github/workflows/call_release_docker.yml@main | ||
name: '[UAT] User cdc Release' | ||
if: ${{ (startsWith(github.ref_name, 'releases/') == true && inputs.env == null) || inputs.env == 'uat' }} | ||
secrets: inherit | ||
with: | ||
environment: uat | ||
tf_environment: uat | ||
dir: 'infra/container_apps/user-group-cdc' | ||
dockerfile_path: ./apps/user-group-cdc/Dockerfile | ||
docker_image_name: pagopa/selfcare-user-group-cdc | ||
upload_openapi_enabled: false | ||
|
||
release_prod: | ||
uses: pagopa/selfcare-commons/.github/workflows/call_release_docker.yml@main | ||
name: '[Prod] User cdc Release' | ||
if: ${{ inputs.env == 'prod' }} | ||
secrets: inherit | ||
with: | ||
environment: prod | ||
tf_environment: prod | ||
dir: 'infra/container_apps/user-group-cdc' | ||
dockerfile_path: ./apps/user-group-cdc/Dockerfile | ||
docker_image_name: pagopa/selfcare-user-group-cdc | ||
upload_openapi_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# syntax=docker/dockerfile:1.6@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021 | ||
FROM maven:3-eclipse-temurin-17@sha256:0d328fa6843bb26b60cf44d69833f241ffe96218fb29fa19df7a6603863eaae7 AS builder | ||
|
||
WORKDIR /src | ||
COPY --link pom.xml . | ||
|
||
WORKDIR /src/libs | ||
COPY --link ./libs/ . | ||
|
||
WORKDIR /src/test-coverage | ||
COPY --link ./test-coverage/pom.xml . | ||
|
||
WORKDIR /src/apps | ||
COPY --link ./apps/pom.xml . | ||
|
||
WORKDIR /src/apps/user-group-cdc | ||
COPY --link ./apps/user-group-cdc/pom.xml . | ||
COPY ./apps/user-group-cdc/src/main/ ./src/main/ | ||
|
||
WORKDIR /src | ||
|
||
RUN echo "<settings>\n" \ | ||
"<servers>\n" \ | ||
"<server>\n" \ | ||
"<id>\${repositoryId}</id>\n" \ | ||
"<username>\${repoLogin}</username>\n" \ | ||
"<password>\${repoPwd}</password>\n" \ | ||
"</server>\n" \ | ||
"</servers>\n" \ | ||
"</settings>\n" > settings.xml | ||
|
||
ARG REPO_ONBOARDING | ||
ARG REPO_USERNAME | ||
ARG REPO_PASSWORD | ||
|
||
RUN mvn --global-settings settings.xml --projects :user-group-cdc -DrepositoryId=${REPO_ONBOARDING} -DrepoLogin=${REPO_USERNAME} -DrepoPwd=${REPO_PASSWORD} --also-make clean package -DskipTests | ||
|
||
FROM openjdk:17-jdk@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8 AS runtime | ||
|
||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /src/apps/user-group-cdc/target/quarkus-app/lib/ ./lib/ | ||
COPY --from=builder /src/apps/user-group-cdc/target/quarkus-app/*.jar ./ | ||
COPY --from=builder /src/apps/user-group-cdc/target/quarkus-app/app/ ./app/ | ||
COPY --from=builder /src/apps/user-group-cdc/target/quarkus-app/quarkus/ ./quarkus/ | ||
|
||
ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.2.11/applicationinsights-agent-3.2.11.jar ./applicationinsights-agent.jar | ||
RUN chmod 755 ./applicationinsights-agent.jar | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
|
||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTIONS -jar /app/quarkus-run.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Microservice User | ||
|
||
Our dedicated microservice is crafted to expertly manage all events related to operations, such as insertion, update, and deletion, | ||
within the MongoDB collections residing in the user group domain, to send event message on sc-userGroup topic. | ||
This specialized solution has been meticulously designed to mitigate potential concurrency issues arising from the presence of multiple active instances | ||
on the main microservices. | ||
|
||
## Configuration Properties | ||
|
||
Before running you have to set these properties as environment variables. | ||
|
||
| **Property** | **Environment Variable** | **Default** | **Required** | | ||
|-----------------------------------------------|----------------------------------------------|-------------|:------------:| | ||
| quarkus.mongodb.connection-string | MONGODB-CONNECTION-STRING | | yes | | ||
| user-group-cdc.app-insights.connection-string | USER-GROUP-CDC-APPINSIGHTS-CONNECTION-STRING | | yes | | ||
| user-group-cdc.storage.connection-string | STORAGE_CONNECTION_STRING | | yes | | ||
| quarkus.rest-client.event-hub.url | EVENT_HUB_BASE_PATH | | yes | | ||
| eventhub.rest-client.keyName | SHARED_ACCESS_KEY_NAME | | yes | | ||
| eventhub.rest-client.key | EVENTHUB-SC-USERS-GROUP-SELFCARE-WO-KEY-LC | | yes | | ||
| user-group-cdc.send-events.watch.enabled | USER_GROUP_CDC_SEND_EVENTS_WATCH_ENABLED | false | no | | ||
|
||
|
||
> **_NOTE:_** properties that contains secret must have the same name of its secret as uppercase. | ||
|
||
## Running the application in dev mode | ||
|
||
You can run your application in dev mode that enables live coding using: | ||
```shell script | ||
./mvnw compile quarkus:dev | ||
``` | ||
|
||
For some endpoints | ||
|
||
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8083/q/dev/. | ||
## Packaging and running the application | ||
|
||
The application can be packaged using: | ||
```shell script | ||
./mvnw package | ||
``` | ||
It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. | ||
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. | ||
|
||
The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. | ||
|
||
If you want to build an _über-jar_, execute the following command: | ||
```shell script | ||
./mvnw package -Dquarkus.package.type=uber-jar | ||
``` | ||
|
||
The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. | ||
|
||
## Related Guides | ||
|
||
|
||
### RESTEasy Reactive | ||
|
||
Easily start your Reactive RESTful Web Services | ||
|
||
[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) | ||
|
||
### OpenAPI Generator | ||
|
||
Rest client are generated using a quarkus' extension. | ||
|
||
[Related guide section...](hhttps://github.com/quarkiverse/quarkus-openapi-generator) |
Oops, something went wrong.