Giter VIP home page Giter VIP logo

docker-mapproxy's Introduction

Mapproxy for Docker

MapProxy docker image from the YAGA Development-Team

Supported tags

  • 1.11.0, 1.11, 1, latest
  • 1.11.0-alpine, 1.11-alpine, 1-alpine, alpine
  • 1.10.4, 1.10
  • 1.10.4-alpine, 1.10-alpine
  • 1.10.3
  • 1.10.3-alpine
  • 1.10.2
  • 1.10.2-alpine
  • 1.10.1
  • 1.10.1-alpine
  • 1.10.0
  • 1.10.0-alpine
  • 1.9.1, 1.9
  • 1.9.1-alpine, 1.9-alpine
  • 1.9.0
  • 1.9.0-alpine
  • 1.8.2, 1.8
  • 1.8.2-alpine, 1.8-alpine
  • 1.8.1
  • 1.8.1-alpine
  • 1.8.0
  • 1.8.0-alpine
  • 1.7.1, 1.7
  • 1.7.1-alpine, 1.7-alpine
  • 1.7.0
  • 1.7.0-alpine

What is MapProxy

MapProxy is an open source proxy for geospatial data. It caches, accelerates and transforms data from existing map services and serves any desktop or web GIS client.

Run container

You can run the container with a command like this:

docker run -v /path/to/mapproxy:/mapproxy -p 8080:8080 yagajs/mapproxy

It is optional, but recommended to add a volume. Within the volume mapproxy get the configuration, or create one automatically. Cached tiles will be stored also into this volume.

The container normally runs in http-socket-mode. If you will not run the image behind a HTTP-Proxy, like Nginx, you can run it in direct http-mode by running:

docker run -v /path/to/mapproxy:/mapproxy -p 8080:8080 yagajs/mapproxy mapproxy http

Environment variables

  • MAPPROXY_PROCESSES default: 4
  • MAPPROXY_THREADS default: 2

Enhance the image

You can put a mapproxy.yaml into the /docker-entrypoint-initmapproxy.d folder on the image. On startup this will be used as MapProxy configuration. Attention, this will override an existing configuration in the volume!

Additional you can put shell-scripts, with .sh-suffix in that folder. They get executed on container startup.

You should use the mapproxy user within the container, especially not root!

Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

License

This project is published under ISC License.

docker-mapproxy's People

Contributors

atd-schubert avatar the-alchemist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-mapproxy's Issues

Use python 3.5 as base

There seems to be some incompatibilities with the actual python version. Let’s switch back to the python 3.5 image as base for this image

Build and execution failures for 1.11.0-alpine

Forked/cloned this repo and tried to build 1.11.0-alpine:

git checkout remotes/origin/version/1.11.0-alpine

docker build -t map5/mapproxy .
Sending build context to Docker daemon  96.77kB
Step 1/14 : FROM python:3-alpine
 ---> 1a8edcb29ce4
Step 2/14 : MAINTAINER Arne Schubert<[email protected]>
 ---> Using cache
 ---> 2bba68471117
Step 3/14 : ARG MAPPROXY_VERSION=1.11.0
 ---> Using cache
 ---> b35e1deec43f
Step 4/14 : ENV MAPPROXY_VERSION $MAPPROXY_VERSION
 ---> Using cache
 ---> d707738277ce
Step 5/14 : ENV MAPPROXY_PROCESSES 4
 ---> Using cache
 ---> 9e79c91e6fbe
Step 6/14 : ENV MAPPROXY_THREADS 2
 ---> Using cache
 ---> 03efc934a030
