Service World - Simply Discover Nodes and Services in Consul

Linux & OS X Build Status MIT licensed

service-world is a Rust and Tokio based library to query Hashicorp's Consul for nodes and services. The intention is to offer a command line tool as well as a simple webserver to discover the available nodes and services. It contains two binaries sw-discover and sw-present. sw-discover is a CLI client to display all services and nodes but also to filter by services and tags. Output can be either colored plain text or json for post-processing. sw-present is intended to generate an HTML web page which can also be served using an internal web server. The HTML is generated using the Handlebars templating language provided through handlebars-rust.

Table of Contents

Installation

Debian Package

Please add my PackageCloud open source repository and install service-world via apt.

```bash

curl -s https://packagecloud.io/install/repositories/lukaspustina/opensource/script.deb.sh | sudo bash sudo apt-get install service-world ```

Binaries

You can find binary releases at GitHub.

Sources

```bash

rustup run nightly cargo install service_world --all-features ```

Usage

sw-discover

```plain USAGE: sw-discover [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: -o, --output Selects output module [default: terminal] [values: terminal, details, json] -s, --service ... Filters service for specified service names -t, --tag ... Filters service for specified tags

ARGS: URL of consul agent to retrieve catalog from ```

Examples

sw-present

```plain USAGE: sw-present [FLAGS] --config [url]

FLAGS: -h, --help Prints help information -r, --rocket Sets Rocket mode -- activates internal web server -V, --version Prints version information

OPTIONS: -c, --config Sets config file

ARGS: URL of consul agent to retrieve catalog from ```

Configuration

There is a self-explanatory example configuration file in the examples subdirectory. A minimalistic example configuration showing the mandatory configuration parameters is bundled in the Debian Package distribution subdirectory. This subdirectory also includes two examples for the necessary web page templates.

There are basically three sections. A general section describing where to find consul, a start page section specifying links for the start page, and a service section. The service section may specify link templates for each search that is used to generate links for each service in the service overview. In this way, you can enrich the service view with direct URLs for each service. For examples, HAProxy services can link to their monitor web page and Elastic Search services may link to their installed management plugins etc.

Examples

Postcardware

You're free to use service-world. If you find it useful, I would highly appreciate you sending me a postcard from your hometown mentioning how you use service-world. My work address is

Lukas Pustina CenterDevice GmbH Rheinwerkallee 3 53227 Bonn Germany