11 releases
Uses old Rust 2015
0.2.0 | Apr 9, 2020 |
---|---|
0.1.1 | Mar 28, 2018 |
0.1.0 | Feb 8, 2018 |
0.0.9 | Dec 12, 2017 |
0.0.6 | Nov 29, 2017 |
#4 in #consul
38 downloads per month
39KB
824 lines
Service World - Simply Discover Nodes and Services in Consul
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 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 showing service catalog and service links
-
sw-present showing service 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
Dependencies
~15–23MB
~333K SLoC