From c4b8be682d1e583e052c1aef4eab6b3cfb8d0b91 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Wed, 18 Jan 2017 11:43:01 +0300 Subject: [PATCH 1/5] travis link update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6355779..68d4934 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. From e20811687dede7cfd72e18668934dafeb7a03738 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Wed, 18 Jan 2017 12:02:47 +0300 Subject: [PATCH 2/5] comment --- .travis.yml | 1 + 1 file changed, 1 insertion(+) 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 From 36917da190039d5b8a55a13d18876908d3501b78 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Wed, 18 Jan 2017 12:15:02 +0300 Subject: [PATCH 3/5] link to wiki update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68d4934..858bf6e 100644 --- a/README.md +++ b/README.md @@ -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 From bde94dd1fab27306ffdac1c28e9484fd38f4eedc Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Thu, 19 Jan 2017 15:04:49 +0300 Subject: [PATCH 4/5] docs in debian package --- debian/docs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 3511f1318096a5f5e901039a02c4d795e4b455ea Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Sat, 21 Jan 2017 10:58:02 +0300 Subject: [PATCH 5/5] Consul DNS discovery. Related to #12 --- conf/surok.json | 32 ++++++++++++++++++-------------- surok/discovery.py | 9 ++++++++- 2 files changed, 26 insertions(+), 15 deletions(-) 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/surok/discovery.py b/surok/discovery.py index 4f93da5..1e78730 100644 --- a/surok/discovery.py +++ b/surok/discovery.py @@ -14,7 +14,7 @@ def resolve(app, conf): for service in services: hosts[service['name']] = {} - + group = get_group(service, app) if group is False: error('Group is not defined in config, SUROK_DISCOVERY_GROUP and MARATHON_APP_ID') @@ -31,6 +31,13 @@ def resolve(app, conf): # This is fast fix for port naming # Will be rewrite later fqdn = '' + + # Discovery over Consul DNS + if 'consul' in conf and conf['consul']['enabled']: + fqdn = '_' + service['name'] + '._tcp.' + conf['consul']['domain'] + hosts[service['name']] = do_query(fqdn, conf['loglevel']) + continue + if ports is not None: for port_name in ports: fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain