Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
exmatrikulator committed Apr 23, 2019
0 parents commit c8d3501
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 0 deletions.
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from ubuntu:18.04

ENV DEBIAN_FRONTEND noninteractive

EXPOSE 80
HEALTHCHECK --interval=1m --timeout=3s --retries=3 CMD curl -f http://127.0.0.1 || exit 1

# CONFIGURATION VARIABLES
ARG TINE20_VERSION=2019.02.4
ARG TINE20_SERVER_NAME=localhost
ARG TINE20_SERVER_ALIAS=localhost
ARG TINE20_DB_HOST=mysql-server
ARG TINE20_DB_NAME=tine20
ARG TINE20_DB_USER
ARG TINE20_DB_PASS
ARG TINE20_SETUP_USER
ARG TINE20_SETUP_PASS

RUN apt-get update && apt-get install -y \
apache2 \
cron \
curl \
libapache2-mod-php \
php-mbstring \
php-mysql \
php-gd \
php-intl \
php-json \
php-cli \
php-xml \
php-zip \
php-redis \
unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*


RUN mkdir -p /opt/tine20 && \
chown www-data:www-data /opt/tine20/ && \
curl http://packages.tine20.org/source/$TINE20_VERSION/tine20-allinone_$TINE20_VERSION.zip -o tine20.zip &&\
USER=www-data unzip tine20.zip -d /opt/tine20 &&\
rm tine20.zip && \
curl http://packages.tine20.org/source/$TINE20_VERSION/tine20-voip_$TINE20_VERSION.zip -o voip.zip &&\
USER=www-data unzip voip.zip -d /opt/tine20 &&\
rm voip.zip && \
curl http://packages.tine20.org/source/$TINE20_VERSION/tine20-humanresources_$TINE20_VERSION.zip -o humanresources.zip &&\
USER=www-data unzip humanresources.zip -d /opt/tine20 &&\
rm humanresources.zip && \
curl http://packages.tine20.org/source/$TINE20_VERSION/tine20-projects_$TINE20_VERSION.zip -o projects.zip &&\
USER=www-data unzip projects.zip -d /opt/tine20 &&\
rm projects.zip && \
curl http://packages.tine20.org/source/$TINE20_VERSION/tine20-simplefaq_$TINE20_VERSION.zip -o simplefaq.zip &&\
USER=www-data unzip simplefaq.zip -d /opt/tine20 &&\
rm simplefaq.zip

COPY crontab /etc/cron.d/tine20
COPY apache.conf /etc/apache2/sites-available/tine20.conf
RUN rm /etc/apache2/sites-enabled/000-default.conf && a2ensite tine20
COPY tine20.conf /opt/tine20/config.inc.php_dist
RUN mkdir -p /var/lib/tine20/cache /var/lib/tine20/files /var/lib/tine20/sessions /var/lib/tine20/tmp /etc/tine20 && \
chown -R www-data:www-data /var/lib/tine20 /etc/tine20 && \
ln -s /etc/tine20/config.inc.php /opt/tine20/config.inc.php

RUN a2enmod rewrite expires
HEALTHCHECK --interval=3s --timeout=3s --retries=3 CMD curl -f http://127.0.0.1 || exit 1


COPY ./docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
```
docker build -t tine20-server .
```

## Docker-Compose

```
docker-compose up -d
```

## Docker Swarm

```
docker stack deploy tine20 -c docker-compose.yml
```

open your browser to
http://localhost/setup.php
Login: tine20setup
Password: changeme2

If nothing happend, be aware, that you aren't trying to connect with IPv6 to a non IPv6 Docker Daemon!
Try, http://127.0.0.1/setup.php instead.

- Accept license
- Tests schould be OK
- Setup Page should be fine as well
- Just pick a "initial Admin User" and password
- Email can be left blank for now
- Select your prefered Apps and click "return to Tine 2.0"
61 changes: 61 additions & 0 deletions apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<VirtualHost *:80>
DocumentRoot /opt/tine20
DirectoryIndex index.php

<Location />
Require all granted
</Location>


<Directory /opt/tine20>

php_value max_input_time 120
php_value session.gc_maxlifetime 86400
php_value memory_limit 128M
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value safe_mode off
php_flag display_errors off
php_flag log_errors on
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
php_flag register_globals off
php_value max_execution_time 90

RewriteEngine on

