diff --git a/docker/geoserver/Dockerfile b/docker/geoserver/Dockerfile index 46154556..6ca233f2 100644 --- a/docker/geoserver/Dockerfile +++ b/docker/geoserver/Dockerfile @@ -43,10 +43,6 @@ RUN wget --no-check-certificate https://repo1.maven.org/maven2/org/postgis/postg RUN mkdir -p /usr/local/tomcat/tmp WORKDIR /usr/local/tomcat/tmp COPY set_geoserver_auth.sh /usr/local/tomcat/tmp -COPY setup_auth.sh /usr/local/tomcat/tmp -COPY requirements.txt /usr/local/tomcat/tmp -COPY get_dockerhost_ip.py /usr/local/tomcat/tmp -COPY get_nginxhost_ip.py /usr/local/tomcat/tmp COPY entrypoint.sh /usr/local/tomcat/tmp COPY ./templates /templates COPY multidump.sh /usr/local/tomcat/tmp @@ -56,12 +52,7 @@ RUN apt-get update \ && apt-get install -y procps less \ && apt-get install -y python3 python3-pip python3-dev \ && chmod +x /usr/local/tomcat/tmp/set_geoserver_auth.sh \ - && chmod +x /usr/local/tomcat/tmp/setup_auth.sh \ - && chmod +x /usr/local/tomcat/tmp/entrypoint.sh \ - && pip3 install pip --upgrade \ - && pip3 install -r requirements.txt \ - && chmod +x /usr/local/tomcat/tmp/get_dockerhost_ip.py \ - && chmod +x /usr/local/tomcat/tmp/get_nginxhost_ip.py + && chmod +x /usr/local/tomcat/tmp/entrypoint.sh RUN pip install j2cli diff --git a/docker/geoserver/entrypoint.sh b/docker/geoserver/entrypoint.sh index f9b4d9a9..78050f82 100644 --- a/docker/geoserver/entrypoint.sh +++ b/docker/geoserver/entrypoint.sh @@ -32,9 +32,6 @@ fi if [ -z `echo ${NGINX_BASE_URL} | sed 's/http:\/\/\([^:]*\).*/\1/'` ] then echo "NGINX_BASE_URL is empty so I'll use the static nginx hostname \n" - # echo export NGINX_BASE_URL=`python3 /usr/local/tomcat/tmp/get_nginxhost_ip.py` >> /root/.override_env - # TODO rework get_nginxhost_ip to get URL with static hostname from nginx service name - # + exposed port of that container i.e. http://django:8000 echo export NGINX_BASE_URL=http://django:8000 >> /root/.override_env echo "The calculated value is now NGINX_BASE_URL='$NGINX_BASE_URL' \n" else diff --git a/docker/geoserver/get_dockerhost_ip.py b/docker/geoserver/get_dockerhost_ip.py deleted file mode 100644 index 9194f4ef..00000000 --- a/docker/geoserver/get_dockerhost_ip.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 - -import logging - -import docker - -BOOTSTRAP_IMAGE_CHEIP = "codenvy/che-ip:nightly" -# AF: why call before definition? print _docker_host_ip() - - -def _docker_host_ip(): - client = docker.from_env() - ip_list = client.containers.run(BOOTSTRAP_IMAGE_CHEIP, network_mode="host").split( - "\n" - ) - if len(ip_list) > 1: - logging.info( - "Docker daemon is running on more than one \ -address {0}".format( - ip_list - ) - ) - logging.info("Only the first address:{0} will be returned!".format(ip_list[0])) - else: - logging.info( - "Docker daemon is running at the following \ -address {0}".format( - ip_list[0] - ) - ) - return ip_list[0] diff --git a/docker/geoserver/get_nginxhost_ip.py b/docker/geoserver/get_nginxhost_ip.py deleted file mode 100644 index 62d8f57c..00000000 --- a/docker/geoserver/get_nginxhost_ip.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 - -import logging -import os - -import docker - -client = docker.from_env() -# print(client.info()) -# TODO avoid this script can fail and fall in the loop where the geoserver -# service is not available and consequently the nginx too which has geoserver -# as a reference link -for network in client.networks.list(): - if "geonode" in network.name: - geonode_network = network.name - else: - geonode_network = "geonode_default" - -try: - containers = { - c.attrs["Config"]["Image"]: c.attrs["NetworkSettings"][ - "\ -Networks" - ][geonode_network][ - "\ -IPAddress" - ] - for c in client.containers.list() - if c.status in "running" - } - for item in containers.items(): - if "geonode/nginx" in item[0]: - ipaddr = item[1] - - try: - os.environ["NGINX_BASE_URL"] = "http://" + ipaddr + ":" + "80" - nginx_base_url = "http://{}:80".format(ipaddr) - except NameError as er: - logging.info( - "NGINX container is not running maybe exited! Running\ -containers are:{0}".format( - containers - ) - ) -except KeyError as ke: - logging.info( - "There has been a problem with the docker\ -network which has raised the following exception: {0}".format( - ke - ) - ) -else: - # nginx_base_url = None - pass -finally: - try: - print(nginx_base_url) - except NameError as ne: - print("http://django:8000") diff --git a/docker/geoserver/requirements.txt b/docker/geoserver/requirements.txt deleted file mode 100644 index 0b31242f..00000000 --- a/docker/geoserver/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -docker==3.1.1 diff --git a/docker/geoserver/setup_auth.sh b/docker/geoserver/setup_auth.sh deleted file mode 100644 index 6f9373b9..00000000 --- a/docker/geoserver/setup_auth.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -sed -i.bak 's@\([^<][^<]*\)@'"$DJANGO_URL"'@'\ - /geoserver_data/data/security/auth/geonodeAuthProvider/config.xml \ No newline at end of file