diff --git a/get_nginxhost_ip.py b/get_nginxhost_ip.py index 753865d..0791877 100644 --- a/get_nginxhost_ip.py +++ b/get_nginxhost_ip.py @@ -2,9 +2,19 @@ import logging import os +import socket +import sys import docker +try: + socket.getaddrinfo('geonode', '80') + logging.info("k8s service discovery enabled") + print "http://geonode:80" + sys.exit() +except socket.gaierror as e: + logging.info("k8s service discovery not enabled, using docker-compose") + client = docker.from_env() # print client.info() # TODO avoid this script can fail and fall in the loop where the geoserver