Code Monkey home page Code Monkey logo

consul-scala-macro-annotations's Introduction

consul-scala-macro-annotations

Start Consul

$ consul agent -config-file=config.consul.json &

config.consul.json

{
    "ui": true,
    "retry_join": ["172.20.20.31"],
    "advertise_addr": "172.20.20.1",
    "data_dir": "/tmp/consul",
    "disable_remote_exec": false,
    "enable_script_checks": true
}

Clone Repo

$ git clone [email protected]:codingkapoor/consul-scala-macro-annotations.git

Build Package

$ cd consul-scala-macro-annotations
$ sbt> project myservice
$ sbt> universal:packageBin

Start Service

$ cd consul-scala-macro-annotations/myservice/target/universal
$ unzip myservice-0.1.0-SNAPSHOT.zip
$ cd myservice-0.1.0-SNAPSHOT
$ bin/start.sh
$ tail -f logs/stdout.log

Direct browser @localhost:8080

Accessing root at @localhost:8080 should return following message.

Microservices can use @EnableServiceDiscovery macro-annotation to register themselves to Consul out of the box.

Consul Health Checks

curl http://localhost:8500/v1/health/checks/v0.1.0-SNAPSHOT_myservice?pretty

Healthy

[
    {
        "Node": "inblrlt-shivam",
        "CheckID": "service:2fd993e4931427b89f1bc832a6192ee0",
        "Name": "Service 'v0.1.0-SNAPSHOT_myService' check",
        "Status": "passing",
        "Notes": "",
        "Output": "Sun Dec 23 20:37:06 IST 2018: MyService is running\n",
        "ServiceID": "2fd993e4931427b89f1bc832a6192ee0",
        "ServiceName": "v0.1.0-SNAPSHOT_myService",
        "ServiceTags": [
            "tag1",
            "tag2"
        ],
        "Definition": {},
        "CreateIndex": 13070,
        "ModifyIndex": 13102
    }
]

Unhealthy

[
    {
        "Node": "inblrlt-shivam",
        "CheckID": "service:2fd993e4931427b89f1bc832a6192ee0",
        "Name": "Service 'v0.1.0-SNAPSHOT_myService' check",
        "Status": "warning",
        "Notes": "",
        "Output": "Sun Dec 23 20:40:18 IST 2018: MyService is not running\n",
        "ServiceID": "2fd993e4931427b89f1bc832a6192ee0",
        "ServiceName": "v0.1.0-SNAPSHOT_myService",
        "ServiceTags": [
            "tag1",
            "tag2"
        ],
        "Definition": {},
        "CreateIndex": 13070,
        "ModifyIndex": 13124
    }
]

consul-scala-macro-annotations's People

Watchers

Shivam 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.