service_world

Crates.ioservice_world
lib.rsservice_world
version0.2.0
sourcesrc
created_at2017-11-03 15:06:51.312475
updated_at2020-04-09 14:12:12.150441
descriptionDiscover services from Hasicorp's consul
homepage
repositoryhttps://github.com/lukaspustina/service-world.git
max_upload_size
id37925
size109,452
crates (github:ostreedev:crates)

documentation

https://github.com/lukaspustina/service-world.git

README

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.

> 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

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

Usage

sw-discover

USAGE:
    sw-discover [OPTIONS] <url>

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

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

ARGS:
    <url>    URL of consul agent to retrieve catalog from

Examples

  • sw-discover showing all services and nodes sw-discover showing all services and nodes

  • sw-discover filtering for service name, showing detailed as well as JSON output. sw-discover filtering for service name, showing detailed as well as JSON output

sw-present

USAGE:
    sw-present [FLAGS] --config <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 <config>    Sets config file

ARGS:
    <url>    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

  • sw-present start page sw-present start page

  • sw-present showing service catalog and service links sw-present showing service catalog and service links

  • sw-present showing service navigation sw-present navigation

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
Commit count: 156

cargo fmt