1 | # $Id$ |
---|
2 | |
---|
3 | PyKota - Print Quotas for CUPS |
---|
4 | |
---|
5 | (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com> |
---|
6 | This program is free software: you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation, either version 3 of the License, or |
---|
9 | (at your option) any later version. |
---|
10 | |
---|
11 | This program is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | |
---|
19 | ============================================================ |
---|
20 | |
---|
21 | Documentation for the pykota-postgresql.sql script : |
---|
22 | ---------------------------------------------------- |
---|
23 | |
---|
24 | This script is to be used to create an empty Quota Storage |
---|
25 | DataBase using PostgreSQL as a backend. |
---|
26 | |
---|
27 | If you have already installed PyKota, and have datas in your |
---|
28 | Quota Storage DataBase, you may prefer to skip this section |
---|
29 | and read the next one. |
---|
30 | |
---|
31 | - edit the pykota-postgresql.sql file and modify the passwords on |
---|
32 | the 'CREATE USER' lines. |
---|
33 | |
---|
34 | - Launch the psql frontend and connect to the |
---|
35 | database template1 as a PostgreSQL administrator |
---|
36 | (i.e. the postgres user) : |
---|
37 | |
---|
38 | as user 'root' : |
---|
39 | |
---|
40 | # su - postgres |
---|
41 | |
---|
42 | you're now user 'postgres', then continue with : |
---|
43 | |
---|
44 | $ psql -f pykota-postgresql.sql template1 |
---|
45 | |
---|
46 | or depending on your settings you may prefer : |
---|
47 | |
---|
48 | $ psql -h localhost -U postgres -f pykota-postgresql.sql template1 |
---|
49 | |
---|
50 | - If no error message appears, your PostgreSQL PyKota storage |
---|
51 | is now ready for use. NB : a lot of NOTICE messages might appear, |
---|
52 | this is perfectly normal. |
---|
53 | |
---|
54 | - In ~pykota/pykota.conf, ensure that the following lines |
---|
55 | are present and unique inside the [global] section : |
---|
56 | |
---|
57 | storagebackend : pgstorage |
---|
58 | storageserver : localhost |
---|
59 | storagename : pykota |
---|
60 | storageuser : pykotauser |
---|
61 | storageuserpw : readonlypw |
---|
62 | |
---|
63 | NB : replace 'readonlypw' with the password you chose |
---|
64 | for user 'pykotauser' when you modified pykota-postgresql.sql |
---|
65 | |
---|
66 | - In ~pykota/pykotadmin.conf ensure that the following lines |
---|
67 | are present and unique inside the [global] section : |
---|
68 | |
---|
69 | storageadmin : pykotaadmin |
---|
70 | storageadminpw : readwritepw |
---|
71 | |
---|
72 | NB : replace 'readwritepw' with the password you chose |
---|
73 | for user 'pykotaadmin' when you modified pykota-postgresql.sql |
---|
74 | |
---|
75 | - IMPORTANT : if your database is not located on the print server, |
---|
76 | replace 'localhost' in the lines above with your database server's |
---|
77 | hostname or IP address. If your database server doesn't listen on |
---|
78 | its standard port, add the port number at the end of the hostname |
---|
79 | with a colon to separate the hostname from the port. |
---|
80 | See pykota/conf/pykota.conf.sample for examples. |
---|
81 | |
---|
82 | ============================================================ |
---|
83 | |
---|
84 | Upgrade scripts : |
---|
85 | |
---|
86 | DON'T DO ANYTHING IF THIS IS YOUR FIRST INSTALLATION |
---|
87 | OF PYKOTA. |
---|
88 | |
---|
89 | Some scripts to upgrade old PyKota databases to the new |
---|
90 | database schema are included. You may have to run all |
---|
91 | of them or only some of them, depending on your |
---|
92 | version of PyKota. Usually running them several times, for |
---|
93 | example if you used several different development versions |
---|
94 | of PyKota, won't do any harm. |
---|
95 | |
---|
96 | If you're connected as user 'root', you have to be user 'postgres' |
---|
97 | instead : |
---|
98 | |
---|
99 | # su - postgres |
---|
100 | |
---|
101 | You're now user 'postgres', then continue the upgrade by following |
---|
102 | the instructions below, depending on the version you actually use : |
---|
103 | |
---|
104 | * An SQL script to upgrade a 1.22 PyKota Storage DataBase to |
---|
105 | 1.23 is included. Launch it this way on the Quota Storage Server : |
---|
106 | |
---|
107 | $ psql -U postgres pykota |
---|
108 | pykota=# \i upgrade-to-1.23.sql |
---|
109 | pykota=# \q |
---|
110 | $ |
---|
111 | |
---|
112 | This script adds many fields to existing tables, and a table to |
---|
113 | manage billing codes. |
---|
114 | |
---|
115 | * An SQL script to upgrade a 1.20 PyKota Storage DataBase to |
---|
116 | 1.21 is included. Launch it this way on the Quota Storage Server : |
---|
117 | |
---|
118 | $ psql -U postgres pykota |
---|
119 | pykota=# \i upgrade-to-1.21.sql |
---|
120 | pykota=# \q |
---|
121 | $ |
---|
122 | |
---|
123 | This script adds many fields to existing tables, and also adds |
---|
124 | some tables in indexes. |
---|
125 | |
---|
126 | * An SQL script to upgrade a 1.18 PyKota Storage DataBase to |
---|
127 | 1.19 is included. Launch it this way on the Quota Storage Server : |
---|
128 | |
---|
129 | $ psql -U postgres pykota |
---|
130 | pykota=# \i upgrade-to-1.19.sql |
---|
131 | pykota=# \q |
---|
132 | $ |
---|
133 | |
---|
134 | This script adds a field to the print job history. The field that |
---|
135 | is added is : hostname |
---|
136 | |
---|
137 | * An SQL script to upgrade a pre-1.16 PyKota Storage DataBase to |
---|
138 | 1.16 is included. Launch it this way on the Quota Storage Server : |
---|
139 | |
---|
140 | $ psql -U postgres pykota |
---|
141 | pykota=# \i upgrade-to-1.16.sql |
---|
142 | pykota=# \q |
---|
143 | $ |
---|
144 | |
---|
145 | This script adds some fields to the print job history, so that |
---|
146 | more complete information will be known. The fields that |
---|
147 | are added are : jobprice, filename, title, copies and print |
---|
148 | command options. Also some indexes are created to speed things up. |
---|
149 | |
---|
150 | What is below is for historical reasons only, real people don't use |
---|
151 | such old beasts, and YOU SHOULDN'T EITHER ! |
---|
152 | |
---|
153 | * An SQL script to upgrade a pre-1.14 PyKota Storage DataBase to |
---|
154 | 1.14 is included. Launch it this way on the Quota Storage Server : |
---|
155 | |
---|
156 | $ psql -U postgres pykota |
---|
157 | pykota=# \i upgrade-to-1.14.sql |
---|
158 | pykota=# \q |
---|
159 | $ |
---|
160 | |
---|
161 | This script adds an "email" field for each user. This field, if not |
---|
162 | NULL, is used as the email address of the user when sending warning |
---|
163 | messages in case he is over quota. |
---|
164 | |
---|
165 | * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to |
---|
166 | 1.01 is still included for historical reasons. PLEASE DON'T USE IT ! |
---|
167 | |
---|
168 | * If you are already running an old version of PyKota (<1.03) and |
---|
169 | want to upgrade to 1.03, YOU HAVE TO RUN the |
---|
170 | upgrade-from-before-1.03.py shell script. NOT LAUNCHING THIS SCRIPT |
---|
171 | WILL CAUSE PYKOTA TO STOP WORKING ! PLEASE NEVER RUN THIS SCRIPT IF |
---|
172 | YOUR EXISTING VERSION OF PYKOTA IS ALREADY 1.03 OR HIGHER. |
---|