Skip to content

Commit

Permalink
#1: Initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
atd-schubert committed Mar 5, 2017
1 parent f8372ff commit 1feb5a4
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
@@ -0,0 +1,2 @@
mapproxy/
.idea/
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)

mapproxy/
.idea/
37 changes: 37 additions & 0 deletions Dockerfile
@@ -0,0 +1,37 @@
FROM python:2.7
MAINTAINER Arne Schubert<atd.schubert@gmail.com>

ENV MAPPROXY_VERSION 1.9.1
ENV MAPPROXY_PROCESSES 4
ENV MAPPROXY_THREADS 2

RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
python-imaging \
python-yaml \
libproj0 \
libgeos-dev \
python-lxml \
libgdal-dev \
build-essential \
python-dev \
libjpeg-dev \
zlib1g-dev \
libfreetype6-dev \
python-virtualenv \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -ms /bin/bash mapproxy \
&& mkdir -p /mapproxy \
&& chown mapproxy /mapproxy \
&& pip install Shapely Pillow uwsgi MapProxy==$MAPPROXY_VERSION \
&& mkdir -p /docker-entrypoint-initmapproxy.d

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

USER mapproxy
VOLUME ["/mapproxy"]
EXPOSE 8080
EXPOSE 9191 # Stats
73 changes: 71 additions & 2 deletions README.md
@@ -1,2 +1,71 @@
# docker-mapproxy
Docker files for mapproxy container
# Mapproxy for Docker

MapProxy docker image from the [YAGA Development-Team](https://yagajs.org)

## Supported tags

* `1.9.1`, `latest`
* `1.9.0`
* `1.8.2`
* `1.8.1`
* `1.8.0`
* `1.7.1`
* `1.7.0`
* `1.6.0`
* `1.5.0`
* `1.4.0`
* `1.3.0`
* `1.2.1`
* `1.2.0`
* `1.1.2`
* `1.1.1`
* `1.1.0`
* `1.0.1`
* `1.0.0`

## What is MapProxy

[MapProxy](https://mapproxy.org/) 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:

```bash
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](http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html). If you will not
run the image behind a HTTP-Proxy, like [Nginx](http://nginx.org/), you can run it in direct http-mode by running:

```bash
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](https://github.com/yagajs/docker-mapproxy/issues), 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.
32 changes: 32 additions & 0 deletions docker-entrypoint.sh
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

if [ "$1" = 'mapproxy' ]; then
echo "Running additional provisioning"
for f in /docker-entrypoint-initmapproxy.d/*; do
case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
mapproxy.yml) cp /docker-entrypoint-initmapproxy.d/mapproxy.yml /mapproxy/mapproxy.yaml ;;
mapproxy.yaml) cp /docker-entrypoint-initmapproxy.d/mapproxy.yaml /mapproxy/mapproxy.yaml ;;
esac
echo
done

if [ ! -f /mapproxy/mapproxy.yaml ] ;then
mapproxy-util create -t base-config /mapproxy/
fi
if [ ! -f /mapproxy/app.py ] ;then
mapproxy-util create -t wsgi-app -f /mapproxy/mapproxy.yaml /mapproxy/app.py
fi
echo "Start mapproxy"

if [ "$2" = 'http' ]; then
exec uwsgi --http 0.0.0.0:8080 --wsgi-file /mapproxy/app.py --master --enable-threads --processes $MAPPROXY_PROCESSES --threads $MAPPROXY_THREADS --stats 0.0.0.0:9191
exit
fi

exec uwsgi --http-socket 0.0.0.0:8080 --wsgi-file /mapproxy/app.py --master --enable-threads --processes $MAPPROXY_PROCESSES --threads $MAPPROXY_THREADS --stats 0.0.0.0:9191
exit
fi

exec "$@"

0 comments on commit 1feb5a4

Please sign in to comment.