diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5bdd21 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +run diff --git a/dev/Dockerfile b/dev/Dockerfile index b3640c5..00482d6 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -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 diff --git a/dev/apache-deploy.conf b/dev/apache-deploy.conf new file mode 100644 index 0000000..1deedcb --- /dev/null +++ b/dev/apache-deploy.conf @@ -0,0 +1,61 @@ + + ServerAdmin admin@wr.informatik.uni-hamburg.de + ServerName oer.wr.informatik.uni-hamburg.de + + Redirect permanent / https://oer.wr.informatik.uni-hamburg.de/ + + + Options SymLinksIfOwnerMatch + AllowOverride None + Require all denied + + + ErrorLog ${APACHE_LOG_DIR}/error.log + LogLevel warn + CustomLog ${APACHE_LOG_DIR}/access.log combined + + + + + + 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/" + + + Require all granted + + + + Require all granted + + + 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/" + + + Options SymLinksIfOwnerMatch + AllowOverride None + Require all granted + + + diff --git a/dev/apache-local.conf b/dev/apache-local.conf new file mode 100644 index 0000000..1deedcb --- /dev/null +++ b/dev/apache-local.conf @@ -0,0 +1,61 @@ + + ServerAdmin admin@wr.informatik.uni-hamburg.de + ServerName oer.wr.informatik.uni-hamburg.de + + Redirect permanent / https://oer.wr.informatik.uni-hamburg.de/ + + + Options SymLinksIfOwnerMatch + AllowOverride None + Require all denied + + + ErrorLog ${APACHE_LOG_DIR}/error.log + LogLevel warn + CustomLog ${APACHE_LOG_DIR}/access.log combined + + + + + + 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/" + + + Require all granted + + + + Require all granted + + + 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/" + + + Options SymLinksIfOwnerMatch + AllowOverride None + Require all granted + + + diff --git a/dev/requirements.txt b/dev/requirements.txt new file mode 100644 index 0000000..7a89108 --- /dev/null +++ b/dev/requirements.txt @@ -0,0 +1,11 @@ +django-secure +django-filter +django-cookie-law +djangorestframework +python-social-auth +Sphinx +pymongo +celery +markdown +psycopg2 +social-auth-app-django diff --git a/dev/run-internal.sh b/dev/run-internal.sh index 66de833..6b899f0 100755 --- a/dev/run-internal.sh +++ b/dev/run-internal.sh @@ -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