From 9fe7d7fd2b8f97b7f4d1595493f220a0388225c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 8 Mar 2017 12:35:35 +0100 Subject: [PATCH] WIP: More docker tweaks --- docker/3_buildwheels/build.docker | 3 +- docker/4_run/bash_history | 5 ++ docker/4_run/run.docker | 20 +++-- docker/4_run/wsgi-py36.conf | 122 ++++++++++++++++++++++++++++++ docker/4_run/wsgi-py36.load | 1 + 5 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 docker/4_run/bash_history create mode 100644 docker/4_run/wsgi-py36.conf create mode 100644 docker/4_run/wsgi-py36.load diff --git a/docker/3_buildwheels/build.docker b/docker/3_buildwheels/build.docker index 37dded2..64bc219 100644 --- a/docker/3_buildwheels/build.docker +++ b/docker/3_buildwheels/build.docker @@ -1,5 +1,5 @@ FROM pillar_py:3.6 -MAINTAINER Sybren A. Stüvel +LABEL maintainer Sybren A. Stüvel RUN apt-get install -qy \ git \ @@ -11,5 +11,6 @@ RUN apt-get install -qy \ ENV WHEELHOUSE=/data/wheelhouse ENV PIP_WHEEL_DIR=/data/wheelhouse ENV PIP_FIND_LINKS=/data/wheelhouse +RUN mkdir -p $WHEELHOUSE VOLUME /data/wheelhouse diff --git a/docker/4_run/bash_history b/docker/4_run/bash_history new file mode 100644 index 0000000..6db2063 --- /dev/null +++ b/docker/4_run/bash_history @@ -0,0 +1,5 @@ +bash docker-entrypoint.sh +env | sort +apache2ctl start +apache2ctl graceful +tail -n 40 -f /var/log/apache2/error.log diff --git a/docker/4_run/run.docker b/docker/4_run/run.docker index 2b86234..2bd1063 100755 --- a/docker/4_run/run.docker +++ b/docker/4_run/run.docker @@ -1,10 +1,10 @@ FROM pillar_py:3.6 +LABEL maintainer Sybren A. Stüvel RUN apt-get update && apt-get install -qyy \ -o APT::Install-Recommends=false -o APT::Install-Suggests=false \ git \ apache2 \ -libapache2-mod-wsgi \ libapache2-mod-xsendfile \ libjpeg8 \ libtiff5 \ @@ -27,11 +27,7 @@ RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR ADD wheelhouse /data/wheelhouse RUN pip3 install --no-index --find-links=/data/wheelhouse -r /data/wheelhouse/requirements.txt -VOLUME /data/git/blender-cloud -VOLUME /data/git/pillar -VOLUME /data/git/pillar-python-sdk -VOLUME /data/git/attract -VOLUME /data/git/flamenco +VOLUME /data/git VOLUME /data/config VOLUME /data/storage @@ -40,9 +36,19 @@ ENV USE_X_SENDFILE True EXPOSE 80 EXPOSE 5000 +ADD wsgi-py36.* /etc/apache2/mods-available/ +RUN a2enmod rewrite && a2enmod wsgi-py36 + ADD apache2.conf /etc/apache2/apache2.conf ADD 000-default.conf /etc/apache2/sites-available/000-default.conf ADD docker-entrypoint.sh /docker-entrypoint.sh ADD manage.sh /manage.sh -ENTRYPOINT ["bash", "/docker-entrypoint.sh"] +# Remove some empty top-level directories we won't use anyway. +RUN rmdir /media /home 2>/dev/null || true + +# This file includes some useful commands to have in the shell history +# for easy access. +ADD bash_history /root/.bash_history + +ENTRYPOINT /docker-entrypoint.sh diff --git a/docker/4_run/wsgi-py36.conf b/docker/4_run/wsgi-py36.conf new file mode 100644 index 0000000..e767dce --- /dev/null +++ b/docker/4_run/wsgi-py36.conf @@ -0,0 +1,122 @@ + + + + #This config file is provided to give an overview of the directives, + #which are only allowed in the 'server config' context. + #For a detailed description of all avaiable directives please read + #http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives + + + #WSGISocketPrefix: Configure directory to use for daemon sockets. + # + #Apache's DEFAULT_REL_RUNTIMEDIR should be the proper place for WSGI's + #Socket. In case you want to mess with the permissions of the directory, + #you need to define WSGISocketPrefix to an alternative directory. + #See http://code.google.com/p/modwsgi/wiki/ConfigurationIssues for more + #information + + #WSGISocketPrefix /var/run/apache2/wsgi + + + #WSGIPythonOptimize: Enables basic Python optimisation features. + # + #Sets the level of Python compiler optimisations. The default is '0' + #which means no optimisations are applied. + #Setting the optimisation level to '1' or above will have the effect + #of enabling basic Python optimisations and changes the filename + #extension for compiled (bytecode) files from .pyc to .pyo. + #When the optimisation level is set to '2', doc strings will not be + #generated and retained. This will result in a smaller memory footprint, + #but may cause some Python packages which interrogate doc strings in some + #way to fail. + + #WSGIPythonOptimize 0 + + + #WSGIPythonPath: Additional directories to search for Python modules, + # overriding the PYTHONPATH environment variable. + # + #Used to specify additional directories to search for Python modules. + #If multiple directories are specified they should be separated by a ':'. + + WSGIPythonPath /opt/python/lib/python3.6/site-packages + + #WSGIPythonEggs: Directory to use for Python eggs cache. + # + #Used to specify the directory to be used as the Python eggs cache + #directory for all sub interpreters created within embedded mode. + #This directive achieves the same affect as having set the + #PYTHON_EGG_CACHE environment variable. + #Note that the directory specified must exist and be writable by the user + #that the Apache child processes run as. The directive only applies to + #mod_wsgi embedded mode. To set the Python eggs cache directory for + #mod_wsgi daemon processes, use the 'python-eggs' option to the + #WSGIDaemonProcess directive instead. + + #WSGIPythonEggs directory + + + + #WSGIRestrictEmbedded: Enable restrictions on use of embedded mode. + # + #The WSGIRestrictEmbedded directive determines whether mod_wsgi embedded + #mode is enabled or not. If set to 'On' and the restriction on embedded + #mode is therefore enabled, any attempt to make a request against a + #WSGI application which hasn't been properly configured so as to be + #delegated to a daemon mode process will fail with a HTTP internal server + #error response. + + #WSGIRestrictEmbedded On|Off + + + + #WSGIRestrictStdin: Enable restrictions on use of STDIN. + #WSGIRestrictStdout: Enable restrictions on use of STDOUT. + #WSGIRestrictSignal: Enable restrictions on use of signal(). + # + #Well behaved WSGI applications neither should try to read/write from/to + #STDIN/STDOUT, nor should they try to register signal handlers. If your + #application needs an exception from this rule, you can disable the + #restrictions here. + + #WSGIRestrictStdin On + #WSGIRestrictStdout On + #WSGIRestrictSignal On + + + + #WSGIAcceptMutex: Specify type of accept mutex used by daemon processes. + # + #The WSGIAcceptMutex directive sets the method that mod_wsgi will use to + #serialize multiple daemon processes in a process group accepting requests + #on a socket connection from the Apache child processes. If this directive + #is not defined then the same type of mutex mechanism as used by Apache for + #the main Apache child processes when accepting connections from a client + #will be used. If set the method types are the same as for the Apache + #AcceptMutex directive. + + #WSGIAcceptMutex default + + + + #WSGIImportScript: Specify a script file to be loaded on process start. + # + #The WSGIImportScript directive can be used to specify a script file to be + #loaded when a process starts. Options must be provided to indicate the + #name of the process group and the application group into which the script + #will be loaded. + + #WSGIImportScript process-group=name application-group=name + + + #WSGILazyInitialization: Enable/disable lazy initialisation of Python. + # + #The WSGILazyInitialization directives sets whether or not the Python + #interpreter is preinitialised within the Apache parent process or whether + #lazy initialisation is performed, and the Python interpreter only + #initialised in the Apache server processes or mod_wsgi daemon processes + #after they have forked from the Apache parent process. + + #WSGILazyInitialization On|Off + + diff --git a/docker/4_run/wsgi-py36.load b/docker/4_run/wsgi-py36.load new file mode 100644 index 0000000..51a05d6 --- /dev/null +++ b/docker/4_run/wsgi-py36.load @@ -0,0 +1 @@ +LoadModule wsgi_module /opt/python/mod-wsgi/mod_wsgi.so