Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unbit/uwsgi-consul
uWSGI plugin for consul integration
https://github.com/unbit/uwsgi-consul
Last synced: about 1 month ago
JSON representation
uWSGI plugin for consul integration
- Host: GitHub
- URL: https://github.com/unbit/uwsgi-consul
- Owner: unbit
- License: mit
- Created: 2014-08-04T11:49:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-12-09T14:05:12.000Z (about 7 years ago)
- Last Synced: 2024-10-19T00:54:44.777Z (about 2 months ago)
- Language: C
- Size: 16.6 KB
- Stars: 29
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-consul - uwsgi-consul: uWSGI plugin for consul integration
README
uwsgi-consul
============uWSGI plugin for consul (http://www.consul.io) integration
INSTALL
=======The plugin is 2.x friendly:
```sh
uwsgi --build-plugin https://github.com/unbit/uwsgi-consul
```you will end with consul_plugin.so in the current directory
USAGE
=====The plugin exposes a single option: `consul-register`
It allows your uWSGI instance to register as a service (with TTL health ckeck) to a (preferibly local) consul agent.
The `consul-register` option is keyval based, and it takes the following mendatory keys:
* `name` : the service name, you can use the magic var %n to use your application's INI name
* `url` : the api base url, generally scheme and domain, example: http://localhost:8500Optional key options:
* `address` : the service instance address. Defaults to the consul agent address if not specified
* `check_url` : the api url for registering the service healthcheck, if not specified is built as url+/v1/agent/check/pass/service:+id or name
* `debug` : print http transactions in logs, for debugging
* `deregister_url` : the api url for deregistering services, if not specified is built as url+/v1/agent/service/deregister/+id
* `id` : the service instance unique id, used if multiple services share the same name
* `port` : the service instance port
* `register_url` : the api url for registering the new service, if not specified is built as url+/v1/agent/service/register
* `ssl_no_verify` : if the http api is over https you can disable certificate verification
* `tags` : space separated list of tags
* `token` : the consul token to use.
* `ttl` : ttl for healthchecks in seconds, default 30
* `wait_workers` : do not register the service until all of the workers are ready, default 1How it works
============A thread for each configured service is spawned in the master.
The thread registers the service with the api at the first run, then it start sending ttl checks every configured ttl/3.
On error condition, the thread restart its cycle, re-registering the service
Example
=======```ini
[uwsgi]
plugins = python,consul
; register instance 'servicenode0002' on port 9091 for service 'foobar', waiting for workers
consul-register = url=http://localhost:8500,id=servicenode0002,name=foobar,port=9091,ttl=30,wait_workers=1
http-socket = :9091
processes = 4
wsgi-file = myapp.py
```