From 0a80c737d03fb984dbbfee3ccd8554de72bc288e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 9 Mar 2011 16:34:19 +0000 Subject: [PATCH] doc: Mention SQLite. --- doc/manual/installation.xml | 48 +++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/doc/manual/installation.xml b/doc/manual/installation.xml index 9fb0d57a..1061bba5 100644 --- a/doc/manual/installation.xml +++ b/doc/manual/installation.xml @@ -35,29 +35,63 @@ nix-env -i hydra
- Creating database + Creating the database - Hydra stores its results in a PostgreSQL database. To setup a database with hydra as database name and username, issue the following commands: + Hydra stores its results in a database, which can be a + PostgreSQL or SQLite database. The latter is easier to + setup, but the former scales better. + + + To setup a PostgreSQL + database with hydra as database name + and user name, issue the following commands: createdb hydra echo "CREATE USER hydra WITH PASSWORD '<your-password>' ;" | psql hydra cat $prefix/share/hydra/sql/hydra-postgresql.sql | psql hydra echo "GRANT ALL ON DATABASE hydra TO hydra;" | psql hydra - Note that $prefix is the location of Hydra in the nix store. + Note that $prefix is the location of + Hydra in the nix store. + + + + For SQLite, the following command is all it takes to + create the database: + + + cat $prefix/share/hydra/sql/hydra-sqlite.sql | sqlite3 /path/to/hydra.sqlite + + To add a user root with admin privileges, execute: echo "INSERT INTO Users(userName, emailAddress, password) VALUES ('root', 'some@email.adress.com', '$(echo -n foobar | sha1sum | cut -c1-40)');" | psql hydra -echo "INSERT INTO UserRoles(userName, role) values('root', 'admin');" | psql hydra +echo "INSERT INTO UserRoles(userName, role) values('root', 'admin');" | psql hydra + + For SQLite the same commands can be used, with + psql hydra replaced by + sqlite3 /path/to/hydra.sqlite. + + + + Hydra uses an environment variable to know which database + should be used, and a variable which point to a location + that holds some state. To set these variables for a + PostgreSQL database, add the following to the + .profile of the user running the + Hydra services. - Hydra uses an environment variable to know which database should be used, and a variable which point to a location that holds some state. To set these - variables, add the following to the .profile of the user running the Hydra services. export HYDRA_DBI="dbi:Pg:dbname=hydra;host=localhost;" export HYDRA_DATA=/var/lib/hydra - Make sure that the HYDRA_DATA directory exists and is writable for the user which will run the Hydra services. + Make sure that the HYDRA_DATA + directory exists and is writable for the user which will + run the Hydra services. For a SQLite database, the + HYDRA_DBI should be set to something + like dbi:SQLite:/path/to/hydra.sqlite +