Skip to content

Commit

Permalink
Merge pull request #1 from pagopa/PPANTT-191-create-mdb-gps-service
Browse files Browse the repository at this point in the history
[PPANTT-191] feat: Create mdb gps service
  • Loading branch information
pasqualespica authored Dec 4, 2024
2 parents 8866095 + 7a2df6d commit f89a64d
Show file tree
Hide file tree
Showing 77 changed files with 2,248 additions and 1,003 deletions.
45 changes: 2 additions & 43 deletions .github/workflows/cd_deploy_with_github_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,8 @@ permissions:
contents: read

jobs:
create_runner:
name: Create Runner
runs-on: ubuntu-22.04
environment:
name: ${{ inputs.environment }}
outputs:
runner_name: ${{ steps.create_github_runner.outputs.runner_name }}
steps:
- name: Create GitHub Runner
id: create_github_runner
# from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-create-action
uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-create-action@main
with:
client_id: ${{ secrets.CLIENT_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }}
resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} # RG of the runner
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}
self_hosted_runner_image_tag: "latest"

deploy:
needs: [ create_runner ]
runs-on: [ self-hosted, "${{ needs.create_runner.outputs.runner_name }}" ]
runs-on: [ self-hosted-job, "${{ inputs.environment }}" ]
name: Deploy on AKS
environment: ${{ inputs.environment }}
steps:
Expand All @@ -84,7 +62,7 @@ jobs:
cluster_name: ${{ vars.CLUSTER_NAME }}
resource_group: ${{ vars.CLUSTER_RESOURCE_GROUP }}
app_name: ${{ env.APP_NAME }}${{inputs.suffix_name}}
helm_upgrade_options: "--debug ${{inputs.helm_options}}"
helm_upgrade_options: '--debug --set microservice-chart.azure.workloadIdentityClientId=${{vars.WORKLOAD_IDENTITY_ID}} ${{inputs.helm_options}}'
timeout: '10m0s'

- name: Remove deployment
Expand All @@ -93,25 +71,6 @@ jobs:
run: |
helm uninstall ${{ env.APP_NAME }}${{inputs.suffix_name}} -n ${{ vars.NAMESPACE }}
cleanup_runner:
name: Cleanup Runner
needs: [ create_runner, deploy ]
if: ${{ success() || failure() }}
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
- name: Cleanup GitHub Runner
id: cleanup_github_runner
# from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-cleanup-action
uses: pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-cleanup-action@main
with:
client_id: ${{ secrets.CLIENT_ID }}
tenant_id: ${{ secrets.TENANT_ID }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }}
runner_name: ${{ needs.create_runner.outputs.runner_name }}
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}

update_openapi:
needs: [ deploy ]
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
workflow_dispatch:

env:
PROJECT_KEY: # TODO
PROJECT_KEY: pagopa_pagopa-gps-mbd-service

