Giter Site home page Giter Site logo

go-supervise's Introduction

Go Supervise

A lightweight GoLang service supervisor.

Getting started

Starting a production server

 mkdir go-supervise && cd $_
 wget https://raw.githubusercontent.com/scottjr632/go-supervise/master/docker-compose.yml

Create server.config.yml file

 touch server.config.yml
 vi server.config.yml
example server config file
server:
  port: 11223

services:
  checkupservice:
    interval: 35 
    uniqueids: true

datastore:
  dbname: go-service
  connectionstring: mongodb://database:27017

jwt:
  tokenname: access_token
  protectedpath: /api/protected

Deploy using Kubernetes

cd k8s/
kubectl apply -f go-supervise-db.yml
kubectl apply -f go-supervise-server.yml

To deploy with the web client

kubectl apply -f go-supervise-client.yml

Deploy using docker-compose

Uncomment from docker-compose to include web client

# 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

Start the services

 docker-compose up -d

Starting a dev server

 git clone https://github.com/scottjr632/go-supervise.git
 cd go-supervise
 docker-compose up

Registring a worker

Make an HTTP post request to supervisor that contains

{
	"workerId": "MY-APP",
	"name": "My Application",
	"checkUpUri": "http://validtesturi.com/health",
	"expectedRespone": "{\"status\": \"up\"}"
}

Checking the worker's health

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": ""
}

go-supervise's People

Contributors

scottjr632 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.