diff --git a/.travis.yml b/.travis.yml index 574f75b..0b3c7b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,5 +15,6 @@ before_install: - ./build.sh centos_rpm - ./build.sh fedora_rpm +# tests script script: - ./runtests.sh diff --git a/README.md b/README.md index 6355779..858bf6e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/conf/surok.json b/conf/surok.json index bed8ebc..c48ef84 100644 --- a/conf/surok.json +++ b/conf/surok.json @@ -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"] + } } diff --git a/debian/docs b/debian/docs index 010f2f9..1f821b1 100644 --- a/debian/docs +++ b/debian/docs @@ -1,3 +1,4 @@ README.md -doc/ru/* +docs/*md +LICENSE AUTHORS diff --git a/surok/discovery.py b/surok/discovery.py index 9dc3cfd..ff494fa 100644 --- a/surok/discovery.py +++ b/surok/discovery.py @@ -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