Step 7/14 : RUN set -x   && apk add --no-cache --virtual .build-deps     build-base linux-headers curl     zlib-dev jpeg-dev   && apk add --no-cache     --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing     gdal-dev proj4-dev geos-dev   && adduser -h /mapproxy -s /bin/sh -D mapproxy   && pip install Shapely Pillow requests geojson uwsgi pyproj boto3 MapProxy==$MAPPROXY_VERSION   && apk del build-base   && rm -Rf /root/* /root/.cache   && mkdir -p /docker-entrypoint-initmapproxy.d
 ---> Running in 657033671cf0
+ apk add --no-cache --virtual .build-deps build-base linux-headers curl zlib-dev jpeg-dev
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/29) Installing binutils (2.30-r5)
(2/29) Installing libmagic (5.32-r0)
(3/29) Installing file (5.32-r0)
(4/29) Installing gmp (6.1.2-r1)
(5/29) Installing isl (0.18-r0)
(6/29) Installing libgomp (6.4.0-r9)
(7/29) Installing libatomic (6.4.0-r9)
(8/29) Installing pkgconf (1.5.3-r0)
(9/29) Installing libgcc (6.4.0-r9)
(10/29) Installing mpfr3 (3.1.5-r1)
(11/29) Installing mpc1 (1.0.3-r1)
(12/29) Installing libstdc++ (6.4.0-r9)
(13/29) Installing gcc (6.4.0-r9)
(14/29) Installing musl-dev (1.1.19-r10)
(15/29) Installing libc-dev (0.7.1-r0)
(16/29) Installing g++ (6.4.0-r9)
(17/29) Installing make (4.2.1-r2)
(18/29) Installing fortify-headers (0.9-r0)
(19/29) Installing build-base (0.5-r1)
(20/29) Installing linux-headers (4.4.6-r2)
(21/29) Installing nghttp2-libs (1.32.0-r0)
(22/29) Installing libssh2 (1.8.0-r3)
(23/29) Installing libcurl (7.61.1-r1)
(24/29) Installing curl (7.61.1-r1)
(25/29) Installing zlib-dev (1.2.11-r1)
(26/29) Installing libjpeg-turbo (1.5.3-r3)
(27/29) Installing libjpeg-turbo-dev (1.5.3-r3)
(28/29) Installing jpeg-dev (8-r6)
(29/29) Installing .build-deps (0)
Executing busybox-1.28.4-r2.trigger
OK: 186 MiB in 63 packages
+ apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing gdal-dev proj4-dev geos-dev
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  so:libcrypto.so.1.1 (missing):
    required by:
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
                 gdal-2.3.2-r1[so:libcrypto.so.1.1]
The command '/bin/sh -c set -x   && apk add --no-cache --virtual .build-deps     build-base linux-headers curl     zlib-dev jpeg-dev   && apk add --no-cache     --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing     gdal-dev proj4-dev geos-dev   && adduser -h /mapproxy -s /bin/sh -D mapproxy   && pip install Shapely Pillow requests geojson uwsgi pyproj boto3 MapProxy==$MAPPROXY_VERSION   && apk del build-base   && rm -Rf /root/* /root/.cache   && mkdir -p /docker-entrypoint-initmapproxy.d' returned a non-zero code: 3

Now this is a known issue also found e.g. here:
postgis/docker-postgis#96, saw several fixes but adding http://dl-cdn.alpinelinux.org/alpine/edge/main worked for me:

  && apk add --no-cache \
    --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
    --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
    gdal-dev proj4-dev geos-dev \

After build ok, next problem is caused by Python 3.7 incompatibility with MapProxy:

 docker run -p 8080:8080 map5/mapproxy mapproxy http
Running additional provisioning

Traceback (most recent call last):
  File "/usr/local/bin/mapproxy-util", line 7, in <module>
    from mapproxy.script.util import main
  File "/usr/local/lib/python3.7/site-packages/mapproxy/script/util.py", line 29, in <module>
    from mapproxy.script.defrag import defrag_command
  File "/usr/local/lib/python3.7/site-packages/mapproxy/script/defrag.py", line 26, in <module>
    from mapproxy.cache.tile import Tile
  File "/usr/local/lib/python3.7/site-packages/mapproxy/cache/tile.py", line 45
    from mapproxy.util import async
                                  ^
SyntaxError: invalid syntax

This can be solved by pinning the Python (and Alpine) version, resulting also in a more reproducable build, i.s.o.:

FROM python:3-alpine

using

FROM python:3.6.8-alpine3.8

Now build and run are ok. Can issue PR if needed.

Provide more flexibility for uwsgi startup options

Problem

Currently only a few uwsgi startup-options can be specified by the Docker Container user: mainly MAPPROXY_PROCESSES and MAPPROXY_THREADS via env vars. Also not in all contexts is stats(--stats) publishing required.

I came to this issue when trying to optimize uwsgi for optimal MapProxy performance. For example this article suggests to disable logging (via --disable-logging) and as MapProxy is stateless set Max Worker Lifetime (e.g. --max-worker-lifetime 30). This could all-in-all amount for over 30% performance improvement.

Proposed Solution

So when using env-vars ( uwsgi.ini is another option, see below) my suggestion is to:

  • leave out --stats option
  • add an UWSGI_EXTRA_OPTIONS optional env-var, that is appended to the existing startup options

A user could specify e.g. in a docker-compose file: UWSGI_EXTRA_OPTIONS="--disable-logging --max-worker-lifetime 30". This would be forward compatible (except for the stats option).

Another option would be to allow a UWSGI_OPTIONS where a user specifies a complete startup-options string.

Alternative Solution

The most flexible would be to start uwsgi with an uwsgi.ini file with a default that can be overridden e.g. by Docker-Volume mounting or extending the Docker Image. But at the same time this may create inflexibilities in environments where Docker Volume mounting is less preferred over env-vars like Kubernetes.

alpine image slimmed down to 25 MB

With the help of this, I was able to fix the lib c bug of Python's util, which will get fixed in v3.8 and causes trouble with Shapely. Sure, there might be a better patch than the Alpine one, but this one is working fine in this case.

My edit of this dockerfile isn't elegant, but it drops all the building dependencies (f.e. the huge libc & gcc stuff) and results in a small image of less than 30 MB:

FROM python:3.5-alpine
MAINTAINER Arne Schubert<[email protected]>

ARG MAPPROXY_VERSION=1.11.0

ENV MAPPROXY_VERSION $MAPPROXY_VERSION
ENV MAPPROXY_PROCESSES 4
ENV MAPPROXY_THREADS 2

RUN set -x \
  && printf "%s\n%s\n" '#!/bin/sh' 'if [ "$1" = "-p" ]; then echo "    libc.musl-x86_64.so.1 (libc6,x86-64) => /lib/libc.musl-x86_64.so.1"; exit 0; fi' > /tmp/ldconfig \
  && tail -n+2 /sbin/ldconfig >> /tmp/ldconfig \
  && mv /tmp/ldconfig /sbin/ldconfig \
  && chmod +x /sbin/ldconfig \ 
  && apk add --update --no-cache --virtual .build-deps-stable build-base linux-headers \
  && apk add --update --no-cache --virtual .build-deps-edge \
     --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
     --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
     gdal-dev proj4-dev geos-dev zlib-dev jpeg-dev \
  && adduser -h /mapproxy -s /bin/sh -D mapproxy \
  && pip install --upgrade pip \
  && pip install Shapely Pillow requests geojson uwsgi pyproj==1.9.6 boto3 MapProxy==$MAPPROXY_VERSION \
  && apk del .build-deps-stable .build-deps-edge \
  && runDeps="geos giflib libcrypto1.1 libcurl libgcc libjpeg-turbo libpng libpq libstdc++ musl sqlite-libs tiff zlib" \
  && apk add --no-cache --virtual .run-deps $runDeps \
     --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
     --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
  && rm -Rf /root/* /root/.cache \
  && mkdir -p /docker-entrypoint-initmapproxy.d

COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["mapproxy"]

USER mapproxy
VOLUME ["/mapproxy"]
EXPOSE 8080
# Stats
EXPOSE 9191

Maybe would could just set the automatically installed packages on "hold", like the DPKG-way, to protect them from automatic removal?

Securing webpage

How can I secure the Demo Page with SSL/TLS certificate? Are there any environment variables I can use to assign and utilize certificates issued from our CA?

Image depending on alpine

After some tests I created a mapproxy based on python:alpine, but I had never make a commit in git.

Let's add the alpine and a rpi (respberry-pi) versions of each version of the image...

apk del complains about depencies

bug report

apk complains that .build-deps blocks removal of build-base

+ apk del build-base
WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
World updated, but the following packages are not removed due to:
  build-base: .build-deps

OK: 260 MiB in 77 packages

pyproj fails, it needs proj v6.0.0

bug report

Currently, building fails, since pyproj >= v2, needs proj >= v6

ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmprpmfab0y:
  ERROR: ERROR: Minimum supported proj version is 6.0.0, installed version is 5.2.0.
  ----------------------------------------
ERROR: Command "/usr/local/bin/python /usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmprpmfab0y" failed with error code 1 in /tmp/pip-install-vlxcmfol/pyproj

workaround

Freeze pyproj until proj gets updated: pip install [...] pyproj==1.9.6

upgrade to 1.12.0

Mapproxy has released 1.12.0. Could you please upgrade to the latest version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.