Python3 Tiny Client for Hashicorp Consul
as for
virtualenv
---
$ virtualenv .env
$ . .env/bin/activate
(.env) $ pip install -U git+https://github.com/dkdhub/[email protected]
---
import logging
import time
from consul.agent import ConsulAgent
logging.basicConfig(level=logging.DEBUG)
agent = ConsulAgent(consul_address="127.0.0.1:8500",
service='agent-test-service',
tls=False,
catalog_node='consul')
agent.set_heartbeat_message("127.1.1.1", 9876)
logger = logging.getLogger(__name__)
with agent:
while True:
time.sleep(10)
logger.info("I'm alive!")