Web Installer
=============

Once installed, PiAnoS has a web interface dedicated to creating the database schema (the actual tables) and the configuration file. It is a simple wizard whose steps are detailed below.

Even though the wizard can be restarted (by restarting the browser or click the 'reset' link) the creation of the schema is an irreversible operation. If you need to restart completely from scratch, you need to drop and re-create the database.
	
Config check 
------------

The configuration check is only informative for the moment. But clearly, seing alerts here and errors later should ring a bell.

Database setup
--------------

You need to enter all of hostname, port, database and username. The password is optional, depending on how ``pg_hba.conf`` allows connections to the database. If you put a password here, you probably want to ``chmod 600`` and ``chown www-data`` your ``local-settings.php`` file so that it is only readable by the web server.

The Test button allows you to check the connection.

.. note:: If you get an error message like ``Unable to connect to PostgreSQL server: fe_sendauth: no password supplied``, please see the relevant note in :doc:`debian` regarding ``pg_hba.conf`` and IPv6.


Database initialization
-----------------------

There is only one button here, so you may want to click on it.

As said above, once the schema is created you can't roll back the operation. You will simply see a message saying the database is ready.

.. note:: If you see an error (red frame), and the message contains the words "language plpgsql does not exist", your database is missing a small adjustment. You need to run the `createlang` command. On Linux, this is ``createlang plpgsql -d <dbname>``, on Windows most probably ``C:\Program Files (x86)\PostgreSQL\9.6\bin\createlang.exe plpgsql -d <dbname>``, where ``<dbname>`` is the name of your database. Alternatively, you can log into the database using ``psql -h <hostname> -U pianos <dbname>`` and issue the SQL statement ``CREATE LANGUAGE plpgsql;``.

Advanced settings & customization
---------------------------------

Proposed settings should be fine - just make sure the Path is correct. It should match the absolute path to PiAnoS on the server. If PiAnoS is the only (i.e. it is the document root) then the Path must be ``/``.

If users cannot log-in (keep seeing the login page even after correct authentication), the Path might be something to look at. 


Configuration file 
------------------

The PiAnoS configuration is ``backend/local-settings.php``. It is a mean to override the default configuration options. The wizard only allows to modify a couple values. See :doc:`../configuration` for more information.

Here you will be able to :
	- generate the configuration file automatically. This requires write access to the file ``local-settings.php``. See :ref:`db-setup` for more info on setting permissions.
	- create it manually (and check its content if desired)

	
Finalization
------------

This screen is mostly informative. You will be able to log-in using the ``admin`` account as soon as you have deleted the ``install/`` directory.

Problems ?
----------

Some known problems are listed in the :doc:`troubleshooting` section. If you have a problem, make sure you read this chapter before attempting anything else.
