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]
     2encoding = utf-8
     3version = 1.0.0
     4serverAddress = http://www.zoo-project.org/zoo/
     5language = en-US
     6lang = fr-FR,en-CA,en-US
     7tmpPath=/tmp/
     8tmpUrl = ../tmpPathRelativeToServerAdress/
     9dataPath = /usr/com/zoo-project
     10cacheDir = /tmp/
     11
     12[identification]
     13title = The ZOO-Project OGC WPS Development Server
     14abstract = Development version of ZOO-Project OGC WPS. See http://www.zoo-project.org
     15fees = None
     16accessConstraints = none
     17keywords = WPS,GIS,buffer
     18
     19[provider]
     20providerName=ZOO-Project
     21providerSite=http://www.zoo-project.org
     22individualName=Gerald FENOY
     23positionName=Developer
     24role=Dev
     25addressDeliveryPoint=1280, avenue des Platanes
     26addressCity=Lattes
     27addressAdministrativeArea=False
     28addressPostalCode=34970
     29addressCountry=fr
     30addressElectronicMailAddress=gerald.fenoy@geolabs.fr
     31phoneVoice=False
     32phoneFacsimile=False
     33
     34[database]
     35dbname=zoo
     36port=5432
     37user=zoo
     38password=zoo
     39host=pgbouncer
     40type=PG
     41schema=public
     42
  • docker/oas.cfg

    diff -ruN ../ZOO-Project.orig/docker/oas.cfg ./docker/oas.cfg
    old new  
     1[openapi]
     2rootUrl=http://localhost/cgi-bin/zoo_loader.cgi
     3links=/,/api,/conformance,/processes
     4paths=/root,/api,/conformance,/processes,/processes/{id},/processes/{id}/jobs,/processes/{id}/jobs/{jobID},/processes/{id}/jobs/{jobID}/result
     5parameters=id,jobID,resultID
     6header_parameters=oas-header1,oas-header2
     7version=3.0.1
     8
     9[oas-header1]
     10in=header
     11name=Prefer
     12type=string
     13required=false
     14enum=respond-async
     15
     16[oas-header2]
     17in=header
     18name=Prefer
     19type=string
     20required=false
     21enum=return=representation,return=minimal
     22
     23[/]
     24rel=self
     25type=application/json
     26title=this document
     27
     28[root]
     29method=get
     30title=landing page of this API
     31abstract=The landing page provides links to the API definition, the Conformance statements and the metadata about the processes offered by this service.
     32tags=Home
     33tags_description=
     34schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/root.yaml
     35
     36[/api]
     37rel=service
     38type=application/openapi+json;version=3.0
     39title=the API definition
     40
     41[api]
     42method=get
     43title=This document
     44abstract=This document
     45tags=API
     46tags_description=
     47schema=
     48
     49[/conformance]
     50rel=conformance
     51type=application/json
     52title=WPS 2.0 REST/JSON Binding Extension conformance classes implemented by this server
     53
     54[conformance]
     55method=get
     56title=information about standards that this API conforms to
     57abstract==list all requirements classes specified in a standard (e.g., WPS REST/JSON Binding Core) that the server conforms to
     58tags=Conformance
     59tags_description=
     60schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/req-classes.yaml
     61
     62[/processes]
     63rel=processes
     64type=application/json
     65title=The processes offered by this server
     66
     67[processes]
     68method=get
     69title=retrieve available processes
     70abstract=Information about the available processes
     71tags=GetCapabilities
     72tags_description=
     73schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/processCollection.yaml
     74
     75[processes/{id}]
     76method=get
     77title=retrieve a process description
     78abstract=A process description.
     79tags=ProcessDescription
     80tags_description=
     81schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/process.yaml
     82parameters=/components/parameters/id
     83
     84
     85[/processes/{id}/jobs]
     86rel=canonical
     87type=application/json
     88title=Process Description
     89
     90[processes/{id}/jobs]
     91length=2
     92method=get
     93title=retrieve a list of jobs run
     94abstract=A list of jobs run.
     95tags=JobList
     96tags_description=
     97schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/jobCollection.yaml
     98parameters=/components/parameters/id
     99method_1=post
     100title_1=execute a job
     101abstract_1=An execute endpoint.
     102tags_1=Execute Endpoint
     103tags_description_1=
     104schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/result.yaml
     105parameters_1=/components/parameters/id,/components/parameters/oas-header1
     106
     107[requestBody]
     108abstract=Mandatory execute request in JSON format
     109type=application/json
     110schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/execute.yaml
     111
     112[/processes/{id}/jobs/{jobID}]
     113rel=canonical
     114type=application/json
     115title=Status
     116
     117[processes/{id}/jobs/{jobID}]
     118method=get
     119title=The status of a job.
     120abstract=The status of a job.
     121tags=GetStatus
     122tags_description=
     123schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/statusInfo.yaml
     124parameters=/components/parameters/id,/components/parameters/jobID
     125
     126[/processes/{id}/jobs/{jobID}/result]
     127rel=canonical
     128type=application/json
     129title=Get Result
     130
     131[processes/{id}/jobs/{jobID}/result]
     132method=get
     133title=The result of a job execution.
     134abstract=The result of a job execution.
     135tags=GetResult
     136tags_description=
     137schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/result.yaml
     138parameters=/components/parameters/id,/components/parameters/jobID
     139ep=,/components/parameters/oas-header2
     140
     141[/processes/{id}/jobs/{jobID}/result/{resultID}]
     142rel=canonical
     143type=application/json
     144title=Get Result
     145
     146[processes/{id}/jobs/{jobID}/result/{resultID}]
     147method=get
     148title=The result of a job execution.
     149abstract=The result of a job execution.
     150tags=GetResult
     151tags_description=
     152schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/valueType.yaml
     153parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID,/components/parameters/oas-header2
     154
     155
     156[{id}]
     157type=string
     158title=The id of a process
     159abstract=The id of a process
     160in=path
     161required=true
     162example=buffer
     163
     164[{jobID}]
     165type=string
     166title=The id of a job
     167abstract=The id of a job
     168in=path
     169required=true
     170
     171[{resultID}]
     172type=string
     173title=The id of an output
     174abstract=The id of an output
     175in=path
     176required=true
     177
     178[{f}]
     179default=json
     180enum=json
     181title=The optional f parameter
     182abstract=The optional f parameter indicates the output format which the server shall provide as part of the response document.  The default format is JSON.
     183in=query
     184required=false
     185
     186[conformTo]
     187rootUrl=http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/
     188link=core
     189link_1=oas30
     190link_2=json
     191length=3
     192
     193[exception]
     194abstract=Exception
     195type=application/json
     196schema=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  
     1import argparse
     2import requests
     3import time
     4
     5from threading import Thread
     6from xml.etree import ElementTree
     7
     8parser = argparse.ArgumentParser()
     9parser.add_argument("threads", help="number of threads", type=int)
     10args = parser.parse_args()
     11
     12
     13class 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
     86threads = list()
     87for i in range(0, args.threads):
     88    t = LongProcess(i)
     89    t.start()
     90    threads.append(t)
     91
     92for t in threads:
     93    t.join()
     94
  • docker-compose.yml

    diff -ruN ../ZOO-Project.orig/docker-compose.yml ./docker-compose.yml
    old new  
     1version: '3'
     2services:
     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#
     4FROM ubuntu:bionic-20200713 AS base
     5ARG DEBIAN_FRONTEND=noninteractive
     6ARG BUILD_DEPS=" \
     7    dirmngr \
     8    gpg-agent \
     9    software-properties-common \
     10"
     11ARG 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"
     23RUN 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#
     39FROM base AS builder1
     40ARG DEBIAN_FRONTEND=noninteractive
     41ARG 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"
     60WORKDIR /zoo-project
     61COPY . .
     62
     63RUN 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#
     94FROM base AS builder2
     95ARG DEBIAN_FRONTEND=noninteractive
     96ARG 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"
     109WORKDIR /zoo-project
     110COPY ./zoo-project/zoo-services/utils/status ./zoo-project/zoo-services/utils/status
     111
     112# From zoo-kernel
     113COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
     114COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5
     115COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
     116COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
     117COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
     118
     119# Additional files from bulder2
     120COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts
     121COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/sqlapi.h /zoo-project/zoo-project/zoo-kernel/sqlapi.h
     122COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service.h /zoo-project/zoo-project/zoo-kernel/service.h
     123COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service_internal.h /zoo-project/zoo-project/zoo-kernel/service_internal.h
     124COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/version.h /zoo-project/zoo-project/zoo-kernel/version.h
     125
     126RUN 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#
     139FROM base AS runtime
     140ARG DEBIAN_FRONTEND=noninteractive
     141ARG RUN_DEPS=" \
     142    apache2 \
     143    curl \
     144"
     145
     146# From zoo-kernel
     147COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
     148COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5
     149COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
     150COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
     151COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
     152
     153# From optional zoo modules
     154COPY --from=builder2 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
     155COPY --from=builder2 /usr/com/zoo-project/ /usr/com/zoo-project/
     156
     157RUN 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
     163EXPOSE 80
     164CMD /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  
    3636-- Services table
    3737-- Used to store information about services running asynchronously
    3838create table services (
    39        osid TEXT unique,
    40        sid TEXT unique,
     39       osid TEXT,
     40       sid TEXT,
    4141       uuid TEXT unique,
    4242       fstate varchar(25),
    4343       status TEXT,

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png