Browse Source

upgrade documentation with pgtool

Damien ACCORSI 10 years ago
parent
commit
907484145f
1 changed files with 116 additions and 60 deletions
  1. 116 60
      README.md

+ 116 - 60
README.md View File

@@ -44,6 +44,8 @@ With Tracim, you centralize information, you can stay in touch by configuring yo
44 44
 
45 45
 Traceability and versionning is something important for quality-ready processes. Unfortunately, specialized software are hard to setup and to use. Let's try Tracim  ! You define access-control for each workspace and store documents and file there. Users can't delete information: everything is versionned and never deleted.
46 46
 
47
+----
48
+
47 49
 # Tracim - the software #
48 50
 
49 51
 ## Licence ##
@@ -63,6 +65,8 @@ It runs on [Debian GNU/Linux](http://www.debian.org/), it should work out-of-the
63 65
 
64 66
 Hopefully it works on BSD and Windows OSes (but this has not been tested yet)
65 67
 
68
+----
69
+
66 70
 # Use it (or give it a try) #
67 71
 
68 72
 ## Online Demo ##
@@ -73,16 +77,16 @@ The easiest way to test Tracim is to test it through the online demo:
73 77
 * login as admin: admin@admin.admin
74 78
 * password: admin@admin.admin
75 79
 
76
-_Note : this instance is reset every day_
77
-
78 80
 ## Ask for a dedicated instance ##
79 81
 
80
-If you wan't your own dedicated instance but do not want to manage it by yourself, let's contact us at hello@trac.im
82
+If you wan't your own dedicated instance but do not want to manage it by yourself, let's contact me at damien.accorsi@free.fr
81 83
 
82 84
 ## Install Tracim on your server ##
83 85
 
84 86
 Following the installation documentation below, you'll be able to run your own instance on your server.
85 87
 
88
+----
89
+
86 90
 # Installation #
87 91
 
88 92
 ## Dependencies ##
@@ -127,95 +131,102 @@ Notes:
127 131
 * Ubuntu (at least 14.04): you should remove _distribute_ and _wsgiref _
128 132
   from the requirements.txt file
129 133
 
130
-## Configuration ##
131 134
 ## Database Setup ##
132
-## Running the server ##
133
-### Standalone mode ###
134
-### Apache WSGI configuration ###
135
-## Support ##
136
-
137 135
 
136
+### Minimalist introduction to PostgreSQL ###
138 137
 
139
-### Setup a database ###
138
+If you already use/know PostgreSQL, you can directly go to *Test the database access*.
140 139
 
141 140
 #### Allowing local connections on PostgreSQL ####
142 141
 
143
-Check the pg_hba.conf file, it should allow connection for user/pass through loopback IP address.
144
-The file should include the following configuration:
142
+PostgreSQL stores connections ahtorization in *pg\_hba.conf*
143
+
144
+Edit the pg_hba.conf file and check that connectionx from 127.0.0.1 are allowed using user/password. You should find the following line in the file:
145 145
 
146 146
     # IPv4 local connections:
147 147
     host    all             all             127.0.0.1/32            md5
148 148
 
149
-Note: on Debian, the pg\_hba file is found at /etc/postgresql/9.1/main/pg_hba.conf
149
+Note: on Debian, the *pg\_hba.conf* file is found at */etc/postgresql/9.1/main/pg\_hba.conf*
150 150
 
151 151
 If you changed the file, reload PostgreSQL:
152 152
 
153 153
     service postgresql reload
154 154
 
155
-#### Create a new database and user on PostgreSQL ####
155
+#### Creating a user and associated database ####
156 156
 
157
-We suppose you will create a user named _tracimuser_ with passowrd _tracimpassword_
158
-and a database _tracimdb_
157
+You need a database and associated user/password.
159 158
 
160
-First login as root, then su as postgre and run a PostgreSQL client:
159
+Tracim comes with a tool that will make this step easy : pgtool.
161 160
 
162
-    root@hostname:~# su postgres
163
-    postgres@hostname:/root$ psql
164
-    psql (9.1.13)
165
-    Type "help" for help.
166
-    
167
-    postgres=# 
168
-    
169
-    
170
-Now, type the following commands:
161
+    ~/tracim$ ./bin/pgtool help
162
+
163
+login as *postgres* user and run the follwoing commands (which are self explanatory)
171 164
 
172
-    CREATE ROLE tracimuser WITH LOGIN PASSWORD 'tracimpassword';
173
-    CREATE DATABASE tracimdb OWNER tracimuser;
174
-    GRANT ALL PRIVILEGES ON DATABASE tracimdb TO tracimuser;
165
+    ./bin/pgtool create_user tracimuser tracimpassword
166
+    ./bin/pgtool create_database tracimdb
167
+    ./bin/pgtool grant_all_priviles tracimdb tracimuser
175 168
 
176
-At the end, you can quit the psql client by running the \q quit command:
169
+Notes :
177 170
 
178
-    postgres=# \q
179
-    postgres@mozart:/root$
171
+* in order to login as postgres user, su as root (with your password) then su postgres.
172
+* pgtool also offers options to delete users / databases. Run *./bin/pgtool help* for more information
180 173
 
181 174
 #### Test the database access ####
182 175
 
183
-You can test your newly created user by running the following command:
176
+So, now you have a database and an associated user/password.
177
+
178
+A good habit is to test things before to use them, that's why we want to test the database access now. This is easily done with tracim pgtool :
184 179
 
185
-    psql -h 127.0.0.1 -W -U tracimuser tracimdb -c 'SELECT NOW();'
180
+    ./bin/pgtool test_connection tracimdb tracimuser tracimpassword 127.0.0.1
186 181
 
187
-The result should be similar to:
182
+The result is similar to the following :
183
+
184
+    PG # CONNECT TO DATABASE
185
+    ------------------------
186
+    server:     127.0.0.1
187
+    database:   tracimdb
188
+    username:   bibi
188 189
 
189
-    user@hostname:~$ psql -h 127.0.0.1 -W -U tracimuser tracimdb -c 'SELECT NOW();'
190
-    Password for user tracimuser: 
191 190
                   now              
192 191
     -------------------------------
193
-     2014-06-16 11:35:48.590838+02
192
+     2014-11-10 09:40:23.306199+01
194 193
     (1 row)
195 194
 
196
-#### Setup the database schema and initial data ####
195
+In case of failure, you would get something like this:
196
+
197
+    PG # CONNECT TO DATABASE
198
+    ------------------------
199
+    server:     127.0.0.1
200
+    database:   tracimdb
201
+    username:   bibi
197 202
 
198
-Your database is now ready. Fill it with the required schema and data by importing SQL:
203
+    psql: FATAL:  password authentication failed for user "bibi"
204
+    FATAL:  password authentication failed for user "bibi"
205
+    ERRROR
199 206
 
200
-    psql -h 127.0.0.1 -W -U tracimuser tracimdb < doc/database/tracim-init-database.sql
207
+In this case, delete the user and database you previously created (using pgtool) and do it again. Do not forget to run the grant_all_rights command!
201 208
 
202
-You can test it through the following command:
209
+## Configuration ##
203 210
 
204
-    user@hostname:~$ psql -h 127.0.0.1 -W -U tracimuser tracimdb -c 'SELECT * from tracim_user;'
211
+At this point, you have :
205 212
 
206
-You should find the admin@localhost user entry.
213
+* an installation of Tracim with its dedicated python3-ready virtualenv
214
+* a PostgreSQL server and dedicated database
207 215
 
216
+What you have to do now is to configure the application and to initialize the database content.
208 217
 
209 218
 ### Create configuration ###
210 219
 
211 220
     cp tracim/development.ini.base tracim/development.ini
212 221
 
213
-#### Database 
222
+You can now edit the file and setup required files. Here are the main ones:
223
+
224
+#### Database access ####
214 225
 
215 226
 Configure database in the development.ini file. This is defined as sqlalchemy.url
216 227
 and the default value is below:
217 228
 
218
-    sqlalchemy.url = postgresql://tracim_user:tracim_user_password@127.0.0.1:5432/tracim
229
+    sqlalchemy.url = postgresql://tracimuser:tracimpassword@127.0.0.1:5432/tracimdb?client_encoding=utf8
219 230
 
220 231
 #### Listening port
221 232
 
@@ -225,12 +236,57 @@ Default configuration is to listen on port 8080. If you want to adapt this to yo
225 236
 
226 237
 #### Interface language
227 238
 
228
-The default language is English. You can change it to french by uncommenting the following line in the .ini file:
239
+The default language is English. You can change it to French by uncommenting the following line in the .ini file:
229 240
 
230 241
     lang = fr
231 242
 
232
-    
233
-### Running Tracim as standalone ###
243
+#### SMTP parameters for resetpassword and notifications
244
+
245
+for some reason, you have to configure SMTP parameters for rest password process and SMTP parameters for notifications in separate places.
246
+
247
+The reset password related parameters are the follwoing ones :
248
+
249
+    resetpassword.email_sender = tracim@mycompany.com
250
+    resetpassword.smtp_host = smtp.mycompany.com
251
+    resetpassword.smtp_port = 25
252
+    resetpassword.smtp_login = username
253
+    resetpassword.smtp_passwd = password
254
+
255
+The main parameters for notifications are the following ones:
256
+
257
+    email.notification.from = Tracim Notification <tracim@tmycompany.com>
258
+    email.notification.smtp.server = smtp.mycompany.com
259
+    email.notification.smtp.port = 25
260
+    email.notification.smtp.user = username
261
+    email.notification.smtp.password = password
262
+
263
+#### Website ####
264
+
265
+You must define general parameters like the base_url and the website title which are required for home page and email notification links
266
+
267
+    website.title = My Company Intranet
268
+    website.base_url = http://intranet.mycompany.com:8080
269
+
270
+#### Other parameters  ####
271
+
272
+There are other parameters which may be of some interest for you. For example, you can:
273
+
274
+* include a JS tracker like Piwik or Google Analytics,
275
+* define your own notification email subject
276
+* personalize notification email
277
+* personalize home page (background image, title color...)
278
+* ...
279
+
280
+### database schema ###
281
+
282
+The last step before to run the application is to initialize the database schema. This is done through the following command:
283
+
284
+    source tg2env/bin/activate
285
+    cd tracim && gearbox setup-app && cd -
286
+
287
+## Running the server ##
288
+
289
+### Running Tracim in standalone mode ###
234 290
 
235 291
 Now you can run the standalone server:
236 292
 
@@ -247,12 +303,11 @@ Which should result in something like this:
247 303
     
248 304
 You can now enter the application at [http://localhost:8080](http://localhost:8080) and login:
249 305
 
250
-* user : admin@localhost
251
-* password : admin
306
+* user : admin@admin.admin
307
+* password : admin@admin.admin
252 308
     
253 309
 Enjoy :)
254 310
 
255
-
256 311
 ### Running Tracim through Apache WSGI ###
257 312
 
258 313
 #### Dependencies ####
@@ -266,26 +321,27 @@ Install dependencies:
266 321
 Example of Apache WSGI configuration. This configuration refers to productionapp.wsgi which is a copy of the file *app.wsgi* available in the repo. (this file has to be updated to match with your environment and installation)
267 322
 
268 323
     <VirtualHost *:80>
269
-        ServerAdmin webmaster@archipeldata.com
270
-        ServerName demo.archipeldata.com
324
+        ServerAdmin webmaster@tracim.mycompany.com
325
+        ServerName tracim.mycompany.com
271 326
 
272 327
         WSGIProcessGroup tracim
273 328
         WSGIDaemonProcess tracim user=www-data group=adm threads=4 python-path=/opt/traciminstall/tg2env/lib/python3.2/site-packages
274 329
         WSGIScriptAlias / /opt/traciminstall/tracim/productionapp.wsgi
275 330
 
276 331
         #Serve static files directly without TurboGears
277
-        Alias /img     /opt/traciminstall/tracim/tracim/public/img/
332
+        Alias /assets     /opt/traciminstall/tracim/tracim/public/assets
278 333
         Alias /favicon.ico /opt/traciminstall/tracim/tracim/public/favicon.ico
279
-        Alias /css        /opt/traciminstall/tracim/tracim/public/css
280
-        Alias /javascript /opt/traciminstall/tracim/tracim/public/javascript
281 334
 
282 335
         CustomLog /var/log/apache2/demotracim-access.log combined
283 336
         ErrorLog /var/log/apache2/demotracim-error.log
284 337
         LogLevel debug
285 338
     </VirtualHost>
286 339
 
287
-### Help required ###
340
+## Support ##
341
+
342
+### Community - Need help ? ###
343
+
344
+Building the community is a work in progress.
288 345
 
289
-If you need help, contact us. If you want to help, contact us. So... contact us ;)
346
+Do not hesitate to contact me : damien.accorsi@free.fr
290 347
 
291
-Damien Accorsi - damien.accorsi@free.fr