-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from PDOK/lighttpd_fastcgi
Lighttpd fastcgi
- Loading branch information
Showing
14 changed files
with
204 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
FROM debian:buster-slim | ||
FROM pdok/lighttpd:1.4.67 | ||
LABEL maintainer="PDOK dev <[email protected]>" | ||
|
||
USER root | ||
|
||
# apt-get python3-pip on debian:buster will install python3.7 | ||
RUN apt-get -y update \ | ||
&& apt-get install -y \ | ||
|
@@ -16,15 +18,10 @@ RUN apt-get -y update \ | |
libjpeg-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install Numpy PyYAML boto3 Pillow requests Shapely eventlet gunicorn uwsgi prometheus_client lxml azure-storage-blob | ||
RUN pip3 install flup Numpy PyYAML boto3 Pillow requests Shapely eventlet gunicorn uwsgi prometheus_client lxml azure-storage-blob pyproj==2.2.0 | ||
# use the PDOK fork of MapProxy. This is MapProxy version 1.13.1 but patched with https://github.com/mapproxy/mapproxy/pull/608 | ||
RUN pip3 install git+https://github.com/PDOK/[email protected] | ||
|
||
# when overwriting the CMD with a uwsgi command it's good practice to not run it as root | ||
RUN groupadd -g 1337 mapproxy \ | ||
&& useradd --shell /bin/bash --gid 1337 -m mapproxy \ | ||
&& usermod -a -G sudo mapproxy | ||
|
||
RUN apt-get clean | ||
|
||
# default dir needed for the cache_data | ||
|
@@ -33,6 +30,21 @@ RUN chmod a+rwx /srv/mapproxy/cache_data | |
|
||
WORKDIR /srv/mapproxy | ||
|
||
ADD config/lighttpd.conf /srv/mapproxy/config/lighttpd.conf | ||
ADD config/include.conf /srv/mapproxy/config/include.conf | ||
ADD config/log.ini /srv/mapproxy/config/log.ini | ||
|
||
ADD config/start.py /srv/mapproxy/start.py | ||
RUN chmod +x start.py | ||
|
||
USER www | ||
|
||
ENV DEBUG 0 | ||
ENV MIN_PROCS 4 | ||
ENV MAX_PROCS 8 | ||
ENV MAX_LOAD_PER_PROC 1 | ||
ENV IDLE_TIMEOUT 20 | ||
|
||
EXPOSE 80 | ||
|
||
CMD gunicorn -k gthread --user=1337 --group=1337 --chdir /srv/mapproxy/config --threads=16 --workers=1 -b :80 config:application --no-sendfile --access-logfile '-' --error-logfile '-' | ||
CMD ["lighttpd", "-D", "-f", "/srv/mapproxy/config/lighttpd.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Overwrite with extra lighttpd config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
server.modules += ( "mod_setenv" ) | ||
server.modules += ( "mod_fastcgi" ) | ||
server.modules += ( "mod_rewrite" ) | ||
server.modules += ( "mod_magnet" ) | ||
|
||
server.document-root = "/var/www/" | ||
server.port = 80 | ||
server.tag = "" | ||
|
||
server.username = "www" | ||
server.groupname = "www" | ||
|
||
server.errorlog = "/dev/stderr" | ||
|
||
mimetype.assign = ( | ||
".xml" => "application/xml", | ||
".png" => "image/png", | ||
".jpeg" => "image/jpeg", | ||
".jpg" => "image/jpeg" | ||
) | ||
|
||
include "include.conf" | ||
|
||
fastcgi.debug = env.DEBUG | ||
|
||
fastcgi.server = ( | ||
"/mapproxy" => ( | ||
"mapproxy" => ( | ||
"socket" => "/tmp/mapproxy-fastcgi.socket", | ||
"bin-path" => "/srv/mapproxy/start.py", | ||
"check-local" => "false", | ||
"min-procs" => env.MIN_PROCS, | ||
"max-procs" => env.MAX_PROCS, | ||
"max-load-per-proc" => env.MAX_LOAD_PER_PROC, | ||
"idle-timeout" => env.IDLE_TIMEOUT | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python3 | ||
|
||
if __name__ == '__main__': | ||
from os import path,environ | ||
from mapproxy.wsgiapp import make_wsgi_app | ||
from flup.server.fcgi import WSGIServer | ||
from logging.config import fileConfig | ||
import logging | ||
|
||
logging.config.fileConfig(r'/srv/mapproxy/config/log.ini', {'here': path.dirname(__file__)}) | ||
|
||
if environ.get('DEBUG') == '1': | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
logging.getLogger('mapproxy.source.request').setLevel(logging.DEBUG) | ||
|
||
application = make_wsgi_app(r'/srv/mapproxy/config/mapproxy.yaml') | ||
WSGIServer(application).run() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server.modules += ( "mod_auth" ) | ||
server.modules += ( "mod_status" ) | ||
|
||
status.status-url = "/server-status" | ||
auth.backend = "plain" | ||
auth.backend.plain.userfile = "/srv/mapproxy/config/lighttpd.auth" | ||
|
||
$HTTP["url"] =~ "^/server-status" { | ||
auth.require = ( "" => | ||
( | ||
"method" => "basic", | ||
"realm" => "Protected Monitoring Area", | ||
"require" => "user=admin" | ||
) | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.