doc/book/admin/config.rst
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 06 Jun 2016 21:17:33 +0200
changeset 11347 b4dcfd734686
parent 10491 c67bcee93248
child 11338 dde85a5d47fc
permissions -rw-r--r--
[server] some pep8 in rql2sql
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     2
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     3
.. _ConfigEnv:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     4
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     5
Set-up of a *CubicWeb* environment
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     6
==================================
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     7
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     8
You can `configure the database`_ system of your choice:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
     9
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    10
  - `PostgreSQL configuration`_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    11
  - `MySql configuration`_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    12
  - `SQLServer configuration`_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    13
  - `SQLite configuration`_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    14
7230
edd2a575a8e7 [doc] update of the update
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7226
diff changeset
    15
For advanced features, have a look to:
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    16
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    17
  - `Cubicweb resources configuration`_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    18
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    19
.. _`configure the database`: DatabaseInstallation_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    20
.. _`PostgreSQL configuration`: PostgresqlConfiguration_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    21
.. _`MySql configuration`: MySqlConfiguration_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    22
.. _`SQLServer configuration`: SQLServerConfiguration_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    23
.. _`SQLite configuration`: SQLiteConfiguration_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    24
.. _`Cubicweb resources configuration`: RessourcesConfiguration_
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    25
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    26
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    27
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    28
.. _RessourcesConfiguration:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    29
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    30
Cubicweb resources configuration
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    31
--------------------------------
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    32
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    33
.. autodocstring:: cubicweb.cwconfig
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    34
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    35
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    36
.. _DatabaseInstallation:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    37
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    38
Databases configuration
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    39
-----------------------
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    40
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    41
Each instance can be configured with its own database connection information,
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    42
that will be stored in the instance's :file:`sources` file. The database to use
7230
edd2a575a8e7 [doc] update of the update
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7226
diff changeset
    43
will be chosen when creating the instance. CubicWeb is known to run with
10221
17ad882a211f [doc] Don't pretend we know cubicweb runs on mysql
Julien Cristau <julien.cristau@logilab.fr>
parents: 9285
diff changeset
    44
