author | Denis Laxalde <denis.laxalde@logilab.fr> |
Mon, 19 Jun 2017 18:15:28 +0200 | |
changeset 12188 | fea018b2e056 |
parent 11338 | dde85a5d47fc |
child 12352 | 1a0159426def |
permissions | -rw-r--r-- |
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 |
- `SQLServer configuration`_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
12 |
- `SQLite configuration`_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
13 |
|
7230
edd2a575a8e7
[doc] update of the update
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7226
diff
changeset
|
14 |
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
|
15 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
16 |
- `Cubicweb resources configuration`_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
17 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
18 |
.. _`configure the database`: DatabaseInstallation_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
19 |
.. _`PostgreSQL configuration`: PostgresqlConfiguration_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
20 |
.. _`SQLServer configuration`: SQLServerConfiguration_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
21 |
.. _`SQLite configuration`: SQLiteConfiguration_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
22 |
.. _`Cubicweb resources configuration`: RessourcesConfiguration_ |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
23 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
24 |
|
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 |
.. _RessourcesConfiguration: |
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 |
Cubicweb resources configuration |
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 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
31 |
.. autodocstring:: cubicweb.cwconfig |
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 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
34 |
.. _DatabaseInstallation: |
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 |
Databases configuration |
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 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
39 |
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
|
40 |
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
|
41 |
will be chosen when creating the instance. CubicWeb is known to run with |
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
42 |
Postgresql (recommended), SQLServer and SQLite. |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
43 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
started quickly. |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
50 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
51 |
.. _PostgresqlConfiguration: |
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 |
PostgreSQL |
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 |
|
9285
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
|
9285
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
59 |
* `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
|
60 |
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
|
61 |
optionally, |
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
62 |
* 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
|
63 |
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
|
64 |
|
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
65 |
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
|
66 |
`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
|
67 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
68 |
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
|
69 |
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
|
70 |
database host. |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
71 |
|
9285
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
72 |
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
|
73 |
project online documentation`_. |
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
74 |
|
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
75 |
.. _`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
|
76 |
|
e7c94121ce9d
[book] Improve PostgreSQL configuration section
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
8331
diff
changeset
|
77 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
78 |
Database cluster |
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
79 |
++++++++++++++++ |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
80 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
81 |
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
|
82 |
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
|
83 |
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
|
84 |
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
|
85 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
86 |
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
|
87 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
88 |
$ initdb -E UTF8 -D /path/to/pgsql |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
89 |
|
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
90 |
Note: ``initdb`` might not be in the PATH, so you may have to use its |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
91 |
absolute path instead (usually something like |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
92 |
``/usr/lib/postgresql/9.4/bin/initdb``). |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
93 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
94 |
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
|
95 |
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
|
96 |
get error like:: |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
97 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
98 |
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
|
99 |
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
|
100 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
101 |
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
|
102 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
103 |
$ postgres -D /path/to/psql |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
104 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
105 |
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
|
106 |
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
|
107 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
108 |
$ chown username /path/to/pgsql |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
109 |
|
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
110 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
111 |
Database authentication |
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
112 |
+++++++++++++++++++++++ |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
113 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
120 |
$ su |
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
121 |
$ su - postgres |
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
122 |
$ createuser -s -P <dbuser> |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
123 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
with:: |
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
128 |
|
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
129 |
$ su postgres -c "echo ALTER USER <dbuser> WITH PASSWORD '<dbpassword>' | psql" |
7226
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 |
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
|
132 |
`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
|
133 |
|
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
134 |
|
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
135 |
Database creation |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
136 |
+++++++++++++++++ |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
137 |
|
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
138 |
If you create the database by hand (instead of using the `cubicweb-ctl |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
139 |
db-create` tool), you may want to make sure that the local settings are |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
140 |
properly set. For example, if you need to handle french accents |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
141 |
properly for indexing and sorting, you may need to create the database |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
142 |
with something like:: |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
143 |
|
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
144 |
$ createdb --encoding=UTF-8 --locale=fr_FR.UTF-8 -t template0 -O <owner> <dbname> |
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
145 |
|
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
151 |
* database creation, require the 'create database' permission |
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
152 |
* install the `plpython` extension language (require superuser) |
7226
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 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
|
155 |
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
|
156 |
so they will be installed automatically when cubicweb databases are created |
11338
dde85a5d47fc
[book] improve a bit the documentation of the database setup
David Douard <david.douard@logilab.fr>
parents:
10491
diff
changeset
|
157 |
without needs for special access rights. To do so, run :: |
7226
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 |
# Installation of plpythonu language by default :: |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
160 |
$ createlang -U pgadmin plpythonu template1 |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
161 |
$ psql -U pgadmin template1 |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
162 |
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
|
163 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
168 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
169 |
.. _SQLServerConfiguration: |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
170 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
171 |
SQLServer |
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 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
174 |
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
|
175 |
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
|
176 |
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
|
177 |
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
|
178 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
179 |
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
|
180 |
shown):: |
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 |
[system] |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
183 |
db-driver=sqlserver2005 |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
184 |
db-user=someuser |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
185 |
# database password not needed |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
186 |
#db-password=toto123 |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
187 |
#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
|
188 |
db-extra-arguments=Trusted_Connection |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
189 |
db-encoding=utf8 |
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 |
|
7597
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
192 |
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
|
193 |
|
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
194 |
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
|
195 |
|
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
196 |
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
|
197 |
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
|
198 |
run the query for you. |
7597
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
199 |
|
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
200 |
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
|
201 |
query which must return '1':: |
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
202 |
|
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
203 |
SELECT is_read_committed_snapshot_on |
7597
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
204 |
FROM sys.databases WHERE name='<databasename>'; |
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
205 |
|
c6cf2a9b2331
[doc] SQL Server isolation level settings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7529
diff
changeset
|
206 |
|
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
207 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
208 |
.. _SQLiteConfiguration: |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
209 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
210 |
SQLite |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
211 |
~~~~~~ |
8331
fada118921d6
[doc] add missing section titles
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
7597
diff
changeset
|
212 |
|
7226
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
213 |
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
|
214 |
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
|
215 |
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
|
216 |
|
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
217 |
.. Note:: |
e88c57c10b34
[doc] major update of the install documentation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
diff
changeset
|
218 |
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
|
219 |
production environments. |