Git Product home page Git Product logo

submitsd's Introduction

SubmitSD

SubmitSD is a proof of concept service discovery service/server.

It is still under development and not feature complete.

Setup your environment

Before you do anything, always run the following command to generate all the necessary code used in the project.

$ make generate

Building binaries

Running make will generated all the necessary code and build Linux and Windows binaries and place them under the builds directory.

$ make

Running service while developing

Running the service while devloping can be done with make

$ make run

To change the address or mode pass in the updated variables

variables OPTIONS
MODE release/debug
ADDR address:port

Example:

$ make ADDR=localhost:8000 run

Running the service

Execute the binary which will start listening on address localhost:8081. Use -h for help.

$ cd builds
$ ./submitSD server
[GIN-debug] Listening and serving HTTP on localhost:8081

Once the server is running and accepting client connections, you can naviate to the address above in a browser or any other HTTP method.

Accessing the service via a browser will take you to the playground where you can start playing with the API.

Features in the pipeline

Please note that this is still in early development and below is a list of features that I would like to still implement.

  • Add services
  • Renew services TTL
  • Auto expiry of services
  • GraphQL and served up via HTTP router
  • Pubsub events via subscriptions
  • Auto expiry and cleanups
    • Backend store should periodically clean up expired services
    • Backend store should take clean up callbacks and publish cleaned/expired services
    • Issue with CTRL-C and stopping the cleanup and store properly - BUG
    • Issue with the service passed to the callback it is not passing the correct service removed, it is some old reference - BUG
  • Service queries by
    • type
    • name
    • version
    • etc....
  • Indexing for fast lookups and queries
  • Persistance (optional)
  • gRPC service
  • RestAPI
  • Web based GUI with realtime updates
  • Extend the message to include service config
  • Add Update API calls to updated services
  • Proper tests ...more to come

Example

Create a service

Query:

mutation create {
  create(
    input: {id: "server", name: "submitSD", description: "graphQL server", version: "v0.0.0", address: "localhost:8081", ttl: "1m"}
  ) {
    id
    created_at
    name
    description
    address
    ttl
    expires_at
  }
}

Response:

{
  "data": {
    "create": {
      "id": "server",
      "created_at": "2022-10-06T00:11:31.628603+11:00",
      "name": "submitSD",
      "description": "graphQL server",
      "address": "localhost:8081",
      "ttl": "1m",
      "expires_at": "2022-10-06T00:12:31.628606+11:00"
    }
  }
}

Renew a service before it expires

Query:

mutation renew {
  renew(input: {id: "server", ttl: "1m"}) {
    id
    created_at
    name
    description
    address
    ttl
    expires_at
  }
}

Response:

{
  "data": {
    "renew": {
      "id": "server",
      "created_at": "2022-10-06T00:15:25.217102+11:00",
      "name": "submitSD",
      "description": "graphQL server",
      "address": "localhost:8081",
      "ttl": "1m0s",
      "expires_at": "2022-10-06T00:16:35.567788+11:00"
    }
  }
}

Get all services

Query:

query all {
  services {
    id
    created_at
    name
    description
    address
    ttl
    expires_at
  }
}

Response:

{
  "data": {
    "services": [
      {
        "id": "server",
        "created_at": "2022-10-06T00:13:34.830831+11:00",
        "name": "submitSD",
        "description": "graphQL server",
        "address": "localhost:8081",
        "ttl": "1m",
        "expires_at": "2022-10-06T00:14:34.830832+11:00"
      }
    ]
  }
}

Events subscription

Query:

subscription pubsub {
  events {
    timestamp
    event
    service {
      name
    }
  }
}

Response:

{
  "data": {
    "events": {
      "timestamp": "2022-10-10T22:53:37.908826+11:00",
      "event": "RENEWED",
      "service": {
        "name": "submitSD"
      }
    }
  }
}

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.