Postgresql (recommended), SQLServer and SQLite, and may run with MySQL.
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    45
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    46
Other possible sources of data include CubicWeb, Subversion, LDAP and Mercurial,
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    47
but at least one relational database is required for CubicWeb to work. You do
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    48
not need to install a backend that you do not intend to use for one of your
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    49
instances. SQLite is not fit for production use, but it works well for testing
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    50
and ships with Python, which saves installation time when you want to get
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    51
started quickly.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    52
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    53
.. _PostgresqlConfiguration:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    54
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    55
PostgreSQL
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    56
~~~~~~~~~~
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    57
9285
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    58
Many Linux distributions ship with the appropriate PostgreSQL packages.
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    59
Basically, you need to install the following packages:
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    60
9285
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    61
* `postgresql` and `postgresql-client`, which will pull the respective
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    62
  versioned packages (e.g. `postgresql-9.1` and `postgresql-client-9.1`) and,
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    63
  optionally,
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    64
* a `postgresql-plpython-X.Y` package with a version corresponding to that of
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    65
  the aforementioned packages (e.g. `postgresql-plpython-9.1`).
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    66
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    67
If you run postgres version prior to 8.3, you'll also need the
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    68
`postgresql-contrib-8.X` package for full-text search extension.
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    69
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    70
If you run postgres on another host than the |cubicweb| repository, you should
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    71
install the `postgresql-client` package on the |cubicweb| host, and others on the
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    72
database host.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    73
9285
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    74
For extra details concerning installation, please refer to the `PostgreSQL
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    75
project online documentation`_.
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    76
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    77
.. _`PostgreSQL project online documentation`: http://www.postgresql.org/docs
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    78
e7c94121ce9d [book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8331
diff changeset
    79
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    80
Database cluster
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    81
++++++++++++++++
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    82
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    83
If you already have an existing cluster and PostgreSQL server running, you do
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    84
not need to execute the initilization step of your PostgreSQL database unless
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    85
you want a specific cluster for |cubicweb| databases or if your existing
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    86
cluster doesn't use the UTF8 encoding (see note below).
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    87
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    88
To initialize a PostgreSQL cluster, use the command ``initdb``::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    89
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    90
    $ initdb -E UTF8 -D /path/to/pgsql
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    91
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    92
Notice the encoding specification. This is necessary since |cubicweb| usually
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    93
want UTF8 encoded database. If you use a cluster with the wrong encoding, you'll
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    94
get error like::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    95
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    96
  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    97
  HINT:  Use the same encoding as in the template database, or use template0 as template.
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
    98
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
    99
Once initialized, start the database server PostgreSQL with the command::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   100
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   101
  $ postgres -D /path/to/psql
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   102
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   103
If you cannot execute this command due to permission issues, please make sure
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   104
that your username has write access on the database.  ::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   105
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   106
  $ chown username /path/to/pgsql
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   107
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   108
Database authentication
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   109
+++++++++++++++++++++++
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   110
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   111
The database authentication is configured in `pg_hba.conf`. It can be either set
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   112
to `ident sameuser` or `md5`.  If set to `md5`, make sure to use an existing
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   113
user of your database.  If set to `ident sameuser`, make sure that your client's
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   114
operating system user name has a matching user in the database. If not, please
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   115
do as follow to create a user::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   116
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   117
  $ su
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   118
  $ su - postgres
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   119
  $ createuser -s -P username
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   120
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   121
The option `-P` (for password prompt), will encrypt the password with the
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   122
method set in the configuration file :file:`pg_hba.conf`.  If you do not use this
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   123
option `-P`, then the default value will be null and you will need to set it
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   124
with::
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   125
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   126
  $ su postgres -c "echo ALTER USER username WITH PASSWORD 'userpasswd' | psql"
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   127
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   128
The above login/password will be requested when you will create an instance with
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   129
`cubicweb-ctl create` to initialize the database of your instance.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   130
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   131
Notice that the `cubicweb-ctl db-create` does database initialization that
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   132
may requires a postgres superuser. That's why a login/password is explicitly asked
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   133
at this step, so you can use there a superuser without using this user when running
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   134
the instance. Things that require special privileges at this step:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   135
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   136
* database creation, require the 'create database' permission
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   137
* install the plpython extension language (require superuser)
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   138
* install the tsearch extension for postgres version prior to 8.3 (require superuser)
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   139
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   140
To avoid using a super user each time you create an install, a nice trick is to
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   141
install plpython (and tsearch when needed) on the special `template1` database,
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   142
so they will be installed automatically when cubicweb databases are created
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   143
without even with needs for special access rights. To do so, run ::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   144
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   145
  # Installation of plpythonu language by default ::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   146
  $ createlang -U pgadmin plpythonu template1
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   147
  $ psql -U pgadmin template1
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   148
  template1=# update pg_language set lanpltrusted=TRUE where lanname='plpythonu';
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   149
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   150
Where `pgadmin` is a postgres superuser. The last command is necessary since by
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   151
default plpython is an 'untrusted' language and as such can't be used by non
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   152
superuser. This update fix that problem by making it trusted.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   153
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   154
To install the tsearch plain-text index extension on postgres prior to 8.3, run::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   155
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   156
    cat /usr/share/postgresql/8.X/contrib/tsearch2.sql | psql -U username template1
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   157
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   158
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   159
.. _MySqlConfiguration:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   160
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   161
MySql
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   162
~~~~~
10221
17ad882a211f [doc] Don't pretend we know cubicweb runs on mysql
Julien Cristau <julien.cristau@logilab.fr>
parents: 9285
diff changeset
   163
.. warning::
17ad882a211f [doc] Don't pretend we know cubicweb runs on mysql
Julien Cristau <julien.cristau@logilab.fr>
parents: 9285
diff changeset
   164
    CubicWeb's MySQL support is not commonly used, so things may or may not work properly.
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   165
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   166
You must add the following lines in ``/etc/mysql/my.cnf`` file::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   167
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   168
    transaction-isolation=READ-COMMITTED
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   169
    default-storage-engine=INNODB
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   170
    default-character-set=utf8
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   171
    max_allowed_packet = 128M
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   172
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   173
.. Note::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   174
    It is unclear whether mysql supports indexed string of arbitrary length or
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   175
    not.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   176
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   177
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   178
.. _SQLServerConfiguration:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   179
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   180
SQLServer
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   181
~~~~~~~~~
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   182
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   183
As of this writing, support for SQLServer 2005 is functional but incomplete. You
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   184
should be able to connect, create a database and go quite far, but some of the
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   185
SQL generated from RQL queries is still currently not accepted by the
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   186
backend. Porting to SQLServer 2008 is also an item on the backlog.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   187
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   188
The `source` configuration file may look like this (specific parts only are
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   189
shown)::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   190
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   191
  [system]
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   192
  db-driver=sqlserver2005
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   193
  db-user=someuser
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   194
  # database password not needed
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   195
  #db-password=toto123
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   196
  #db-create/init may ask for a pwd: just say anything
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   197
  db-extra-arguments=Trusted_Connection
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   198
  db-encoding=utf8
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   199
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   200
7597
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   201
You need to change the default settings on the database by running::
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   202
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   203
 ALTER DATABASE <databasename> SET READ_COMMITTED_SNAPSHOT ON;
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   204
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   205
The ALTER DATABASE command above requires some permissions that your
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   206
user may not have. In that case you will have to ask your local DBA to
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   207
run the query for you.
7597
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   208
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   209
You can check that the setting is correct by running the following
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   210
query which must return '1'::
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   211
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   212
   SELECT is_read_committed_snapshot_on
7597
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   213
     FROM sys.databases WHERE name='<databasename>';
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   214
c6cf2a9b2331 [doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7529
diff changeset
   215
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   216
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   217
.. _SQLiteConfiguration:
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   218
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   219
SQLite
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   220
~~~~~~
8331
fada118921d6 [doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 7597
diff changeset
   221
7226
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   222
SQLite has the great advantage of requiring almost no configuration. Simply
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   223
use 'sqlite' as db-driver, and set path to the dabase as db-name. Don't specify
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   224
anything for db-user and db-password, they will be ignore anyway.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   225
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   226
.. Note::
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   227
  SQLite is great for testing and to play with cubicweb but is not suited for
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   228
  production environments.
e88c57c10b34 [doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff changeset
   229