Ticket #177: docker-clean.patch
File docker-clean.patch, 18.9 KB (added by samsouk, 4 years ago) |
---|
-
docker/default.conf
diff -ruN ../ZOO-Project.orig/docker/default.conf ./docker/default.conf
old new 1 <VirtualHost *:80> 2 # The ServerName directive sets the request scheme, hostname and port that 3 # the server uses to identify itself. This is used when creating 4 # redirection URLs. In the context of virtual hosts, the ServerName 5 # specifies what hostname must appear in the request's Host: header to 6 # match this virtual host. For the default virtual host (this file) this 7 # value is not decisive as it is used as a last resort host regardless. 8 # However, you must set it for any further virtual host explicitly. 9 #ServerName www.example.com 10 11 ServerAdmin webmaster@localhost 12 DocumentRoot /var/www/html 13 14 # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 15 # error, crit, alert, emerg. 16 # It is also possible to configure the loglevel for particular 17 # modules, e.g. 18 #LogLevel info ssl:warn 19 20 #ErrorLog ${APACHE_LOG_DIR}/error.log 21 #CustomLog ${APACHE_LOG_DIR}/access.log combined 22 ErrorLog /dev/stderr 23 TransferLog /dev/stdout 24 25 # For most configuration files from conf-available/, which are 26 # enabled or disabled at a global level, it is possible to 27 # include a line for only one particular virtual host. For example the 28 # following line enables the CGI configuration for this host only 29 # after it has been globally disabled with "a2disconf". 30 #Include conf-available/serve-cgi-bin.conf 31 </VirtualHost> -
docker/main.cfg
diff -ruN ../ZOO-Project.orig/docker/main.cfg ./docker/main.cfg
old new 1 [main] 2 encoding = utf-8 3 version = 1.0.0 4 serverAddress = http://www.zoo-project.org/zoo/ 5 language = en-US 6 lang = fr-FR,en-CA,en-US 7 tmpPath=/tmp/ 8 tmpUrl = ../tmpPathRelativeToServerAdress/ 9 dataPath = /usr/com/zoo-project 10 cacheDir = /tmp/ 11 12 [identification] 13 title = The ZOO-Project OGC WPS Development Server 14 abstract = Development version of ZOO-Project OGC WPS. See http://www.zoo-project.org 15 fees = None 16 accessConstraints = none 17 keywords = WPS,GIS,buffer 18 19 [provider] 20 providerName=ZOO-Project 21 providerSite=http://www.zoo-project.org 22 individualName=Gerald FENOY 23 positionName=Developer 24 role=Dev 25 addressDeliveryPoint=1280, avenue des Platanes 26 addressCity=Lattes 27 addressAdministrativeArea=False 28 addressPostalCode=34970 29 addressCountry=fr 30 addressElectronicMailAddress=gerald.fenoy@geolabs.fr 31 phoneVoice=False 32 phoneFacsimile=False 33 34 [database] 35 dbname=zoo 36 port=5432 37 user=zoo 38 password=zoo 39 host=pgbouncer 40 type=PG 41 schema=public 42 -
docker/oas.cfg
diff -ruN ../ZOO-Project.orig/docker/oas.cfg ./docker/oas.cfg
old new 1 [openapi] 2 rootUrl=http://localhost/cgi-bin/zoo_loader.cgi 3 links=/,/api,/conformance,/processes 4 paths=/root,/api,/conformance,/processes,/processes/{id},/processes/{id}/jobs,/processes/{id}/jobs/{jobID},/processes/{id}/jobs/{jobID}/result 5 parameters=id,jobID,resultID 6 header_parameters=oas-header1,oas-header2 7 version=3.0.1 8 9 [oas-header1] 10 in=header 11 name=Prefer 12 type=string 13 required=false 14 enum=respond-async 15 16 [oas-header2] 17 in=header 18 name=Prefer 19 type=string 20 required=false 21 enum=return=representation,return=minimal 22 23 [/] 24 rel=self 25 type=application/json 26 title=this document 27 28 [root] 29 method=get 30 title=landing page of this API 31 abstract=The landing page provides links to the API definition, the Conformance statements and the metadata about the processes offered by this service. 32 tags=Home 33 tags_description= 34 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/root.yaml 35 36 [/api] 37 rel=service 38 type=application/openapi+json;version=3.0 39 title=the API definition 40 41 [api] 42 method=get 43 title=This document 44 abstract=This document 45 tags=API 46 tags_description= 47 schema= 48 49 [/conformance] 50 rel=conformance 51 type=application/json 52 title=WPS 2.0 REST/JSON Binding Extension conformance classes implemented by this server 53 54 [conformance] 55 method=get 56 title=information about standards that this API conforms to 57 abstract==list all requirements classes specified in a standard (e.g., WPS REST/JSON Binding Core) that the server conforms to 58 tags=Conformance 59 tags_description= 60 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/req-classes.yaml 61 62 [/processes] 63 rel=processes 64 type=application/json 65 title=The processes offered by this server 66 67 [processes] 68 method=get 69 title=retrieve available processes 70 abstract=Information about the available processes 71 tags=GetCapabilities 72 tags_description= 73 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/processCollection.yaml 74 75 [processes/{id}] 76 method=get 77 title=retrieve a process description 78 abstract=A process description. 79 tags=ProcessDescription 80 tags_description= 81 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/process.yaml 82 parameters=/components/parameters/id 83 84 85 [/processes/{id}/jobs] 86 rel=canonical 87 type=application/json 88 title=Process Description 89 90 [processes/{id}/jobs] 91 length=2 92 method=get 93 title=retrieve a list of jobs run 94 abstract=A list of jobs run. 95 tags=JobList 96 tags_description= 97 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/jobCollection.yaml 98 parameters=/components/parameters/id 99 method_1=post 100 title_1=execute a job 101 abstract_1=An execute endpoint. 102 tags_1=Execute Endpoint 103 tags_description_1= 104 schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/result.yaml 105 parameters_1=/components/parameters/id,/components/parameters/oas-header1 106 107 [requestBody] 108 abstract=Mandatory execute request in JSON format 109 type=application/json 110 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/execute.yaml 111 112 [/processes/{id}/jobs/{jobID}] 113 rel=canonical 114 type=application/json 115 title=Status 116 117 [processes/{id}/jobs/{jobID}] 118 method=get 119 title=The status of a job. 120 abstract=The status of a job. 121 tags=GetStatus 122 tags_description= 123 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/statusInfo.yaml 124 parameters=/components/parameters/id,/components/parameters/jobID 125 126 [/processes/{id}/jobs/{jobID}/result] 127 rel=canonical 128 type=application/json 129 title=Get Result 130 131 [processes/{id}/jobs/{jobID}/result] 132 method=get 133 title=The result of a job execution. 134 abstract=The result of a job execution. 135 tags=GetResult 136 tags_description= 137 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/result.yaml 138 parameters=/components/parameters/id,/components/parameters/jobID 139 ep=,/components/parameters/oas-header2 140 141 [/processes/{id}/jobs/{jobID}/result/{resultID}] 142 rel=canonical 143 type=application/json 144 title=Get Result 145 146 [processes/{id}/jobs/{jobID}/result/{resultID}] 147 method=get 148 title=The result of a job execution. 149 abstract=The result of a job execution. 150 tags=GetResult 151 tags_description= 152 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/valueType.yaml 153 parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID,/components/parameters/oas-header2 154 155 156 [{id}] 157 type=string 158 title=The id of a process 159 abstract=The id of a process 160 in=path 161 required=true 162 example=buffer 163 164 [{jobID}] 165 type=string 166 title=The id of a job 167 abstract=The id of a job 168 in=path 169 required=true 170 171 [{resultID}] 172 type=string 173 title=The id of an output 174 abstract=The id of an output 175 in=path 176 required=true 177 178 [{f}] 179 default=json 180 enum=json 181 title=The optional f parameter 182 abstract=The optional f parameter indicates the output format which the server shall provide as part of the response document. The default format is JSON. 183 in=query 184 required=false 185 186 [conformTo] 187 rootUrl=http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/ 188 link=core 189 link_1=oas30 190 link_2=json 191 length=3 192 193 [exception] 194 abstract=Exception 195 type=application/json 196 schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/exception.yaml 197 -
docker/test_long_process.py
diff -ruN ../ZOO-Project.orig/docker/test_long_process.py ./docker/test_long_process.py
old new 1 import argparse 2 import requests 3 import time 4 5 from threading import Thread 6 from xml.etree import ElementTree 7 8 parser = argparse.ArgumentParser() 9 parser.add_argument("threads", help="number of threads", type=int) 10 args = parser.parse_args() 11 12 13 class LongProcess(Thread): 14 def __init__(self, name): 15 Thread.__init__(self) 16 self.name = name 17 self.progress = None 18 self.location_url = self.launch_long_process() 19 print("INIT %s %s" % (self.name, self.location_url)) 20 21 def launch_long_process(self): 22 endpoint_url = "http://localhost/cgi-bin/zoo_loader.cgi" 23 params = dict( 24 request="Execute", 25 service="WPS", 26 version="1.0.0", 27 Identifier="longProcess", 28 DataInputs="a=toto", 29 ResponseDocument="Result", 30 storeExecuteResponse="true", 31 status="true", 32 ) 33 r = requests.get(endpoint_url, params=params) 34 root = ElementTree.fromstring(r.content) 35 36 location_url = root.attrib["statusLocation"] 37 return location_url 38 39 def get_progress(self): 40 progress = None 41 r = requests.get(self.location_url) 42 root = ElementTree.fromstring(r.content) 43 ns = dict(wps="http://www.opengis.net/wps/1.0.0") 44 status = root.find("wps:Status", ns) 45 if status: 46 ctime = status.attrib["creationTime"] 47 started = root.find("wps:Status/wps:ProcessStarted", ns) 48 #started = root.find("wps:ProcessStarted", ns) 49 succeeded = root.find("wps:Status/wps:ProcessSucceeded", ns) 50 #succeeded = root.find("wps:ProcessSucceeded", ns) 51 if started is not None and started.attrib["percentCompleted"]: 52 percent = started.attrib["percentCompleted"] 53 progress = int(percent) 54 elif succeeded is not None: 55 progress = 100 56 else: 57 # error? 58 print(r.content.decode()) 59 progress = None 60 else: 61 print(r.content.decode()) 62 progress = -1 63 64 self.progress = progress 65 return self.progress 66 67 def run(self): 68 print("Thread %s: starting" % self.name) 69 while True: 70 progress = self.get_progress() 71 if progress == 100: 72 print("Thread %s: succeeded" % self.name) 73 break 74 elif progress == -1: 75 print("Thread %s: failed" % self.name) 76 break 77 elif progress is None: 78 print("Thread %s: error" % self.name) 79 break 80 else: 81 print("Thread %s :progress %s" % (self.name, progress)) 82 time.sleep(1.0) 83 print("Thread %s: finishing" % self.name) 84 85 86 threads = list() 87 for i in range(0, args.threads): 88 t = LongProcess(i) 89 t.start() 90 threads.append(t) 91 92 for t in threads: 93 t.join() 94 -
docker-compose.yml
diff -ruN ../ZOO-Project.orig/docker-compose.yml ./docker-compose.yml
old new 1 version: '3' 2 services: 3 zookernel: 4 build: . 5 ports: 6 - "80:80" 7 volumes: 8 - ./docker/main.cfg:/usr/lib/cgi-bin/main.cfg 9 - ./docker/oas.cfg:/usr/lib/cgi-bin/oas.cfg 10 - ./docker/default.conf:/etc/apache2/sites-available/000-default.conf 11 depends_on: 12 - pgbouncer 13 pg: 14 image: postgres:9.6.18-alpine 15 restart: always 16 environment: 17 POSTGRES_USER: zoo 18 POSTGRES_PASSWORD: zoo 19 POSTGRES_DB: zoo 20 volumes: 21 # Load the zoo kernel schema 22 - ./zoo-project/zoo-kernel/sql/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql 23 pgbouncer: 24 image: edoburu/pgbouncer:1.8.1 25 environment: 26 DATABASE_URL: "postgres://zoo:zoo@pg/zoo" 27 MAX_CLIENT_CONN: 1000 28 MAX_DB_CONNECTIONS: 100 29 DEFAULT_POOL_SIZE: 100 30 POOL_MODE: transaction 31 ports: 32 - "5432:5432" 33 depends_on: 34 - pg 35 -
Dockerfile
diff -ruN ../ZOO-Project.orig/Dockerfile ./Dockerfile
old new 1 # 2 # Base: Ubuntu 18.04 with updates and external packages 3 # 4 FROM ubuntu:bionic-20200713 AS base 5 ARG DEBIAN_FRONTEND=noninteractive 6 ARG BUILD_DEPS=" \ 7 dirmngr \ 8 gpg-agent \ 9 software-properties-common \ 10 " 11 ARG RUN_DEPS=" \ 12 libcurl3-gnutls \ 13 libfcgi \ 14 libmapserver-dev \ 15 libmozjs185-dev \ 16 libpq5 \ 17 libpython2.7 \ 18 libxslt1.1 \ 19 gdal-bin \ 20 python \ 21 r-base \ 22 " 23 RUN set -ex \ 24 && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ 25 \ 26 && add-apt-repository ppa:osgeolive/nightly \ 27 && add-apt-repository ppa:ubuntugis/ppa \ 28 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \ 29 && add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \ 30 \ 31 && apt-get install -y $RUN_DEPS \ 32 \ 33 && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ 34 && rm -rf /var/lib/apt/lists/* 35 36 # 37 # builder1: base image with zoo-kernel 38 # 39 FROM base AS builder1 40 ARG DEBIAN_FRONTEND=noninteractive 41 ARG BUILD_DEPS=" \ 42 bison \ 43 flex \ 44 make \ 45 autoconf \ 46 gcc \ 47 gettext-base \ 48 \ 49 libfcgi-dev \ 50 libgdal-dev \ 51 libjson-c-dev \ 52 libssh2-1-dev \ 53 libssl-dev \ 54 libxml2-dev \ 55 libxslt1-dev \ 56 python-dev \ 57 uuid-dev \ 58 r-base-dev \ 59 " 60 WORKDIR /zoo-project 61 COPY . . 62 63 RUN set -ex \ 64 && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ 65 \ 66 && make -C ./thirds/cgic206 libcgic.a \ 67 \ 68 && cd ./zoo-project/zoo-kernel \ 69 && autoconf \ 70 && ./configure --with-python --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-db-backend --prefix=/usr \ 71 && make \ 72 && make install \ 73 \ 74 # TODO: why not copied by 'make'? 75 && cp zoo_loader.cgi main.cfg /usr/lib/cgi-bin/ \ 76 && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \ 77 && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \ 78 && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \ 79 && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \ 80 && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \ 81 && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \ 82 \ 83 && cp oas.cfg /usr/lib/cgi-bin/ \ 84 \ 85 # TODO: main.cfg is not processed \ 86 && prefix=/usr envsubst < main.cfg > /usr/lib/cgi-bin/main.cfg \ 87 \ 88 && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ 89 && rm -rf /var/lib/apt/lists/* 90 91 # 92 # Optional zoo modules build. 93 # 94 FROM base AS builder2 95 ARG DEBIAN_FRONTEND=noninteractive 96 ARG BUILD_DEPS=" \ 97 bison \ 98 flex \ 99 make \ 100 autoconf \ 101 g++ \ 102 gcc \ 103 libc-dev \ 104 libfcgi-dev \ 105 libgdal-dev \ 106 libxml2-dev \ 107 libxslt1-dev \ 108 " 109 WORKDIR /zoo-project 110 COPY ./zoo-project/zoo-services/utils/status ./zoo-project/zoo-services/utils/status 111 112 # From zoo-kernel 113 COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ 114 COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5 115 COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so 116 COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/ 117 COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/ 118 119 # Additional files from bulder2 120 COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts 121 COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/sqlapi.h /zoo-project/zoo-project/zoo-kernel/sqlapi.h 122 COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service.h /zoo-project/zoo-project/zoo-kernel/service.h 123 COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service_internal.h /zoo-project/zoo-project/zoo-kernel/service_internal.h 124 COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/version.h /zoo-project/zoo-project/zoo-kernel/version.h 125 126 RUN set -ex \ 127 && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ 128 \ 129 && cd ./zoo-project/zoo-services/utils/status \ 130 && make \ 131 && make install \ 132 \ 133 && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ 134 && rm -rf /var/lib/apt/lists/* 135 136 # 137 # Runtime image with apache2. 138 # 139 FROM base AS runtime 140 ARG DEBIAN_FRONTEND=noninteractive 141 ARG RUN_DEPS=" \ 142 apache2 \ 143 curl \ 144 " 145 146 # From zoo-kernel 147 COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ 148 COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5 149 COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so 150 COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/ 151 COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/ 152 153 # From optional zoo modules 154 COPY --from=builder2 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ 155 COPY --from=builder2 /usr/com/zoo-project/ /usr/com/zoo-project/ 156 157 RUN set -ex \ 158 && apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \ 159 \ 160 && rm -rf /var/lib/apt/lists/* \ 161 && a2enmod cgi 162 163 EXPOSE 80 164 CMD /usr/sbin/apache2ctl -D FOREGROUND -
.dockerignore
diff -ruN ../ZOO-Project.orig/.dockerignore ./.dockerignore
old new 1 /Dockerfile 2 /docker-compose.yml 3 /docker/ -
zoo-project/zoo-kernel/sql/schema.sql
Binary files ../ZOO-Project.orig/.svn/wc.db and ./.svn/wc.db differ diff -ruN ../ZOO-Project.orig/zoo-project/zoo-kernel/sql/schema.sql ./zoo-project/zoo-kernel/sql/schema.sql
old new 36 36 -- Services table 37 37 -- Used to store information about services running asynchronously 38 38 create table services ( 39 osid TEXT unique,40 sid TEXT unique,39 osid TEXT, 40 sid TEXT, 41 41 uuid TEXT unique, 42 42 fstate varchar(25), 43 43 status TEXT,