Skip to main content

Agador metaservice for microservices

Project description

# Agador Metaservice for Microservices

<img src=""/>

Agador is a tool for easily fetching microservice clients using a [consul Key/Value data]( or using its own deployable microservice. With a loaded KV store or a deployed microservice, the agador client can supply a handle to another service.

## Configuration

The agador configuration YAML file defines its services by name and then defines the Python object it will return. An example redis configuration might look like this:

port: 6379
db: 0

This defines a service called `"redis"` that will be initialized in Python with:

redis.StrictRedis(host="", port=6379, db=0)

## Consul

Consul provides a KV store that can be accessed via `http://<host>:8500/v1/kv/<keys>`. The `consul` module of agador exposes a `load_config()` method that can be used to load a dictionary into the KV store.

config = {
"redis": {
"redis.StrictRedis": {
"host": "",
"port": 6379,
"db": 0


By default agador stores its config under the prefix `/v1/kv/agador/<service>/<object>/<arg>`. The `flags` value of the key is used to determine the type:

* `1` is a float
* `2` is an int
* `3` is a string

## Agador Server

If for whatever reason it is not possible to use consul, an agador server can be stood up using the `agador` command and a supplied JSON or YAML configuration URL. Becasue agador uses [furi]( to parse the URL, the configuration file can be stored locally or on S3.

agador --config s3://bucket/path/to/config.yaml

# or

agador --config ./config.json

## Agador Client

Once an agador service is available through consul or its own service, a Python client can be used to extract a service client for any service defined in the service's configuration.

Example `myservice` usage:

import agador

myservice = agador.service("myservice", host="localhost", port=8500)
# => <MyServiceClient>

Agador accepts `ENV` variables as defaults for the agador service location:

* `AGADOR_HOST` the consul or agador host
* `AGADOR_PORT` the consul or agador port
* `AGADOR_SCHEME` http or https
* `AGADOR_KVPATH` the endpoint of the consul KV store (eg, `/v1/kv/agador`)

## Agador example using docker-compose

One potential use case for agador is to stand up a sandboxed local environment where all the services are available locally in a Docker network. A runnable example of this can be found in the [example](./example) directory of this repository.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
agador-0.1.0.tar.gz (5.0 kB) Copy SHA256 hash SHA256 Source None Jun 1, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page