Skip to content

Commit

Permalink
Merge pull request #12 from pagopa/PAGOPA-2223-opt-log
Browse files Browse the repository at this point in the history
chore: [PagoPA-2223] optimization log
  • Loading branch information
alessio-acitelli authored Oct 14, 2024
2 parents 395b211 + 32363e4 commit d5d6f34
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 193 deletions.
19 changes: 8 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
#
# Build
#
FROM maven:3.9.5-amazoncorretto-17-al2023@sha256:eeaa7ab572d931f7273fc5cf31429923f172091ae388969e11f42ec6dd817d74 as buildtime
FROM maven:3.9.3-amazoncorretto-17@sha256:4ab7db7bd5f95e58b0ba1346ff29d6abdd9b73e5fd89c5140edead8b037386ff AS buildtime
WORKDIR /build
COPY . .
RUN mvn clean package -Dmaven.test.skip=true


FROM amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
#
# Package stage
#
FROM --platform=linux/amd64 amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
COPY --from=buildtime /build/target/*.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract


FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.0@sha256:6fa320d452fa22066441f1ef292d15eb06f944bc8bca293e1a91ea460d30a613
ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v2.2.0@sha256:b866656c31f2c6ebe6e78b9437ce930d6c94c0b4bfc8e9ecc1076a780b9dfb18

COPY --chown=spring:spring --from=builder dependencies/ ./
COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./

# https://github.com/moby/moby/issues/37965#issuecomment-426853382
RUN true
COPY --chown=spring:spring --from=builder spring-boot-loader/ ./
COPY --chown=spring:spring --from=builder application/ ./

EXPOSE 8080

ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.launch.JarLauncher"]
COPY --chown=spring:spring --from=builder application/ ./
9 changes: 6 additions & 3 deletions docker/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ if test -f "$FILE"; then
fi
config=$(yq -r '."microservice-chart".envConfig' ../helm/values-$ENV.yaml)
IFS=$'\n'
for line in $(echo "$config" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$config" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
echo "$line" >> .env
done

keyvault=$(yq -r '."microservice-chart".keyvault.name' ../helm/values-$ENV.yaml)
secret=$(yq -r '."microservice-chart".envSecret' ../helm/values-$ENV.yaml)
for line in $(echo "$secret" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$secret" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
IFS='=' read -r -a array <<< "$line"
response=$(az keyvault secret show --vault-name $keyvault --name "${array[1]}")
value=$(echo "$response" | jq -r '.value')
response=$(echo "$response" | tr -d '\n')
value=$(echo "$response" | yq -r '.value')
value=$(echo "$value" | sed 's/\$/\$\$/g')
value=$(echo "$value" | tr -d '\n')
echo "${array[0]}=$value" >> .env
done

Expand Down
9 changes: 1 addition & 8 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,13 @@ microservice-chart:
APP_LOGGING_LEVEL: 'DEBUG'
DEFAULT_LOGGING_LEVEL: 'INFO'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter-technical-support"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter-technical-support"
COSMOS_URI: "https://pagopa-d-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
secretProvider:
create: true
envSecrets:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
keyvault:
name: "pagopa-d-nodo-kv"
Expand Down
11 changes: 2 additions & 9 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,15 @@ microservice-chart:
WEBSITE_SITE_NAME: 'pagopawispconverterts' # required to show cloud role name in application insights
ENV: 'aks-prod'
APP_LOGGING_LEVEL: 'INFO'
DEFAULT_LOGGING_LEVEL: 'INFO'
DEFAULT_LOGGING_LEVEL: 'WARN'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter-technical-support"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=prod"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter-technical-support"
COSMOS_URI: "https://pagopa-p-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
secretProvider:
create: true
envSecrets:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
keyvault:
name: "pagopa-p-nodo-kv"
Expand Down
11 changes: 2 additions & 9 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,15 @@ microservice-chart:
WEBSITE_SITE_NAME: 'pagopawispconverterts' # required to show cloud role name in application insights
ENV: 'aks-uat'
APP_LOGGING_LEVEL: 'INFO'
DEFAULT_LOGGING_LEVEL: 'INFO'
DEFAULT_LOGGING_LEVEL: 'WARN'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter-technical-support"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=uat"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter-technical-support"
COSMOS_URI: "https://pagopa-u-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
secretProvider:
create: true
envSecrets:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'azure-insight-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
keyvault:
name: "pagopa-u-nodo-kv"
Expand Down
Loading

0 comments on commit d5d6f34

Please sign in to comment.