This commit is contained in:
Julian M. Kunkel 2018-05-05 21:56:32 +01:00
parent 470a4692e7
commit 86d2e00bf0
6 changed files with 151 additions and 4 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
run

View File

@ -1,10 +1,13 @@
FROM ubuntu:18.04
WORKDIR /data
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 libapache2-mod-php
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y apache2
RUN rm /etc/apache2/sites-enabled/000-default.conf
RUN ln -s /data/dev/apache.conf /etc/apache2/sites-enabled/
RUN a2enmod rewrite
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql libapache2-mod-wsgi-py3
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y virtualenv
RUN ln -s /data/dev/apache-local.conf /etc/apache2/sites-enabled/
#RUN a2enmod rewrite
CMD /data/dev/run-internal.sh

61
dev/apache-deploy.conf Normal file
View File

@ -0,0 +1,61 @@
<VirtualHost *:80>
ServerAdmin admin@wr.informatik.uni-hamburg.de
ServerName oer.wr.informatik.uni-hamburg.de
Redirect permanent / https://oer.wr.informatik.uni-hamburg.de/
<Directory />
Options SymLinksIfOwnerMatch
AllowOverride None
Require all denied
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@wr.informatik.uni-hamburg.de
ServerName oer.wr.informatik.uni-hamburg.de
#RewriteEngine on
#RewriteRule "^/$" "http://cluster.wr.informatik.uni-hamburg.de:8000/" [R,L]
#RewriteRule "^/(.+)$" "http://cluster.wr.informatik.uni-hamburg.de:8000/$1" [R,L]
WSGIScriptAlias / "/home/hoou/git/HOOU/django-platform/main/wsgi.py"
WSGIDaemonProcess hoou python-home=/home/hoou/git/HOOU/virtualenv python-path=/home/hoou/git/HOOU/django-platform/ home=/home/hoou/git/HOOU/django-platform/ inactivity-timeout=10 request-timeout=10
WSGIProcessGroup hoou
WSGIApplicationGroup %{GLOBAL}
DocumentRoot /home/hoou/git/HOOU/django-platform/
Alias /static/ "/home/hoou/git/HOOU/django-platform/apache/static/"
<Directory "/home/hoou/git/HOOU/django-platform/apache/static/">
Require all granted
</Directory>
<Directory "/home/hoou/git/HOOU/django-platform/main/">
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error-oer.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/oer-access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/oer.wr.informatik.uni-hamburg.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/oer.wr.informatik.uni-hamburg.de/privkey.pem
Alias "/.well-known/acme-challenge/" "/var/www/certbot/.well-known/acme-challenge/"
<Directory /var/www/certbot>
Options SymLinksIfOwnerMatch
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
</IfModule>

61
dev/apache-local.conf Normal file
View File

@ -0,0 +1,61 @@
<VirtualHost *:80>
ServerAdmin admin@wr.informatik.uni-hamburg.de
ServerName oer.wr.informatik.uni-hamburg.de
Redirect permanent / https://oer.wr.informatik.uni-hamburg.de/
<Directory />
Options SymLinksIfOwnerMatch
AllowOverride None
Require all denied
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@wr.informatik.uni-hamburg.de
ServerName oer.wr.informatik.uni-hamburg.de
#RewriteEngine on
#RewriteRule "^/$" "http://cluster.wr.informatik.uni-hamburg.de:8000/" [R,L]
#RewriteRule "^/(.+)$" "http://cluster.wr.informatik.uni-hamburg.de:8000/$1" [R,L]
WSGIScriptAlias / "/home/hoou/git/HOOU/django-platform/main/wsgi.py"
WSGIDaemonProcess hoou python-home=/home/hoou/git/HOOU/virtualenv python-path=/home/hoou/git/HOOU/django-platform/ home=/home/hoou/git/HOOU/django-platform/ inactivity-timeout=10 request-timeout=10
WSGIProcessGroup hoou
WSGIApplicationGroup %{GLOBAL}
DocumentRoot /home/hoou/git/HOOU/django-platform/
Alias /static/ "/home/hoou/git/HOOU/django-platform/apache/static/"
<Directory "/home/hoou/git/HOOU/django-platform/apache/static/">
Require all granted
</Directory>
<Directory "/home/hoou/git/HOOU/django-platform/main/">
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error-oer.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/oer-access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/oer.wr.informatik.uni-hamburg.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/oer.wr.informatik.uni-hamburg.de/privkey.pem
Alias "/.well-known/acme-challenge/" "/var/www/certbot/.well-known/acme-challenge/"
<Directory /var/www/certbot>
Options SymLinksIfOwnerMatch
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
</IfModule>

11
dev/requirements.txt Normal file
View File

@ -0,0 +1,11 @@
django-secure
django-filter
django-cookie-law
djangorestframework
python-social-auth
Sphinx
pymongo
celery
markdown
psycopg2
social-auth-app-django

View File

@ -1,6 +1,16 @@
#!/bin/bash
#!/bin/bash -e
adduser --system --no-create-home --home /data --uid 1000 www-user
sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=www-user/" /etc/apache2/envvars
/etc/init.d/apache2 start
tail -f /var/log/apache2/error.log &
V="/data/run/virtualenv"
if [[ ! -e $V ]] ; then
mkdir -p $V
virtualenv -p python3 $V
cd $V
source $V/bin/activate
pip3 install -U -r /data/dev/requirements.txt
fi
/bin/bash