Skip to content

Commit

Permalink
add traefik endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
osallou committed Feb 28, 2019
1 parent b9aa852 commit 34f24a8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 27 deletions.
47 changes: 23 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
language: python
sudo: false
python:
- "2.7"
- "3.4"
- "3.5"
- '2.7'
- '3.4'
- '3.5'
- '3.6'
services:
- mongodb
# Apply only on main branches
- mongodb
branches:
except:
- /^feature.*$/
# command to install dependencies
#before_install:
# - "sudo apt-get update -qq"
# - "sudo apt-get install -qq libldap2-dev libsasl2-dev"
- "/^feature.*$/"
install:
- "pip install flake8"
- "pip install -r requirements.txt"
- "pip install coverage"
- "pip install python-coveralls"
- "python setup.py -q install"
# - "echo data_file=$TRAVIS_BUILD_DIR/.coverage >> .coveragerc"
- pip install flake8
- pip install -r requirements.txt
- pip install coverage
- pip install python-coveralls
- python setup.py -q install
before_script:
- sleep 10

# command to run tests
- sleep 10
script:
- python setup.py test
- flake8 --ignore E501 biomaj_user/*.py
#after_success:
# - coveralls

- python setup.py test
- flake8 --ignore E501 biomaj_user/*.py
deploy:
provider: pypi
skip_existing: true
user: osallou
password:
secure: LKJMO4pp5ZL7LG0xgQsmFLkO9OU6erAoAbVT2Bm6Q21cA1IhT8WivtfEMkatnMATLGQ+a5uCNcNTutLScFXsGavJFUEROKEZ2mrldMs2CMSemzp6txR2XuCuJibz5Q6wxp8A0l1r1y7R+VyJSMVRioRNQ8pb5C19aazEN36Uziuqquwky/R8jFpv7PnwYu8USgalgzeJd7GQdKKVktMJFOE+2EiMwZnlTly6urom1oVXPxk3pb6Ns8p1Wx1fay4p61zCLROSnQAAcKR+saJOCQS9W1yJV0IMrFptzwg4fX6/Q9ukZqOrKJ6a2LmfbwzQ57xl5lGv9/FLff9SWHFgm96pnBhJcoL2PGdRph1zijB8ZZeBJblwEIyRGl7unc5QrV/bjjBWSJiwaysOBnu6l5k1sUNwRW0c5VbkWniw6/q+nJidj5qcaRbJouTDAs4638+HFkMKo8SzzYqCpdCMbUerdvD10bf4uNAEwP5vY0yIyZ+Vbchyk/ZqCurivCK/xQ1bo7HzkG5CWzPyxl01ee+0ZIog148dhoQqXtvsCwjHgtMBgpjU17KqYNbI3EPtqytwV3dRPnlJxrlGMBk/t9ohUEZg71csbgIyfIX0EOO1qD4BocpWXDs3y5mNhHnA7GW5lobFBhx/Qyj3bB12EyzFYzK9157EwxKgo+iQ8PM=
distributions: sdist bdist_wheel
on:
tags: true
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
3.0.7:
Add tags for traefik support
3.0.6:
update ldap3 requirement version to use more recent release
3.0.5:
Expand Down
16 changes: 14 additions & 2 deletions biomaj_user/biomaj_user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

config_file = 'config.yml'
if 'BIOMAJ_CONFIG' in os.environ:
config_file = os.environ['BIOMAJ_CONFIG']
config_file = os.environ['BIOMAJ_CONFIG']

config = None
with open(config_file, 'r') as ymlfile:
Expand All @@ -29,7 +29,19 @@
def consul_declare(config):
if config['consul']['host']:
consul_agent = consul.Consul(host=config['consul']['host'])
consul_agent.agent.service.register('biomaj-user', service_id=config['consul']['id'], address=config['web']['hostname'], port=config['web']['port'], tags=['biomaj'])
consul_agent.agent.service.register(
'biomaj-user',
service_id=config['consul']['id'],
address=config['web']['hostname'],
port=config['web']['port'],
tags=[
'biomaj',
'api',
'traefik.backend=biomaj-user',
'traefik.frontend.rule=PathPrefix:/api/user',
'traefik.enable=true'
]
)
check = consul.Check.http(url='http://' + config['web']['hostname'] + ':' + str(config['web']['port']) + '/api/user', interval=20)
consul_agent.agent.check.register(config['consul']['id'] + '_check', check=check, service_id=config['consul']['id'])

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'url': 'http://biomaj.genouest.org',
'download_url': 'http://biomaj.genouest.org',
'author_email': '[email protected]',
'version': '3.0.6',
'version': '3.0.7',
'classifiers': [
# How mature is this project? Common values are
# 3 - Alpha
Expand Down

0 comments on commit 34f24a8

Please sign in to comment.