Skip to content

Commit

Permalink
[#2282] Hotfix for webhook registration health check (#2284)
Browse files Browse the repository at this point in the history
* [#2181] Hotfix: Chatplugin installation crashing without config

* [#2187] Hotfix chatplugin bundle loading (#2188)

* [#2192] Hotfix inbox crashing when selecting conversations in filtered view (#2193)

* Inbox UI carousels facebook break the UI (#2222)

* fix scroll

* unnecessary space

* bump version

* [#2282] Hotfix for webhook registration failing despite all services healthy

* update changelog and version

Co-authored-by: ljupcovangelski <ljupco@airy.co>
Co-authored-by: Aitor Algorta <aitor@airy.co>
Co-authored-by: Pascal Holy <pascal@airy.co>
  • Loading branch information
4 people committed Aug 13, 2021
1 parent bfcaa2d commit c4bd4c0
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public HealthApi(@Value("${kubernetes.namespace}") String namespace, RestTemplat
public Future<Boolean> isHealthy(String service) {
try {
final ResponseEntity<String> response = restTemplate.getForEntity(String.format("http://%s.%s/actuator/health", service, namespace), String.class);
log.info("response body {}", response.getBody());
final JsonNode jsonNode = objectMapper.readTree(response.getBody());
return new AsyncResult<>("UP".equalsIgnoreCase(jsonNode.get("status").textValue()));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public ComponentInfo getComponent(String componentName) {
componentInfo = Optional.ofNullable(componentInfo).orElse(new ComponentInfo(false, true));
componentInfo.setEnabled(serviceInfo.isEnabled());
// One unhealthy service means that the component is unhealthy
componentInfo.setEnabled(componentInfo.isHealthy() && serviceInfo.isHealthy());
componentInfo.setHealthy(componentInfo.isHealthy() && serviceInfo.isHealthy());
return componentInfo;
}, (v1, v2) -> {
v1.setHealthy(v1.isHealthy() && v2.isHealthy());
Expand Down
4 changes: 4 additions & 0 deletions backend/webhook/consumer/pkg/worker/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func (worker *Worker) StartServer(ctx context.Context, wg *sync.WaitGroup) {
w.WriteHeader(200)
})

http.HandleFunc("/actuator/health", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("{\"status\":\"UP\"}"))
})

go func() {
log.Println("serving on 8080")
err := http.ListenAndServe(":8080", nil)
Expand Down
Loading

0 comments on commit c4bd4c0

Please sign in to comment.