generated from pagopa/pagopa-functions-template
-
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.
- Loading branch information
Showing
1 changed file
with
107 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,126 @@ | ||
# pagoPA Functions template | ||
# pagoPA Receipt-pdf-datastore | ||
|
||
Java template to create an Azure Function. | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pagopa_pagopa-gpd-ingestion-manager&metric=alert_status)](https://sonarcloud.io/dashboard?id=pagopa_pagopa-gpd-ingestion-manager) | ||
|
||
## Function examples | ||
There is an example of a Http Trigger function. | ||
Java Azure Functions that ingest a message from GPD observer event hub, tokenizes sensitive information and sends it again to the event hub | ||
|
||
--- | ||
|
||
## Run locally with Docker | ||
`docker build -t pagopa-functions-template .` | ||
## Summary 📖 | ||
|
||
`docker run -p 8999:80 pagopa-functions-template` | ||
- [Api Documentation 📖](#api-documentation-) | ||
- [Start Project Locally 🚀](#start-project-locally-) | ||
* [Run locally with Docker](#run-locally-with-docker) | ||
+ [Prerequisites](#prerequisites) | ||
+ [Run docker container](#run-docker-container) | ||
* [Run locally with Maven](#run-locally-with-maven) | ||
+ [Prerequisites](#prerequisites-1) | ||
+ [Set environment variables](#set-environment-variables) | ||
+ [Run the project](#run-the-project) | ||
* [Test](#test) | ||
- [Develop Locally 💻](#develop-locally-) | ||
* [Prerequisites](#prerequisites-2) | ||
* [Testing 🧪](#testing-) | ||
+ [Unit testing](#unit-testing) | ||
+ [Integration testing](#integration-testing) | ||
+ [Performance testing](#performance-testing) | ||
- [Contributors 👥](#contributors-) | ||
* [Maintainers](#maintainers) | ||
|
||
### Test | ||
`curl http://localhost:8999/example` | ||
--- | ||
|
||
## Start Project Locally 🚀 | ||
|
||
### Run locally with Docker | ||
|
||
#### Prerequisites | ||
|
||
- docker | ||
|
||
#### Set environment variables | ||
|
||
`docker build -t pagopa-gpd-ingestion-manager .` | ||
|
||
`cp .env.example .env` | ||
|
||
and replace in `.env` with correct values | ||
|
||
#### Run docker container | ||
|
||
then type : | ||
|
||
`docker run -p 80:80 --env-file=./.env pagopa-gpd-ingestion-manager` | ||
|
||
### Run locally with Maven | ||
|
||
#### Prerequisites | ||
|
||
- maven | ||
|
||
#### Set environment variables | ||
|
||
On terminal type: | ||
|
||
## Run locally with Maven | ||
`cp local.settings.json.example local.settings.json` | ||
|
||
then replace env variables with correct values | ||
(if there is NO default value, the variable HAS to be defined) | ||
|
||
| VARIABLE | USAGE | DEFAULT VALUE | | ||
|------------------------------------------------|-----------------------------------------------------------------------------------|:------------------------------------------------------:| | ||
| `PAYMENT_POSITION_INPUT_EVENTHUB_CONN_STRING` | Connection string to the PaymentPosition input topic | | | ||
| `PAYMENT_POSITION_OUTPUT_EVENTHUB_CONN_STRING` | Connection string to the PaymentPosition output topic | | | ||
| `PDV_TOKENIZER_BASE_PATH` | PDV Tokenizer API base path | "https://api.uat.tokenizer.pdv.pagopa.it/tokenizer/v1" | | ||
| `PDV_TOKENIZER_CREATE_TOKEN_ENDPOINT` | PDV Tokenizer API create token endpoint | "/tokens" | | ||
| `PDV_TOKENIZER_SUBSCRIPTION_KEY` | API azure ocp apim subscription key | | | ||
| `PDV_TOKENIZER_INITIAL_INTERVAL` | PDV Tokenizer initial interval for retry a request that fail with 429 status code | 200 | | ||
| `PDV_TOKENIZER_MULTIPLIER` | PDV Tokenizer interval multiplier for subsequent request retry | 2.0 | | ||
| `PDV_TOKENIZER_RANDOMIZATION_FACTOR` | PDV Tokenizer randomization factor for interval retry calculation | 0.6 | | ||
| `PDV_TOKENIZER_MAX_RETRIES` | PDV Tokenizer max request retry | 3 | | ||
| `TOKENIZER_APIM_HEADER_KEY` | Tokenizer APIM header key | x-api-key | | ||
|
||
> to doc details about AZ fn config | ||
> see [here](https://stackoverflow.com/questions/62669672/azure-functions-what-is-the-purpose-of-having-host-json-and-local-settings-jso) | ||
|
||
#### Run the project | ||
|
||
`mvn clean package` | ||
|
||
`mvn azure-functions:run` | ||
|
||
### Test | ||
`curl http://localhost:7071/example` | ||
|
||
`curl http://localhost:8080/info` | ||
|
||
--- | ||
|
||
## Develop Locally 💻 | ||
|
||
### Prerequisites | ||
|
||
- git | ||
- maven | ||
- jdk-11 | ||
|
||
### Testing 🧪 | ||
|
||
#### Unit testing | ||
|
||
To run the **Junit** tests: | ||
|
||
`mvn clean verify` | ||
|
||
#### Integration testing | ||
|
||
#### Performance testing | ||
|
||
--- | ||
|
||
## Contributors 👥 | ||
|
||
Made with ❤️ by PagoPa S.p.A. | ||
|
||
## TODO | ||
Once cloned the repo, you should: | ||
- to deploy on standard Azure service: | ||
- rename `deploy-pipelines-standard.yml` to `deploy-pipelines.yml` | ||
- remove `helm` folder | ||
- to deploy on Kubernetes: | ||
- rename `deploy-pipelines-aks.yml` to `deploy-pipelines.yml` | ||
- customize `helm` configuration | ||
- configure the following GitHub action in `.github` folder: | ||
- `deploy.yml` | ||
- `sonar_analysis.yml` | ||
### Maintainers | ||
|
||
Configure the SonarCloud project :point_right: [guide](https://pagopa.atlassian.net/wiki/spaces/DEVOPS/pages/147193860/SonarCloud+experimental). | ||
See `CODEOWNERS` file |