aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Dockerfile34
-rw-r--r--README.md15
-rwxr-xr-xbin/runapache233
-rw-r--r--docker-compose.yml53
-rw-r--r--resources/baikal.apache222
-rw-r--r--sample.env (renamed from baikal.env)3
7 files changed, 135 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9df269f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.env
+volumes/
diff --git a/Dockerfile b/Dockerfile
index f3140e3..151241d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,14 +1,38 @@
-FROM php:7.4-apache AS intermediate
+FROM debian:9-slim
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y unzip
+RUN apt-get install -y apache2
+RUN apt-get install -y rsyslog
+RUN apt-get install -y sqlite3
+RUN apt-get install -y php
+RUN apt-get install -y libapache2-mod-php
+RUN apt-get install -y php-date
+RUN apt-get install -y php-dompdf
+RUN apt-get install -y php-mbstring
+RUN apt-get install -y php-sqlite3
+RUN apt-get install -y php-mysql
+RUN apt-get install -y php-dom
+
WORKDIR /src
RUN curl -LO https://github.com/fruux/Baikal/releases/download/0.4.6/baikal-0.4.6.zip && unzip baikal-0.4.6.zip && rm -f baikal-0.4.6.zip
RUN rm -r baikal/Specific/*
+RUN mkdir -p /var/www/
+RUN mv /src/baikal/* /var/www/html/
-FROM php:7.4-apache
-
-COPY --from=intermediate /src/baikal/* /var/www/html/
-WORKDIR /var/www/html
VOLUME /var/www/html/Specific
+
+WORKDIR /etc/apache2/sites-available
+RUN /etc/init.d/apache2 stop ; a2enmod rewrite
+RUN mv -f 000-default.conf ..
+COPY resources/baikal.apache2 /etc/apache2/sites-available/000-default.conf
+RUN echo "error_log = syslog" >> /etc/php/7.0/apache2/php.ini
+
+WORKDIR /
+COPY bin/runapache2 /
+
+RUN awk '/vim: syntax/ { printf("# Poxy; CVE-2016-5387\nLoadModule headers_module /usr/lib/apache2/modules/mod_headers.so\nRequestHeader unset Proxy early\n%s\n", $0); next; } { print; }' /etc/apache2/apache2.conf > /tmp/apache2.conf
+RUN cat /tmp/apache2.conf > /etc/apache2/apache2.conf && rm /tmp/apache2.conf
+
+ENTRYPOINT [ "/runapache2" ]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c637b5c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+Based on: [https://github.com/pr3d4t0r/calendar](https://github.com/pr3d4t0r/calendar)
+
+# Installation
+
+```
+docker-compose build
+mkdir -p volumes/Specific/db
+chown -R 33:33 volumes/Specific
+```
+
+# Start
+
+```
+docker-compose up -d
+```
diff --git a/bin/runapache2 b/bin/runapache2
new file mode 100755
index 0000000..f1aaa84
--- /dev/null
+++ b/bin/runapache2
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Copyright (c) 2016 by CIME Software Ltd. All rights reserved.
+
+# See: LICENSE.txt for complete licensing information.
+
+
+if [[ -n "$CONTAINER_DOMAIN_NAME" ]]
+then
+ DOMAIN_NAME="$CONTAINER_DOMAIN_NAME"
+else
+ DOMAIN_NAME="example.org"
+fi
+
+if [[ -n "$CONTAINER_HOST_NAME" ]]
+then
+ HOST_NAME="$CONTAINER_HOST_NAME"
+else
+ HOST_NAME="calendar"
+fi
+
+hostname "$HOST_NAME.$DOMAIN_NAME"
+domainname "$DOMAIN_NAME"
+
+source /etc/apache2/envvars
+
+mkdir -p "$APACHE_LOCK_DIR"
+mkdir -p "$APACHE_RUN_DIR"
+
+service rsyslog start
+
+/usr/sbin/apache2 -DFOREGROUND
+
diff --git a/docker-compose.yml b/docker-compose.yml
index 63e731b..7a7d6fc 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,26 +1,35 @@
version: '3.3'
services:
- db:
- image: mysql:5.7
- volumes:
- - ./volumes/db:/var/lib/mysql
- restart: always
- env_file:
- - baikal.env
+ db:
+ image: mysql:5.7
+ volumes:
+ - ./volumes/db:/var/lib/mysql
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
+ MYSQL_DATABASE: ${MYSQL_DATABASE}
+ MYSQL_USER: ${MYSQL_USER}
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD}
- baikal:
- depends_on:
- - db
- build:
- context: .
- dockerfile: Dockerfile
- ports:
- - "8080:80"
- restart: always
- labels:
- - traefik.http.middlewares.strip-baikal.stripprefix.prefixes=/baikal
- - traefik.http.routers.baikal.rule=(Host(`example.org`) || Host(`www.example.org`) && PathPrefix(`baikal`)
- - traefik.http.routers.baikal.middlewares=strip-baikal@docker
- volumes:
- - ./volumes/Specific:/var/www/html/Specific
+ baikal:
+ depends_on:
+ - db
+ build:
+ context: .
+ dockerfile: Dockerfile
+ ports:
+ - "8080:80"
+ environment:
+ CONTAINER_DOMAIN_NAME: ${DOMAIN_NAME}
+ CONTAINER_HOST_NAME: ${HOST_NAME}
+ restart: always
+ labels:
+ - "traefik.http.routers.baikal.rule=Host(`${HOST_NAME}.${DOMAIN_NAME}`)"
+ - "traefik.http.middlewares.baikal-path.replacepathregex.regex=^/${PATH_PREFIX}/(.*)"
+ - "traefik.http.middlewares.baikal-path.replacepathregex.replacement=/$$1"
+ - "traefik.http.routers.baikal-nosub.rule=(Host(`${DOMAIN_NAME}`) || Host(`www.${DOMAIN_NAME}`) && PathPrefix(`${PATH_PREFIX}`)"
+ - "traefik.http.routers.baikal-nosub.middlewares=baikal-path@docker"
+ - "traefik.http.routers.baikal-wellknown.rule=(Host(`${DOMAIN_NAME}`) || Host(`www.${DOMAIN_NAME}`) && (Path(`.well-known/caldav`) || Path(`.well-known/carddav`))"
+ volumes:
+ - ./volumes/Specific:/var/www/html/Specific
diff --git a/resources/baikal.apache2 b/resources/baikal.apache2
new file mode 100644
index 0000000..6572b1f
--- /dev/null
+++ b/resources/baikal.apache2
@@ -0,0 +1,22 @@
+ServerName calendar.example.org
+
+<VirtualHost *:80>
+ DocumentRoot /var/www/html/html
+ ServerName calendar.example.org
+
+ RewriteEngine On
+ RewriteRule /.well-known/carddav /dav.php [R,L]
+ RewriteRule /.well-known/caldav /dav.php [R,L]
+
+ <Directory "/var/www/html/html">
+ Options None
+ Options +FollowSymlinks
+ AllowOverride All
+
+ Require all granted
+ </Directory>
+
+</VirtualHost>
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
+
diff --git a/baikal.env b/sample.env
index 918c6d3..6c86ec6 100644
--- a/baikal.env
+++ b/sample.env
@@ -2,3 +2,6 @@ MYSQL_ROOT_PASSWORD=verysecurepassword
MYSQL_DATABASE=baikal
MYSQL_USER=baikal
MYSQL_PASSWORD=somepassword
+DOMAIN_NAME=example.org
+HOST_NAME=cal
+PATH_PREFIX=baikal