Skip to content

Commit

Permalink
fix: Probes enabled. (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniotarricone authored Dec 20, 2024
1 parent 84c3a8c commit ae2f676
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 18 deletions.
49 changes: 42 additions & 7 deletions dep-sha256.json
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,48 @@
"version": "7.0.2.Final",
"sha256": "SO7eXzXFpmsE8nMEoro11MFjF3Ioy6etL48v5v_kdlI="
},
{
"id": "io.quarkus:quarkus-smallrye-health:jar:3.15.1",
"artifactId": "quarkus-smallrye-health",
"groupId": "io.quarkus",
"version": "3.15.1",
"sha256": "__MRtExHApt-PjtjX-cuP-IAPG0_-gV3Qqx8AVZY6uE="
},
{
"id": "io.smallrye:smallrye-health:jar:4.1.0",
"artifactId": "smallrye-health",
"groupId": "io.smallrye",
"version": "4.1.0",
"sha256": "ahk1ZRigIsSj9FziM8mAPSQ11dGg4jhSYrEvPm5SWVw="
},
{
"id": "org.eclipse.microprofile.health:microprofile-health-api:jar:4.0.1",
"artifactId": "microprofile-health-api",
"groupId": "org.eclipse.microprofile.health",
"version": "4.0.1",
"sha256": "uJyktsT3oEQlDTHAZz9rwiHkD9Zp_Fhx261eWgdpykc="
},
{
"id": "io.smallrye:smallrye-health-api:jar:4.1.0",
"artifactId": "smallrye-health-api",
"groupId": "io.smallrye",
"version": "4.1.0",
"sha256": "gPcWfuQvorD1h9MIow5QJLWq8UtlFnNQrxhSz5_64Jw="
},
{
"id": "jakarta.json:jakarta.json-api:jar:2.1.3",
"artifactId": "jakarta.json-api",
"groupId": "jakarta.json",
"version": "2.1.3",
"sha256": "vJNBQoBeodeU8UQFY5ZaOGGiqft0FOzT_kTyZQBzRBQ="
},
{
"id": "io.smallrye:smallrye-health-provided-checks:jar:4.1.0",
"artifactId": "smallrye-health-provided-checks",
"groupId": "io.smallrye",
"version": "4.1.0",
"sha256": "B-W5cMNWebjKBSV7VOSb3-uKLiIKTSdTYcOgrN0TgIk="
},
{
"id": "io.quarkus:quarkus-junit5:jar:3.15.1",
"artifactId": "quarkus-junit5",
Expand Down Expand Up @@ -2282,13 +2324,6 @@
"version": "2.6.0",
"sha256": "NUwT9W-M8PG1xIq4K1a7II8iRUKIP9nVt2A83GcUeMY="
},
{
"id": "jakarta.json:jakarta.json-api:jar:2.1.3",
"artifactId": "jakarta.json-api",
"groupId": "jakarta.json",
"version": "2.1.3",
"sha256": "vJNBQoBeodeU8UQFY5ZaOGGiqft0FOzT_kTyZQBzRBQ="
},
{
"id": "io.quarkus:quarkus-opentelemetry:jar:3.15.1",
"artifactId": "quarkus-opentelemetry",
Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mongodb-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
22 changes: 11 additions & 11 deletions src/main/terraform/container_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,20 @@ resource "azurerm_container_app" "auth" {
max_replicas = var.mil_auth_max_replicas
min_replicas = var.mil_auth_min_replicas

custom_scale_rule {
name = "office-hours"
custom_rule_type = "cron"
metadata = {
timezone = "Europe/Rome"
start = "0 8 * * 1-5"
end = "0 18 * * 1-5"
desiredReplicas = "1"
}
}
#custom_scale_rule {
# name = "office-hours"
# custom_rule_type = "cron"
# metadata = {
# timezone = "Europe/Rome"
# start = "0 8 * * 1-5"
# end = "0 18 * * 1-5"
# desiredReplicas = "1"
# }
#}

http_scale_rule {
name = "http-requests"
concurrent_requests = "25"
concurrent_requests = "20"
}
}

Expand Down
189 changes: 189 additions & 0 deletions src/main/terraform/container_app_arm.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
resource "azurerm_resource_group_template_deployment" "auth_arm" {
name = "${local.project}-auth-ca-arm"
resource_group_name = data.azurerm_container_app_environment.mil.resource_group_name
deployment_mode = "Incremental"
tags = local.tags

template_content = <<-EOT
{
"$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion":"1.0.0.0",
"parameters":{},
"variables":{},
"resources":[
{
"name":"${local.project}-auth-ca-arm",
"type":"Microsoft.App/containerApps",
"apiVersion": "2024-10-02-preview",
"location":"${var.location}",
"properties":{
"managedEnvironmentId":"${data.azurerm_container_app_environment.mil.id}",
"environmentId":"${data.azurerm_container_app_environment.mil.id}",
"configuration":{
"secrets":[
{
"name":"cosmosdb-account-mil-primary-mongodb-connection-string",
"keyVaultUrl":"${data.azurerm_key_vault.general.vault_uri}secrets/${var.cosmosdb_account_primary_mongodb_connection_string_kv_secret}",
"identity":"${data.azurerm_user_assigned_identity.auth.id}"
},
{
"name":"cosmosdb-account-mil-secondary-mongodb-connection-string",
"keyVaultUrl":"${data.azurerm_key_vault.general.vault_uri}secrets/${var.cosmosdb_account_secondary_mongodb_connection_string_kv_secret}",
"identity":"${data.azurerm_user_assigned_identity.auth.id}"
},
{
"name":"identity-client-id",
"value":"${data.azurerm_user_assigned_identity.auth.client_id}"
},
{
"name":"key-vault-auth-vault-uri",
"keyVaultUrl":"${data.azurerm_key_vault.general.vault_uri}secrets/${var.key_vault_auth_vault_uri_kv_secret}",
"identity":"${data.azurerm_user_assigned_identity.auth.id}"
},
{
"name":"application-insigths-mil-connection-string",
"keyVaultUrl":"${data.azurerm_key_vault.general.vault_uri}secrets/${var.application_insigths_connection_string_kv_secret}",
"identity":"${data.azurerm_user_assigned_identity.auth.id}"
}
],
"activeRevisionsMode":"Single",
"ingress":{
"external":true,
"targetPort":8080,
"transport":"Http",
"traffic":[
{
"weight":100,
"latestRevision":true
}
]
},
"maxInactiveRevisions":5
},
"template":{
"containers":[
{
"image":"${var.mil_auth_image}",
"imageType":"ContainerImage",
"name":"mil-auth",
"env":[
{
"name":"TZ",
"value":"Europe/Rome"
},
{
"name":"auth.quarkus-log-level",
"value":"${var.mil_auth_quarkus_log_level}"
},
{
"name":"auth.quarkus-rest-client-logging-scope",
"value":"${var.mil_auth_quarkus_rest_client_logging_scope}"
},
{
"name":"auth.app-log-level",
"value":"${var.mil_auth_app_log_level}"
},
{
"name":"auth.cryptoperiod",
"value":"${var.mil_auth_cryptoperiod}"
},
{
"name":"auth.keysize",
"value":"${var.mil_auth_keysize}"
},
{
"name":"auth.access.duration",
"value":"${var.mil_auth_access_duration}"
},
{
"name":"auth.refresh.duration",
"value":"${var.mil_auth_refresh_duration}"
},
{
"name":"auth.keyvault.url",
"secretRef":"key-vault-auth-vault-uri"
},
{
"name":"auth.base-url",
"value":"${var.mil_auth_base_url}"
},
{
"name":"application-insights.connection-string",
"secretRef":"application-insigths-mil-connection-string"
},
{
"name":"auth.json-log",
"value":"${var.mil_auth_json_log}"
},
{
"name":"auth.keyvault.maxresults",
"value":"${var.mil_auth_keyvault_maxresults}"
},
{
"name":"auth.keyvault.backoff.number-of-attempts",
"value":"${var.mil_auth_keyvault_backoff_num_of_attempts}"
},
{
"name":"jwt-publickey-location",
"value":"http://127.0.0.1:8080/.well-known/jwks.json"
},
{
"name":"mongodb.connect-timeout",
"value":"${var.mil_auth_mongodb_connect_timeout}"
},
{
"name":"mongodb.read-timeout",
"value":"${var.mil_auth_mongodb_read_timeout}"
},
{
"name":"mongodb.server-selection-timeout",
"value":"${var.mil_auth_mongodb_server_selection_timeout}"
},
{
"name":"mongodb.connection-string-1",
"secretRef":"cosmosdb-account-mil-primary-mongodb-connection-string"
},
{
"name":"mongodb.connection-string-2",
"secretRef":"cosmosdb-account-mil-secondary-mongodb-connection-string"
},
{
"name":"IDENTITY_CLIENT_ID",
"secretRef":"identity-client-id"
}
],
"resources":{
"cpu":"${var.mil_auth_cpu}",
"memory":"${var.mil_auth_memory}"
}
}
],
"scale":{
"minReplicas":"${var.mil_auth_min_replicas}",
"maxReplicas":"${var.mil_auth_max_replicas}",
"cooldownPeriod":120,
"pollingInterval":5,
"rules":[
{
"name":"http-requests",
"http":{
"metadata":{
"concurrentRequests":"25"
}
}
}
]
}
}
},
"identity":{
"type":"UserAssigned",
"userAssignedIdentities":{
"${data.azurerm_user_assigned_identity.auth.id}":{}
}
}
}
]
}
EOT
}

0 comments on commit ae2f676

Please sign in to comment.