permissions:
id-token: write
Expand All @@ -40,7 +40,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
project_key: ${{env.PROJECT_KEY}}
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*,**/exception/**"
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*,**/exception/**,**/util/**"
cpd_exclusions: "**/model/**,**/entity/*"
java_version: 17

Expand Down
64 changes: 64 additions & 0 deletions .identity/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions .identity/00_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ data "azurerm_user_assigned_identity" "identity_pr_01" {
}

data "azurerm_key_vault" "domain_key_vault" {
name = "pagopa-${var.env_short}-${local.domain}-kv"
resource_group_name = "pagopa-${var.env_short}-${local.domain}-sec-rg"
name = "pagopa-${var.env_short}-itn-${local.domain}-kv"
resource_group_name = "pagopa-${var.env_short}-itn-${local.domain}-sec-rg"
}

data "azurerm_key_vault_secret" "key_vault_sonar" {
Expand All @@ -57,3 +57,8 @@ data "azurerm_key_vault_secret" "key_vault_integration_test_subkey" {
name = "integration-test-subkey"
key_vault_id = data.azurerm_key_vault.key_vault.id
}

data "azurerm_user_assigned_identity" "workload_identity_clientid" {
name = "ebollo-workload-identity"
resource_group_name = "pagopa-${var.env_short}-itn-${var.env}-aks-rg"
}
1 change: 1 addition & 0 deletions .identity/01_github_environment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ locals {
"CLUSTER_NAME" : local.aks_cluster.name,
"CLUSTER_RESOURCE_GROUP" : local.aks_cluster.resource_group_name,
"NAMESPACE" : local.domain,
"WORKLOAD_IDENTITY_ID": data.azurerm_user_assigned_identity.workload_identity_clientid.client_id
}
repo_secrets = {
"SONAR_TOKEN" : data.azurerm_key_vault_secret.key_vault_sonar.value,
Expand Down
4 changes: 2 additions & 2 deletions .identity/99_variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
locals {
github = {
org = "pagopa"
repository = "TODO" #TODO
repository = "pagopa-gps-mbd-service"
}

prefix = "pagopa"
domain = "TODO" #TODO
domain = "ebollo"
location_short = "weu"
product = "${var.prefix}-${var.env_short}"

Expand Down
2 changes: 1 addition & 1 deletion .identity/env/dev/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformdev"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-gps-mbd-service.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Dev"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-gps-mbd-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .identity/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-gps-mbd-service.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-gps-mbd-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .identity/env/uat/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformuat"
container_name = "azurermstate"
key = "<your-repo-name>.tfstate" # TODO
key = "pagopa-gps-mbd-service.tfstate"
2 changes: 1 addition & 1 deletion .identity/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ tags = {
CreatedBy = "Terraform"
Environment = "Uat"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-gps-mbd-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
2 changes: 1 addition & 1 deletion .opex/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "opex.<your-repo-name>.terraform.tfstate" #TODO
key = "pagopa-gps-mbd-service.tfstate"
9 changes: 6 additions & 3 deletions .opex/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
oa3_spec: ./openapi/openapi.json # If start with http the file would be downloaded from the internet
name: opex_<your-repo-name> # TODO
location: West Europe
name: opex_pagopa-gps-mbd-service
location: Italy North
timespan: 5m # Default, a number or a timespan https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/timespan
# public data_source
data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-vnet-rg/providers/Microsoft.Network/applicationGateways/pagopa-p-app-gw
# private data_source
#data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim
#resource_type: api-management

#resource_type: api-management # default is app-gw. uncomment for api-management
action_groups:
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/PagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/SlackPagoPA
Expand Down
3 changes: 1 addition & 2 deletions .opex/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
prefix = "pagopa"
env_short = "p"


tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/your-repository" # TODO
Source = "https://github.com/pagopa/pagopa-gps-mbd-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# see https://help.github.com/en/articles/about-code-owners#example-of-a-codeowners-file

* @pagopa/pagopa-tech
# TODO: set your codeowners
* @pagopa/pagopa-team-core @alessio-cialini @svariant @gioelemella
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
# Template for Java Spring Microservice project

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TODO-set-your-id&metric=alert_status)](https://sonarcloud.io/dashboard?id=TODO-set-your-id)
[![Integration Tests](https://github.com/pagopa/<TODO-repo>/actions/workflows/ci_integration_test.yml/badge.svg?branch=main)](https://github.com/pagopa/<TODO-repo>/actions/workflows/ci_integration_test.yml)

TODO: add a description

TODO: generate a index with this tool: https://ecotrust-canada.github.io/markdown-toc/

TODO: resolve all the TODOs in this template
# pagoPA MBD GPS Service

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=paogpa_pagopa-gps-mbd-service&metric=alert_status)](https://sonarcloud.io/dashboard?id=paogpa_pagopa-gps-mbd-service)
[![Integration Tests](https://github.com/pagopa/pagopa-gps-mbd-service/actions/workflows/ci_integration_test.yml/badge.svg?branch=main)](https://github.com/pagopa/pagopa-gps-mbd-service/actions/workflows/ci_integration_test.yml)

Expose an API that will be used by GPS Payments to generate MBD payment options

- [pagoPA MBD GPS Service](#pagopa-gps-mbd-service)
* [Api Documentation 📖](#api-documentation-)
* [Technology Stack](#technology-stack)
* [Start Project Locally 🚀](#start-project-locally-)
+ [Prerequisites](#prerequisites)
+ [Run docker container](#run-docker-container)
* [Develop Locally 💻](#develop-locally-)
+ [Prerequisites](#prerequisites-1)
+ [Run the project](#run-the-project)
+ [Spring Profiles](#spring-profiles)
+ [Testing 🧪](#testing-)
- [Unit testing](#unit-testing)
- [Integration testing](#integration-testing)
- [Performance testing](#performance-testing)
* [Contributors 👥](#contributors-)
+ [Maintainers](#maintainers)

---

## Api Documentation 📖

See the [OpenApi 3 here.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/<TODO-repo>/main/openapi/openapi.json)
See the [OpenApi 3 here.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/pagopa-gps-mbd-service/main/openapi/openapi.json)

---

## Technology Stack

- Java 11
- Spring Boot
- Java 17
- Spring Boot 3
- Spring Web
- Hibernate
- JPA
- ...
- TODO

---

Expand All @@ -41,8 +50,6 @@ from `./docker` directory

`sh ./run_docker.sh local`

ℹ️ Note: for PagoPa ACR is required the login `az acr login -n <acr-name>`

---

## Develop Locally 💻
Expand All @@ -51,13 +58,13 @@ from `./docker` directory

- git
- maven
- jdk-11
- jdk-17

### Run the project

Start the springboot application with this command:

`mvn spring-boot:run -Dspring-boot.run.profiles=local`
`mvn spring-boot:run -Dspring.profiles.active=local`

### Spring Profiles

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'

services:
app:
container_name: 'service' # TODO
container_name: 'pagopa-gps-mbd-service'
image: ${image}
platform: linux/amd64
build:
Expand Down
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ version: 0.0.0
appVersion: 0.0.0
dependencies:
- name: microservice-chart
version: 5.9.0
version: 7.1.1
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
Loading

0 comments on commit f89a64d

Please sign in to comment.