diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a82186a..4a538ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -118,6 +118,22 @@ stages: image: $(containerRegistry)/$(imageRepository):$(tag) ports: - containerPort: 8080 + readinessProbe: + httpGet: + path: /actuator/health + port: 8080 + initialDelaySeconds: 10 + timeoutSeconds: 2 + periodSeconds: 5 + failureThreshold: 10 + livenessProbe: + httpGet: + path: /actuator/health + port: 8080 + initialDelaySeconds: 120 + timeoutSeconds: 2 + periodSeconds: 5 + failureThreshold: 5 secretType: 'dockerRegistry' containerRegistryType: 'Azure Container Registry' - task: Kubernetes@1 diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 287c255..a317ded 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -86,7 +86,7 @@ steps: initialDelaySeconds: 10 timeoutSeconds: 2 periodSeconds: 5 - failureThreshold: 5 + failureThreshold: 10 livenessProbe: httpGet: path: /actuator/health diff --git a/src/main/java/com/example/template/OrderController.java b/src/main/java/com/example/template/OrderController.java index 6334555..42a7b5a 100644 --- a/src/main/java/com/example/template/OrderController.java +++ b/src/main/java/com/example/template/OrderController.java @@ -28,6 +28,9 @@ public class OrderController { try { ResponseEntity responseEntity = restTemplate.postForEntity(remoteURL + "/startDelivery", data, String.class); String response = responseEntity.getBody(); + + logger.info(String.format(RESPONSE_STRING_FORMAT, response.trim())); + return ResponseEntity.ok(String.format(RESPONSE_STRING_FORMAT, response.trim())); } catch (Exception ex) { logger.warn("Exception trying to get the response from order service.", ex);