GNUmed server for Debian
------------------------

This package is needed to run a local GNUmed database but
it does NOT create one out of the box.  It just installs the
SQL files of GNUmed server to /var/lib/gnumed/server.  From
there you have to follow the instructions of the README file
that is provided by the GNUmed authors. Future Debian
packages will try to offer more automatic mechanisms if
possible.

Even without bootstrapping you can use the GNUmed client
with a public database as described in the docs of the
GNUmed client.


Installing the Database
=======================

Make sure that your postgresql server is UTF-8 enabled, eg:

        $ psql -t -d template1 -c "show lc_ctype;"
	de_DE.UTF-8

or some other <lang>.UTF-8 string.

As root call:

	# /usr/sbin/gm-bootstrap_server

Note that this will DESTROY any existing GNUmed
databases you might already have on your server.

Make sure to use the UPGRADE procedure if you want to
upgrade an existing database.


Upgrading the Database
======================

To upgrade your v19 database to the current version 20 database
follow these steps:

1) Make sure all clients are disconnected.

	The upgrade will fail if any client is still connected.
	You can send a message to connected clients via the user interface.

2) Run the upgrade procedure.

	# gm-upgrade_server 19 20

	This can take a long time and require quite some disk space
	if your database is large. Try the "no-backup" option if you
	are ABSOLUTELY SURE you already have an uptodate backup !

	This must be run as root on the database server.

	Remark: If your postgresql server is running on a non default
	        port (5432) you should set the environment variable
	          GM_DB_PORT
	        accordingly.

3) Adjust backend profiles in private .conf files.

	You probably need to adjust the database name of some
	profiles in, say, ~/.gnumed/gnumed.conf.

	Otherwise your clients may try to connect to
	the old database.

4) Adjust your backup procedures.

	You probably need to adjust the database name
	in /etc/gnumed/gnumed-backup.conf.

Accessing the database
======================

You need to add proper permissions for GNUmed users to
/etc/postgresql/<version>/<cluster>/pg_hba.conf .
It is recommended to use the line

local   samerole       +gm-logins	md5

In case of trouble read more in the GNUmed Wiki at
http://wiki.gnumed.de/bin/view/Gnumed/ConfigurePostgreSQL#pg_hba_conf


Configuring daily backups
=========================

Once you installed the database you most probably want to
organize a backup of your data.  The Debian package has
installed a cron job and the details can be adjusted in
/etc/gnumed/gnumed-backup.conf.
Please follow the documentation in that file to do so.


More detailed instructions
==========================

There are more detailed instructions at

   http://wiki.gnumed.de/bin/view/Gnumed/ServerInstallUpgrade

on how to install and upgrade the GNUmed database.


Installing fixups
=================

You can always install any fixups into your database with
gm-fixup_server like so:

        $> gm-fixup_server 20

assuming your database is at version 20. If there are no
fixups to apply it will simply fail without harm. There is
no problem repeating this procedure (unless there is a bug).

 -- Andreas Tille <tille@debian.org>  Mon, 26 Jan 2015 19:55:11 +0100
