diff options
author | Dennis Eriksen <d@ennis.no> | 2019-10-19 10:36:11 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2019-10-19 10:36:11 +0200 |
commit | 9d9e5718de5d41ab17b70a7809a7d54c418884bc (patch) | |
tree | 67649af7d5fb6b3bdd3876a709d280bedf203298 | |
download | mkosi-davical-9d9e5718de5d41ab17b70a7809a7d54c418884bc.tar.gz |
initial commit
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | mkosi.default | 23 | ||||
-rw-r--r-- | mkosi.nspawn | 13 | ||||
-rwxr-xr-x | mkosi.postinst | 31 | ||||
-rw-r--r-- | mkosi.skeleton/root/apache2.davical.conf | 70 | ||||
-rw-r--r-- | mkosi.skeleton/root/apache2.mpm_prefork.conf | 16 | ||||
-rw-r--r-- | mkosi.skeleton/root/apache2.ports.conf | 4 |
7 files changed, 159 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dff6a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# mkosi cache +mkosi.cache/* diff --git a/mkosi.default b/mkosi.default new file mode 100644 index 0000000..e5e1b59 --- /dev/null +++ b/mkosi.default @@ -0,0 +1,23 @@ +[Distribution] +Distribution=ubuntu +Release=bionic +Repositories=main,universe +Mirror=http://no.archive.ubuntu.com + +[Output] +Format=directory +Output=/var/lib/machines/davical + +[Packages] +WithNetwork=yes +Packages= + ca-certificates + locales + apache2 + davical + libawl-php + vim + iputils-ping + dnsutils + net-tools + iproute2 diff --git a/mkosi.nspawn b/mkosi.nspawn new file mode 100644 index 0000000..3543ed6 --- /dev/null +++ b/mkosi.nspawn @@ -0,0 +1,13 @@ +[Exec] +Hostname=davical +ResolvConf=copy-host +Timezone=copy +PrivateUsers=pick +NoNewPrivileges=yes + +[Files] +PrivateUsersChown=true +BindReadOnly=/etc/davical + +[Network] +VirtualEthernet=no diff --git a/mkosi.postinst b/mkosi.postinst new file mode 100755 index 0000000..b41f0bb --- /dev/null +++ b/mkosi.postinst @@ -0,0 +1,31 @@ +#!/bin/sh +set -ex + +export DEBIAN_FRONTEND=noninteractive + +# locales +sed -i 's/# en_IE.UTF-8 UTF-8/en_IE.UTF-8 UTF-8/' /etc/locale.gen +locale-gen + +## awl +#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 +#mkdir -p /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 + +mv /root/apache2.ports.conf /etc/apache2/ports.conf +mv /root/apache2.davical.conf /etc/apache2/sites-available/davical.conf +mv /root/apache2.mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf + +a2dissite 000-default.conf +a2enmod rewrite +a2ensite davical.conf diff --git a/mkosi.skeleton/root/apache2.davical.conf b/mkosi.skeleton/root/apache2.davical.conf new file mode 100644 index 0000000..c7f4b62 --- /dev/null +++ b/mkosi.skeleton/root/apache2.davical.conf @@ -0,0 +1,70 @@ +<VirtualHost *:8301> + + ServerName #APACHE_SERVER_NAME + UseCanonicalName on + + DocumentRoot /usr/share/davical/htdocs + DirectoryIndex index.php index.html + + # To cirkumvent phps $_SERVER['HTTPS']-check + SetEnv HTTPS "on" + + AcceptPathInfo On + + # For some weird reason, apache2 doesn't set this automatically + SetEnv AUTH_TYPE Basic + + # Trust the remote user forwarded by nginx + SetEnvIf X-Forwarded-User (.*) REMOTE_USER=$1 + + <Directory /usr/share/davical/htdocs> + DirectoryIndex index.php + AllowOverride None + # for Apache from 2.4 use + Require all granted + # for Apache before 2.4 use + #Order allow,deny + #Allow from all + + # These are usually not necessary (set correctly by default) + #AcceptPathInfo On + #php_value include_path /usr/share/php/awl/inc + #php_value magic_quotes_gpc 0 + #php_value register_globals 0 + #php_value error_reporting "E_ALL & ~E_NOTICE" + #php_value default_charset "utf-8" + + # Some people want this. YMMV. + #php_admin_value open_basedir /usr/share/awl/inc/:/usr/share/davical/:/etc/davical/ + </Directory> + + <IfModule mod_rewrite.c> + RewriteEngine On + + # PT is important if you are using an alias, it implies L + # Redirect /.well-known URLs + RewriteRule ^/\.well-known/(.*)$ /caldav.php/.well-known/$1 [NC,PT] + # Optionally: redirect /principals/users/ as well + RewriteRule ^/principals/users/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/principals/resources/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/calendars/__uids__/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/addressbooks/__uids__/(.*)$ /caldav.php/$1 [NC,PT] + + # Optionally: Put DAViCal in the root + # NOTE: this will break other applications that rely on mod_rewrite! + # + # Not if it's the root URL. You might want to comment this out if you + # want to use an explicit /index.php for getting to the admin pages. + #RewriteCond %{REQUEST_URI} !^/$ + #RewriteCond %{REQUEST_URI} !^/davical/$ + # + # Not if it explicitly specifies a .php program, html page, stylesheet or image + #RewriteCond %{REQUEST_URI} !\.(php|html|css|js|png|gif|jpg|ico) + # + # Everything else gets rewritten to /caldav.php/... + #RewriteRule ^(.*)$ /davical/caldav.php$1 [NC,L] + </IfModule> +</VirtualHost> + + + diff --git a/mkosi.skeleton/root/apache2.mpm_prefork.conf b/mkosi.skeleton/root/apache2.mpm_prefork.conf new file mode 100644 index 0000000..73ceafc --- /dev/null +++ b/mkosi.skeleton/root/apache2.mpm_prefork.conf @@ -0,0 +1,16 @@ +# prefork MPM +# StartServers: number of server processes to start +# MinSpareServers: minimum number of server processes which are kept spare +# MaxSpareServers: maximum number of server processes which are kept spare +# MaxRequestWorkers: maximum number of server processes allowed to start +# MaxConnectionsPerChild: maximum number of requests a server process serves + +<IfModule mpm_prefork_module> + StartServers 1 + MinSpareServers 1 + MaxSpareServers 10 + MaxRequestWorkers 75 + MaxConnectionsPerChild 0 +</IfModule> + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/mkosi.skeleton/root/apache2.ports.conf b/mkosi.skeleton/root/apache2.ports.conf new file mode 100644 index 0000000..1ec7806 --- /dev/null +++ b/mkosi.skeleton/root/apache2.ports.conf @@ -0,0 +1,4 @@ +Listen 127.0.0.1:8301 +Listen [::1]:8301 + +# vim: syntax=apache ts=4 sw=4 sr noet |