aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <dennis@terje.dnns.no>2019-02-07 23:00:29 +0100
committerDennis Eriksen <dennis@terje.dnns.no>2019-02-07 23:00:29 +0100
commitbb62ee191472adfff77e110d77fe6eafbf0a9b65 (patch)
tree53a07cd036a57c0e5d8c15ae8f53e63d3e48eec2
downloaddavical-docker-bb62ee191472adfff77e110d77fe6eafbf0a9b65.tar.gz
Initial commit
-rw-r--r--.gitignore21
-rw-r--r--Dockerfile42
-rw-r--r--README.md3
-rw-r--r--env.sample2
-rwxr-xr-xfiles/usr/local/bin/entrypoint.sh30
-rw-r--r--files/var/www/app/config.php13
6 files changed, 111 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..32fc9ef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
+### Env ###
+env
+
+### Vim ###
+# Swap
+[._]*.s[a-v][a-z]
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+
+# Temporary
+.netrwhist
+*~
+# Auto-generated tag files
+tags
+# Persistent undo
+[._]*.un~
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..9d49790
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
+FROM alpine:3.9
+MAINTAINER Dennis Eriksen <d@ennis.no>
+
+EXPOSE 80
+
+RUN apk update && apk add \
+ apache2 \
+ curl \
+ php7 \
+ php7-apache2 \
+ php7-cgi \
+ php7-curl \
+ php7-imap \
+ php7-pgsql \
+ php7-xml \
+ xz && \
+ rm -rf /var/cache/apk/* && \
+ rm -rf /var/www/localhost
+
+RUN mkdir /run/apache2 && chown -R apache:apache /run/apache2
+
+# awl
+RUN TMPDIR=$(mktemp -d) && cd $TMPDIR \
+ && curl -sL -o awl.tar.xz https://www.davical.org/downloads/awl_0.60.orig.tar.xz \
+ && unxz awl.tar.xz \
+ && tar xf awl.tar \
+ && mkdir /usr/local/share/awl \
+ && cp -a dba inc /usr/local/share/awl/ \
+ && cd / && rm -r $TMPDIR
+
+# davical
+RUN mkdir /var/www/app && cd /var/www/app \
+ && curl -sL -o davical.tar.xz https://www.davical.org/downloads/davical_1.1.8.orig.tar.xz \
+ && unxz davical.tar.xz \
+ && tar xf davical.tar \
+ && chown -R apache:apache /var/www/app
+
+ADD files/ /
+
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
+#ENTRYPOINT ["/bin/sh"]
+CMD []
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..68f38e7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Davical
+
+Initial README
diff --git a/env.sample b/env.sample
new file mode 100644
index 0000000..868c248
--- /dev/null
+++ b/env.sample
@@ -0,0 +1,2 @@
+DATABASE_URL=''
+
diff --git a/files/usr/local/bin/entrypoint.sh b/files/usr/local/bin/entrypoint.sh
new file mode 100755
index 0000000..d1a1cc2
--- /dev/null
+++ b/files/usr/local/bin/entrypoint.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Apache server name change
+if [ ! -z "$APACHE_SERVER_NAME" ]
+ then
+ sed -i "s/#ServerName www.example.com:80/ServerName $APACHE_SERVER_NAME/" /etc/apache2/httpd.conf
+ echo "Changed server name to '$APACHE_SERVER_NAME'..."
+ else
+ echo "NOTICE: Change 'ServerName' globally and hide server message by setting environment variable >> 'APACHE_SERVER_NAME=your.server.name' in docker command or docker-compose file"
+fi
+
+# Change apache config
+sed -i 's/ServerAdmin\ you@example.com/ServerAdmin\ you@example.com/' /etc/apache2/httpd.conf
+sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/httpd.conf
+sed -i 's#/var/www/localhost/htdocs#/var/www/app/htdocs#g' /etc/apache2/httpd.conf
+
+# Modify php.ini settings
+sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php7/php.ini
+sed -i "s/^;date.timezone =$/date.timezone = \"Europe\/Stockholm\"/" /etc/php7/php.ini
+
+
+# display logs
+tail -F /var/log/apache2/*log &
+
+echo "Clearing any old processes..."
+rm -f /run/apache2/apache2.pid
+rm -f /run/apache2/httpd.pid
+
+echo "Starting apache..."
+httpd -D FOREGROUND
diff --git a/files/var/www/app/config.php b/files/var/www/app/config.php
new file mode 100644
index 0000000..f25f096
--- /dev/null
+++ b/files/var/www/app/config.php
@@ -0,0 +1,13 @@
+<?php
+ $c->domain_name = "davical.eriksen.im";
+ $c->sysabbr = 'DAViCal';
+ $c->admin_email = 'dennis@eriksen.im';
+ $c->system_name = "Eriksens DAViCal Server";
+ $c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';
+
+/*
+ * Use Apache-supplied headers and believe them
+ */
+
+ $c->authenticate_hook['server_auth_type'] = 'Basic';
+ include_once('AuthPlugins.php');