Merge pull request #13 from Surkoveds/consul

Consul
This commit is contained in:
Denis 2017-01-23 15:53:47 +02:00 committed by GitHub
commit d83ed8b752
5 changed files with 31 additions and 18 deletions

View File

@ -15,5 +15,6 @@ before_install:
- ./build.sh centos_rpm
- ./build.sh fedora_rpm
# tests script
script:
- ./runtests.sh

View File

@ -1,5 +1,5 @@
# Surok
[![Build Status](https://travis-ci.org/Difrex/surok.svg?branch=master)](https://travis-ci.org/Difrex/surok)
[![Build Status](https://travis-ci.org/Surkoveds/surok.svg?branch=master)](https://travis-ci.org/Surkoveds/surok)
Service discovery for Apache Mesos.
@ -38,7 +38,7 @@ ENTRYPOINT is: ```cd /opt/surok && pytho3 surok.py -c /etc/surok/conf/surok.json
## Documentation
[Wiki](https://github.com/Difrex/surok/wiki)
[Wiki](https://github.com/Surkoveds/surok/wiki)
## Known issues

View File

@ -1,22 +1,26 @@
{
"marathon": {
"force": true,
"host": "http://marathon.mesos:8080",
"enabled": false
},
"force": true,
"host": "http://marathon.mesos:8080",
"enabled": false
},
"consul": {
"enabled": false,
"domain": "service.dc1.consul"
},
"confd": "/etc/surok/conf.d",
"domain": "marathon.mesos",
"wait_time": 20,
"lock_dir": "/var/tmp",
"loglevel": "info",
"container": false,
"memcached": {
"enabled": false,
"discovery": {
"enabled": false,
"service": "memcached",
"group": "system"
},
"hosts": ["localhost:11211"]
}
"container": false,
"memcached": {
"enabled": false,
"discovery": {
"enabled": false,
"service": "memcached",
"group": "system"
},
"hosts": ["localhost:11211"]
}
}

3
debian/docs vendored
View File

@ -1,3 +1,4 @@
README.md
doc/ru/*
docs/*md
LICENSE
AUTHORS

View File

@ -12,7 +12,7 @@ def resolve(app, conf):
services = app['services']
domain = conf['domain']
for service in services:
for service in services:
hosts[service['name']] = []
group = get_group(service, app)
@ -45,6 +45,13 @@ def resolve(app, conf):
# }
# ]
fqdn = ''
# Discovery over Consul DNS
if 'consul' in conf and conf['consul']['enabled']:
fqdn = '_' + service['name'] + '._tcp.' + conf['consul']['domain']
hosts[service['name']].append(do_query(fqdn, conf['loglevel']))
continue
if ports is not None:
for port_name in ports:
fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain # Need support for udp ports. See #16