+-----------------------------------------------------------------------
| Running davical on OpenBSD
+-----------------------------------------------------------------------

Database Setup
==============
DAViCal needs two PostgreSQL users, one for administrative access and
one for daily use. Assuming you have an administrative account named
`postgres', you can create the users and davical database like this:

createuser -U postgres --pwprompt --no-superuser --no-createdb \
	--no-createrole davical_dba
createuser -U postgres --pwprompt --no-superuser --no-createdb \
	--no-createrole davical_app
createdb -U postgres -E UTF8 -T template0 -O davical_dba davical

Let's fill the database using the newly created dba user:

psql -U davical_dba -f /var/www/awl/dba/awl-tables.sql davical
psql -U davical_dba -f /var/www/awl/dba/schema-management.sql davical
psql -U davical_dba -f /var/www/davical/dba/davical.sql davical

Run the administrative script to set permissions for the application DB
user on the database. This script should be used when upgrading DAViCal
too, so that the DB schema is consistent.

/var/www/davical/dba/update-davical-database --dbname davical \
	--appuser davical_app --nopatch --owner davical_dba \
	--dbpass "$davical_dba_password"

Finally, insert basic roles/users into the db:

psql -U davical_dba -f /var/www/davical/dba/base-data.sql davical

Default temporary admin password is 'nimda', stored in database as
'**nimda', you can change it to 'temppass' with

psql -U davical_dba -c \
"UPDATE usr SET password = '**temppass' WHERE user_no = 1;" davical

This is only for initial setup, and it should be changed through the
web interface (which will crypt the new password) once logged in.


DAViCal Configuration
=====================

The DAViCal configuration resides in
/var/www/davical/config/config.php and is a regular PHP file which
sets (or overrides) some specific variables. You should only need to
set pg_connect value to configure database access.

httpd(8) Configuration
=====================

With httpd(8), it is easiest to run php-fpm and use the following 
for a distinct server block:

ext_addr="*"
server "default" {
    listen on $ext_addr port 80
    listen on $ext_addr tls port 443
    connection { max requests 500, timeout 3600 }
    location "/" { directory index index.php }
    location "/davical/*.php*" {
            fastcgi socket "/run/php-fpm.sock"
            root "/davical/htdocs"
    }
}

Apache Configuration
====================

With Apache, AllowOverride settings are required on the /var/www/davical
directory. You can configure this as follows:

# ln -s ../modules.sample/davical.conf \
        /var/www/conf/modules
# /etc/rc.d/apache2 restart

Then point your browser at:
    http://<hostname>/davical/
and you should get a message telling you to configure DAViCal.

Nginx Configuration
===================

With Nginx, the simplest way is to run php-fpm, and use the following
configuration for a distinct server block:

server {
    server_name calendar.example.com;
    root /var/www/davical/htdocs/;

    location / {
        index index.php;
    }
    location /images/ {
    }
    location ~ ^(.*\.php)(.*)$ {
        include fastcgi_params;
        fastcgi_pass unix:run/php-fpm.sock;
        fastcgi_split_path_info ^(.*\.php)(.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Client Setup
============

More information is available at http://wiki.davical.org/w/CalDAV_Clients.
