diff --git a/Dockerfile b/Dockerfile
index 9a311fe..fa2201c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,16 +1,20 @@
FROM fedora
RUN dnf -y update && \
+ dnf -y install procps-ng && \
dnf -y install httpd && \
dnf -y install python3-mod_wsgi && \
dnf clean all
-COPY container-files/ /
+COPY container-files/httpd-layer/ /
-COPY django-test /usr/local/share/django-test
-RUN /usr/local/bin/install-django-test.sh /usr/local/share/django-test
+COPY django-test /srv/src/django-test
+COPY container-files/django-test-layer/ /
+RUN /srv/bin/setup-django-test.sh /srv/django-test /srv/src/django-test
-EXPOSE 80
+COPY container-files/docker-entrypoint.sh /
-ENTRYPOINT ["/usr/local/sbin/start-httpd.sh"]
+EXPOSE 80/tcp
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["--"]
diff --git a/Makefile b/Makefile
index 3eea17a..3800a6f 100644
--- a/Makefile
+++ b/Makefile
@@ -14,5 +14,4 @@ image:
$(DOCKER) build -t $(IMAGE_NAME) .
test-run:
- $(DOCKER) run -ti -p 80:80 --name $(APPLICATION_NAME) $(IMAGE_NAME)
- $(DOCKER) rm $(APPLICATION_NAME)
+ $(DOCKER) run -ti --rm -p 80:80 $(IMAGE_NAME)
diff --git a/README b/README
deleted file mode 100644
index 0e4123f..0000000
--- a/README
+++ /dev/null
@@ -1,3 +0,0 @@
-git clone https://heinzelwelt.de/vcs/python/django-test
-make image
-make test-run
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e02fc63
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,48 @@
+ABOUT
+=====
+Docker container for django-test.
+
+
+DESCRIPTION
+===========
+The docker image is derivated from
+Fedora image (https://hub.docker.com/_/fedora).
+
+It will contain and run
+
+- apache httpd
+- python3 mod_wsgi
+- django-test django application
+
+
+BUILD
+=====
+- ``git clone https://heinzelwelt.de/vcs/python/django-test``
+- ``docker build -t IMAGE_NAME .``
+
+
+USAGE
+=====
+- ``docker run -d -p 80:80 -e LOG_LEVEL=error IMAGE_NAME``
+
+The httpd process is listening on port 80/tcp.
+
+The httpd error log will be written to stderr, so it can be
+obtained with ``docker logs``
+
+
+CONFIGURATION
+=============
+The following **environment variables** are supported:
+
+- LOG_LEVEL
+ -- to set the httpd LogLevel directive
+- SERVER_ADMIN
+ -- to set the httpd ServerAdmin directive
+
+
+LICENCE
+=======
+Permission to use, copy, modify, and/or distribute this software
+for any purpose with or without fee is hereby granted.
+
diff --git a/container-files/django-test-layer/etc/httpd/conf.d/django-test.conf b/container-files/django-test-layer/etc/httpd/conf.d/django-test.conf
new file mode 100644
index 0000000..22961db
--- /dev/null
+++ b/container-files/django-test-layer/etc/httpd/conf.d/django-test.conf
@@ -0,0 +1,18 @@
+WSGIDaemonProcess django-test display-name=django-test python-home=/srv/django-test/python python-path=/srv/django-test/django
+
+Alias /static/ "/srv/django-test/django/var/www/static/"
+
+ AllowOverride None
+ Require all granted
+
+
+WSGIScriptAlias / "/srv/django-test/django/main/wsgi.py"
+
+ WSGIProcessGroup django-test
+ WSGIPassAuthorization On
+ AllowOverride None
+ Options FollowSymLinks
+
+ Require all granted
+
+
diff --git a/container-files/usr/local/bin/install-django-test.sh b/container-files/django-test-layer/srv/bin/setup-django-test.sh
similarity index 57%
rename from container-files/usr/local/bin/install-django-test.sh
rename to container-files/django-test-layer/srv/bin/setup-django-test.sh
index b214d2b..55a5910 100755
--- a/container-files/usr/local/bin/install-django-test.sh
+++ b/container-files/django-test-layer/srv/bin/setup-django-test.sh
@@ -2,17 +2,29 @@
### config ###
PROJECT_NAME="django-test"
-PROJECT_REPO="git+https://heinzelwelt.de/vcs/python/django-test"
+SETUP_COMMAND="django-test-admin"
-INSTALL_DIR="/var/www/wsgi/${PROJECT_NAME}"
+INSTALL_DIR="/srv/${PROJECT_NAME}"
VENV_DIR="python"
VENV_PATH="${INSTALL_DIR}/${VENV_DIR}"
DJANGO_DIR="django"
DJANGO_PATH="${INSTALL_DIR}/${DJANGO_DIR}"
+DJANGO_MAIN_MODULE="main"
+
+PROJECT_REPO="git+https://heinzelwelt.de/vcs/python/django-test"
### argv ###
-if test "$1" != "" -a -d "$1" ; then
- PROJECT_REPO="$1"
+if test "$1" != "" ; then
+ if test "$1" != "-" ; then
+ INSTALL_DIR="$1"
+ fi
+ shift
+fi
+if test "$1" != "" ; then
+ if test "$1" != "-" ; then
+ PROJECT_REPO="$1"
+ fi
+ shift
fi
### action ###
@@ -21,13 +33,13 @@ python3 -m venv "${VENV_PATH}"
source "${VENV_PATH}/bin/activate"
pip install --upgrade pip
pip install "$PROJECT_REPO"
-django-test-admin setup "${DJANGO_PATH}"
+$SETUP_COMMAND setup "${DJANGO_PATH}"
python3 "${DJANGO_PATH}/manage.py" collectstatic --noinput
-cat <> "${DJANGO_PATH}/main/settings.py"
+cat <> "${DJANGO_PATH}/${DJANGO_MAIN_MODULE}/settings.py"
ALLOWED_HOSTS = ['*']
-DEBUG = True
+DEBUG = False
E-O-H
### end ###
diff --git a/container-files/docker-entrypoint.sh b/container-files/docker-entrypoint.sh
new file mode 100755
index 0000000..ba9cb24
--- /dev/null
+++ b/container-files/docker-entrypoint.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Disable CustomLog, that is configured by default in upstream.
+sed -i -e 's:^\(\s*\)\(CustomLog\s\s*"logs/access_log"\):\1# Disabled by /docker-entrypoint.sh # \2:' \
+ /etc/httpd/conf/httpd.conf
+
+# Remove left-overs from an incomplete shutdown previously.
+rm -rf /run/httpd/* /tmp/httpd*
+
+if test "X${SERVER_ADMIN}" != "X" ; then
+ set -- -c "ServerAdmin $SERVER_ADMIN" "$@"
+fi
+if test "X${LOG_LEVEL}" != "X" ; then
+ set -- -c "LogLevel $LOG_LEVEL" "$@"
+fi
+exec /usr/sbin/httpd -DFOREGROUND "$@"
diff --git a/container-files/etc/httpd/conf.d/django-test.conf b/container-files/etc/httpd/conf.d/django-test.conf
deleted file mode 100644
index b6d76a2..0000000
--- a/container-files/etc/httpd/conf.d/django-test.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-WSGIDaemonProcess django-test processes=1 threads=4 display-name=django-test python-home=/var/www/wsgi/django-test/python python-path=/var/www/wsgi/django-test/django
-
-Alias /static/ "/var/www/wsgi/django-test/django/var/www/static/"
-
- AllowOverride None
- Require all granted
-
-
-WSGIScriptAlias / "/var/www/wsgi/django-test/django/main/wsgi.py"
-
- WSGIProcessGroup django-test
- WSGIPassAuthorization On
- AllowOverride None
- Options FollowSymLinks
-
- Require all granted
-
-
diff --git a/container-files/etc/httpd/conf.d/defaults.conf b/container-files/httpd-layer/etc/httpd/conf.d/defaults.conf
similarity index 60%
rename from container-files/etc/httpd/conf.d/defaults.conf
rename to container-files/httpd-layer/etc/httpd/conf.d/defaults.conf
index 11b7062..a6784a9 100644
--- a/container-files/etc/httpd/conf.d/defaults.conf
+++ b/container-files/httpd-layer/etc/httpd/conf.d/defaults.conf
@@ -1,6 +1,4 @@
# /etc/httpd/conf.d/defaults.conf
-ServerAdmin heinzel@heinzelwelt.de
ServerTokens Prod
ErrorLog /dev/stderr
-LogLevel info
diff --git a/container-files/etc/httpd/conf.d/welcome.conf b/container-files/httpd-layer/etc/httpd/conf.d/welcome.conf
similarity index 100%
rename from container-files/etc/httpd/conf.d/welcome.conf
rename to container-files/httpd-layer/etc/httpd/conf.d/welcome.conf
diff --git a/container-files/etc/httpd/conf.d/zzz-lock-down.conf b/container-files/httpd-layer/etc/httpd/conf.d/zzz-lock-down.conf
similarity index 100%
rename from container-files/etc/httpd/conf.d/zzz-lock-down.conf
rename to container-files/httpd-layer/etc/httpd/conf.d/zzz-lock-down.conf
diff --git a/container-files/etc/httpd/conf.modules.d/00-base.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/00-base.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/00-base.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/00-base.conf
diff --git a/container-files/etc/httpd/conf.modules.d/00-dav.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/00-dav.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/00-dav.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/00-dav.conf
diff --git a/container-files/etc/httpd/conf.modules.d/00-lua.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/00-lua.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/00-lua.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/00-lua.conf
diff --git a/container-files/etc/httpd/conf.modules.d/00-proxy.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/00-proxy.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/00-proxy.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/00-proxy.conf
diff --git a/container-files/etc/httpd/conf.modules.d/10-h2.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/10-h2.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/10-h2.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/10-h2.conf
diff --git a/container-files/etc/httpd/conf.modules.d/10-proxy_h2.conf b/container-files/httpd-layer/etc/httpd/conf.modules.d/10-proxy_h2.conf
similarity index 100%
rename from container-files/etc/httpd/conf.modules.d/10-proxy_h2.conf
rename to container-files/httpd-layer/etc/httpd/conf.modules.d/10-proxy_h2.conf
diff --git a/container-files/usr/local/sbin/start-httpd.sh b/container-files/usr/local/sbin/start-httpd.sh
deleted file mode 100755
index 09f67ab..0000000
--- a/container-files/usr/local/sbin/start-httpd.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec /usr/sbin/httpd -DFOREGROUND $@