wiki:DevWikiDockerTesting

Version 22 (modified by robe, 21 months ago) ( diff )

--

Table of Contents

    The PostGIS project uses docker for a number of regression tests and production use. We have two different docker setups.

    On OSGeo infrastructure we have docker.osgeo.org which docker images are pushed to via postgis-docker.osgeo.org. These are currently only used by dronie.osgeo.org and woodie.osgeo.org drone agents. They ware useful for general development as well, because they include multiple versions of PostgreSQL and also include pre-installed postgis versions for doing upgrade tests.

    Docker OSGeo

    The docker osgeo infrastructure you can log in via your osgeo user id. Only PostGIS development team members have push rights to this repo. More details of the images, dockerfiles in use by it can be found at PostGIS-docker repo.

    Here is an example of how you can pull an image, retag and push to postgis-docker.osgeo.org

    FOR DEVELOPMENT

    #To develop and test using this image, do the following
    cd ~/
    mkdir projects
    
    #this container has no built in entry point to keep it running, 
    # create a fake one as discussed here - https://levelup.gitconnected.com/keep-docker-container-running-for-debugging-fc2dfa39472c
    
    #this might take a minute or so after download to start up
    docker run -d \
      --name postgis-dev \
      --mount type=bind,source="$(pwd)/projects",target=/projects \
      docker.osgeo.org/postgis/build-test:trisquel3  tail -f /dev/null
    
    
    cd projects
    git clone https://git.osgeo.org/gitea/postgis/postgis.git
    
    
    
    #once started you can attach to it
    docker exec -it postgis-dev /bin/bash
    
    # in the postgis-dev container, you should be able to do
    # below copied from https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/ci/dronie/postgis_regress.sh
    cd /projects/postgis
    export PGVER=15
    service postgresql start ${PGVER}
    export PGPORT=`grep ^port /etc/postgresql/$PGVER/main/postgresql.conf | awk '{print $3}'`
    export PATH=/usr/lib/postgresql/$PGVER/bin:$PATH
    
    sh autogen.sh
    ./configure
    make
    make check
    
    make install
    #any changes you make to your local folder projects/postgis, will show in the container /projects/postgis
    
    #in the container
    
    # To stop it do
    docker stop postgis-dev
    
    # if you need to remove the container to get a new version do
    
    docker rm postgis-dev
    
    

    Docker Hub PostGIS

    Docker Hub is used for Github-actions testing and there is also a postgis for production use. The main link to all is https://hub.docker.com/u/postgis

    The postgis-build-env images don't have PostGIS installed on them at all, but have all the key dependencies needed to compile PostGIS. The version latest in development versions proj, gdal, geos, postgresql, and sfcgal. It is used to catch possible issues with other upstream projects.

    You can set it up much the same as the docker.osgeo.org development suite detailed earlier.

    FOR DEVELOPMENT

    #To develop and test using this image, do the following
    cd ~/
    mkdir projects
    
    #this container has no built in entry point to keep it running, 
    # create a fake one as discussed here - https://levelup.gitconnected.com/keep-docker-container-running-for-debugging-fc2dfa39472c
    
    docker pull postgis/postgis-build-env:latest
    #this might take a minute or so after download to start up
    docker run -d \
      --name postgis-build-env \
      --mount type=bind,source="$(pwd)/projects",target=/projects \
      postgis/postgis-build-env:latest  tail -f /dev/null
    
    cd projects
    git clone https://git.osgeo.org/gitea/postgis/postgis.git
    
    
    
    #once started you can attach to it
    docker exec -it postgis-build-env /bin/bash
    
    # in the postgis-buildenv container, you should be able to do
    # below copied from https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/ci/github/run_coverage.sh
    cd /projects/postgis
    # Flags for coverage build
    CFLAGS_COV="-g -O0 --coverage"
    LDFLAGS_COV="--coverage"
    
    #TODO fix this, container starts up using postgres, and so these fail if mounting an external source folder
    /usr/local/pgsql/bin/pg_ctl -c -l /tmp/logfile -o '-F' start
    ./autogen.sh
    ./configure CFLAGS="${CFLAGS_COV}" LDFLAGS="${LDFLAGS_COV}" --enable-debug
    make -j 4
    make check
    make install
    
    #any changes you make to your local folder projects/postgis, will show in the container /projects/postgis
    
    #in the container
    
    # To stop it do
    docker stop postgis-dev
    
    # if you need to remove the container to get a new version do
    
    docker rm postgis-dev
    
    

    Note: See TracWiki for help on using the wiki.