Skip to content
Snippets Groups Projects
Commit 87972788 authored by Jan Schnaidt's avatar Jan Schnaidt
Browse files

Load balancer

parent ed697e34
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
root * /usr/share/caddy root * /usr/share/caddy
file_server file_server
reverse_proxy /user* { reverse_proxy /user* backend1:9876 backend2:9877 {
to backend_1:9876 backend_2:9877 lb_policy first
lb_policy round_robin health_uri /health
health_interval 10s
health_timeout 1s
} }
} }
\ No newline at end of file
...@@ -24,8 +24,8 @@ services: ...@@ -24,8 +24,8 @@ services:
networks: networks:
- todo-network - todo-network
# backend stuff # backend1
backend_1: backend1:
# builds backend from root # builds backend from root
build: . build: .
# the internal network our backend will be using # the internal network our backend will be using
...@@ -46,8 +46,8 @@ services: ...@@ -46,8 +46,8 @@ services:
depends_on: depends_on:
- mongodb - mongodb
# backend stuff # backend2
backend_2: backend2:
# builds backend from root # builds backend from root
build: . build: .
# the internal network our backend will be using # the internal network our backend will be using
...@@ -79,6 +79,7 @@ services: ...@@ -79,6 +79,7 @@ services:
networks: networks:
- todo-network - todo-network
# caddy for load balancing and reverse proxying # caddy for load balancing and reverse proxying
caddy: caddy:
image: caddy/caddy:alpine image: caddy/caddy:alpine
...@@ -90,6 +91,8 @@ services: ...@@ -90,6 +91,8 @@ services:
- "80:80" # default http port - "80:80" # default http port
networks: networks:
- todo-network - todo-network
depends_on:
- frontend
# were gonna use this network for both our backend and frontend # were gonna use this network for both our backend and frontend
networks: networks:
......
package com.cloudcomputing.todo.controller;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HealthController {
@GetMapping("/health")
public ResponseEntity<Boolean> health() {
return ResponseEntity.ok(true);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment