Database

The Site Valet Database

Site Valet requires an SQL database. From Version 2.0, this is based on an abstract Database layer used by the Valet programs, and implemented by a driver module specified in the Valet environment.

This architecture serves to make Valet independent of the underlying SQL server. It will work with any SQL software as backend, provided a driver module is available. The specification of a driver has been kept deliberately simple, so supporting different databases should always be straightforward.

Driver modules are currently provided for MySQL and PostgreSQL.

Environment

Loading the driver at runtime means that no database is linked in to any of the Site Valet programs, so there is no requirement for databases not in use to be installed on the Valet host. But it also means the Valet programs have to know what driver to load, and where to find it.

This is specified by an environment variable $VALET_DB_DRIVER. The value of this should be the full path of the driver module in the file system. For example, VALET_DB_DRIVER=/usr/local/valet/lib/PgSQL.so.

Database Client

Every driver depends on the standard Client library for the underlying database, and will load it at startup. So the MySQL driver requires libmysqlclient.so, while the PostgreSQL driver requires libpq.so. The relevant database library must be in the system's standard library search path - for example LD_LIBRARY_PATH.

Database Setup

For each supported database, a setup script is provided. This will create a database called valet and all required tables and indexes in valet, and will create the User IDs required by the Site Valet daemons and periodic jobs.

The setup program will not set up accounts for Valet users. This must be dealt with separately.