Name: discovery-python
Owner: Clever
Description: Programmatically find service endpoints (i.e. discovery-go for python)
Created: 2016-03-08 23:00:57.0
Updated: 2017-01-10 02:49:53.0
Pushed: 2018-01-11 18:28:30.0
Homepage: null
Size: 12
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This library programmatically finds endpoints for dependencies. Similar to discovery-go and disocvery-node.
See Service Discovery for more details.
Assuming discovery v0.1.0 is being installed:
install git+https://github.com/Clever/discovery-python.git@v0.1.0
setuptools import setup
suming discovery v0.1.0 is being installed:
p(
# ...
install_requires=['discovery==0.1.0'],
dependency_links=[
'https://github.com/Clever/discovery-python/tarball/v0.1.0#egg=discovery-0.1.0'
],
# ...
rt discovery
stoked_url = discovery.url('stoked', 'thrift')
stoked_host_and_port = discovery.host_port('stoked', 'thrift')
stoked_host = discovery.host('stoked', 'thrift')
stoked_port = discovery.port('stoked', 'thrift')
pt discovery.MissingEnvironmentVariableError as e:
print 'ERROR: Stoked discovery failed: {}.'.format(e)
Bump the version in the VERSION
file and update the changelog in CHANGES.md
.
Merge your changes into master
.
Checkout master
Run the publish script:
blish.sh
Currently, discovery-{go,node,python}
looks for environment variables with the following format:
ICE_{SERVICE_NAME}_{EXPOSE_NAME}_{PROTO,HOST,PORT}
These environment variables are autogenerated by our deployment tooling.
Three env-vars are created for each app listed in the dependencies
section of caller's launch yaml.
For example, if an app lists district-authorizations
as a dependency, fab and catapult will generate this env-vars triplet:
ICE_DISTRICT_AUTHORIZATIONS_HTTP_PROTO = "http"
ICE_DISTRICT_AUTHORIZATIONS_HTTP_HOST = "district-authorizations.ops.clever.com"
ICE_DISTRICT_AUTHORIZATIONS_HTTP_PORT = "80"