# ActiveSync
RewriteRule ^Microsoft-Server-ActiveSync index.php?frontend=activesync [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

# OpenID
RewriteRule ^users/(.*) index.php?frontend=openid&username=$1 [L,QSA]

# WebDAV / CalDAV / CardDAV
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$
RewriteRule ^$ index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

RewriteRule ^addressbooks index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^calendars index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^webdav index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^principals index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^remote.php index.php?frontend=webdav [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

# Anonymous downloads
RewriteRule ^download/get/(.*) index.php?method=Download.downloadNode&path=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
RewriteRule ^download/show/(.*) index.php?method=Download.displayNode&path=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

# Routing
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php?doRouting=1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

ExpiresActive on

ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/jpeg "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
</Directory>
</VirtualHost>

4 changes: 4 additions & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin

* * * * * www-data /usr/bin/php /opt/tine20/tine20.php --method=Tinebase.triggerAsyncEvents | logger -p daemon.notice -t "Tine 2.0 scheduler"
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'
services:
tine20:
image: tine20-server
#build: .
ports:
- 80:80
environment:
- TINE20_DB_HOST=mariadb
- TINE20_DB_USER=root
- TINE20_DB_PASS=changeme
- TINE20_SETUP_PASS=changeme2
volumes:
- files:/var/lib/tine20/files
- config:/etc/tine20/

mariadb:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MYSQL_DATABASE=tine20
volumes:
- data:/var/lib/mysql

redis:
image: redis
volumes:
- cache:/data


volumes:
config:
data:
files:
cache:
49 changes: 49 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
set -e

if [ -z "$@" ]; then

if [ ! -f /etc/tine20/config.inc.php ]; then
cp /opt/tine20/config.inc.php_dist /etc/tine20/config.inc.php
fi

if [ "$TINE20_DB_HOST" ]; then
sed -i "s/ENTER DATABASE HOSTNAME/$TINE20_DB_HOST/" /etc/tine20/config.inc.php
else
sed -i "s/ENTER DATABASE HOSTNAME/mysql-server/" /etc/tine20/config.inc.php
fi

if [ "$TINE20_DB_NAME" ]; then
sed -i "s/ENTER DATABASE NAME/$TINE20_DB_NAME/" /etc/tine20/config.inc.php
else
sed -i "s/ENTER DATABASE NAME/tine20/" /etc/tine20/config.inc.php
fi

if [ "$TINE20_DB_USER" ]; then
sed -i "s/ENTER DATABASE USERNAME/$TINE20_DB_USER/" /etc/tine20/config.inc.php
else
sed -i "s/ENTER DATABASE USERNAME/tine20/" /etc/tine20/config.inc.php
fi

if [ "$TINE20_DB_PASS" ]; then
sed -i "s/ENTER DATABASE PASSWORD/$TINE20_DB_PASS/" /etc/tine20/config.inc.php
else
sed -i "s/ENTER DATABASE PASSWORD//" /etc/tine20/config.inc.php
fi

if [ "$TINE20_SETUP_USER" ]; then
sed -i "s/SETUP USERNAME/$TINE20_SETUP_USER/" /etc/tine20/config.inc.php
else
sed -i "s/SETUP USERNAME/tine20setup/" /etc/tine20/config.inc.php
fi

if [ "$TINE20_SETUP_PASS" ]; then
sed -i "s/SETUP PASSWORD/$TINE20_SETUP_PASS/" /etc/tine20/config.inc.php
else
sed -i "s/SETUP PASSWORD//" /etc/tine20/config.inc.php
fi
/usr/sbin/cron
/usr/sbin/apache2ctl -DFOREGROUND
fi

exec "$@"
43 changes: 43 additions & 0 deletions tine20.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
// minimal configuration
return array(
// set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
'captcha' => array('count'=>0),
'database' => array(
'host' => 'ENTER DATABASE HOSTNAME',
'dbname' => 'ENTER DATABASE NAME',
'username' => 'ENTER DATABASE USERNAME',
'password' => 'ENTER DATABASE PASSWORD',
'adapter' => 'pdo_mysql',
'tableprefix' => 'tine20_',
),
'setupuser' => array(
'username' => 'SETUP USERNAME',
'password' => 'SETUP PASSWORD'
),
'caching' => array (
'active' => true,
'lifetime' => 3600,
'backend' => 'Redis',
'redis' => array (
'host' => 'redis',
'port' => 6379,
),
),
'actionqueue' => array (
'active' => true,
'backend' => 'Redis',
'host' => 'redis',
'port' => 6379,
),
'session' => array (
'lifetime' => 86400,
'backend' => 'Redis',
'host' => 'redis',
'port' => 6379,
),
'tmpdir' => '/var/lib/tine20/tmp',
'filesdir' => '/var/lib/tine20/files',
'mapPanel' => 1
);

0 comments on commit c8d3501

Please sign in to comment.