A lightweight GoLang service supervisor.
mkdir go-supervise && cd $_
wget https://raw.githubusercontent.com/scottjr632/go-supervise/master/docker-compose.yml
touch server.config.yml
vi server.config.yml
server:
port: 11223
services:
checkupservice:
interval: 35
uniqueids: true
datastore:
dbname: go-service
connectionstring: mongodb://database:27017
jwt:
tokenname: access_token
protectedpath: /api/protected
cd k8s/
kubectl apply -f go-supervise-db.yml
kubectl apply -f go-supervise-server.yml
kubectl apply -f go-supervise-client.yml
# web:
# image: docker.pkg.github.com/scottjr632/go-supervise-client/client:latest
# restart: unless-stopped
# links:
# - "server:server"
# environment:
# - SERVER_URI=http://server:11223
# ports:
# - "11221:80"
# depends_on:
# - server
docker-compose up -d
git clone https://github.com/scottjr632/go-supervise.git
cd go-supervise
docker-compose up
Make an HTTP post request to supervisor that contains
{
"workerId": "MY-APP",
"name": "My Application",
"checkUpUri": "http://validtesturi.com/health",
"expectedRespone": "{\"status\": \"up\"}"
}
Make an HTTP get request to supervisor
curl http://127.0.0.1:8080/api/workers/health?workerId=MY-APP
Response
{
"status": "Worker is cloudy",
"workerId": "MY-APP",
"name": "My Application",
"checkUpUri": "https://landing-page.mcserver.staging.scottrichardson.dev/",
"expectedRespone": ""
}
To include checkups
curl http://127.0.0.1:8080/api/workers/health?workerId=MY-APP-PAGE&ic=true
Response
{
"status": "Worker is stormy",
"checkUps": [
{
"worker": {
"workerId": "MY-APP",
"name": "My Application",
"checkUpUri": "https://landing-page.mcserver.staging.scottrichardson.dev/",
"expectedRespone": ""
},
"actualResponse": "",
"responseCode": "200 OK"
},
{
"worker": {
"workerId": "MY-APP",
"name": "My Application",
"checkUpUri": "https://landing-page.mcserver.staging.scottrichardson.dev/",
"expectedRespone": ""
},
"actualResponse": "",
"responseCode": "200 OK"
}
],
"workerId": "MY-APP",
"name": "My Application",
"checkUpUri": "https://landing-page.mcserver.staging.scottrichardson.dev/",
"expectedRespone": ""
}