Projet

Général

Profil

Wiki » Historique » Version 46

Patrice Nadeau, 2014-10-05 12:10

1 13 Patrice Nadeau
%{font-size:18pt}Redmine%
2
3
---
4
5 1 Patrice Nadeau
{{toc}}
6
7 13 Patrice Nadeau
h1. Redmine
8 6 Patrice Nadeau
9 31 Patrice Nadeau
Logiciel de gestion de projets, sources, bugs et timeline.
10
Contient un module de Wiki, de fichiers.
11
Supporte aussi les systèmes de version de fichier (Git, SVN entre autre).
12
Disponible à http://www.redmine.org/projects/redmine/wiki/Download
13
14
De base, ne fonctionne pas avec Apache
15
Pour une solution possible, voir : http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine
16
17
Sa principale difficulté d’installation et sa dépendance à Ruby. D’où le but de ce guide.
18
Voir aussi :
19
* http://bitnami.com/stack/redmine
20
* http://www.turnkeylinux.org/redmine
21
22 6 Patrice Nadeau
h1. Installation
23
24 32 Patrice Nadeau
Ce guide documente une installation GNU/Linux avec les version suivantes :
25
* openSUSE 13.1
26
* Redmine 2.4.2
27
28 1 Patrice Nadeau
h2. Prérequis
29
30 44 Patrice Nadeau
Un serveur *LAMP(Linux, Apache, MySQL, PHP)* [[guides_opensuse:|openSUSE]]
31 32 Patrice Nadeau
32 44 Patrice Nadeau
Les logiciels supplémentaires suivants :
33 32 Patrice Nadeau
* libmysqlclient-devel
34
* mysql-community-server
35
* ruby-2.0
36
* ruby20-devel
37
* rubygem-bundler
38
* rubygem-mysql2
39
* rubygem-pg
40
* ImageMagick
41
* ImageMagick-devel
42
* git
43
* gcc
44
* make
45
46
h2. MySQL
47
48
Ajout au démarrage automatique et démarrage du service :
49
<pre><code class="bash">
50
chkconfig -a mysql
51
rcmysql start
52
</code></pre>
53
54
Création de la base de donnés.
55
Substituer les items suivants à votre choix :
56
* redmine : Usager pour la base de donnés.
57
* password : Mot de passe de la base de donnees.
58
* db : Nom de la base de donnés.
59
60
Lancer MySQL :
61
<pre><code class="bash">
62
mysql -u root -p
63
</code></pre>
64
65
Commandes MySQL :
66
<pre><code class="sql">
67
create database db character set utf8;
68
create user 'redmine'@'localhost' identified by 'password';
69
grant all privileges on db.* to 'redmine'@'localhost';
70
commit;
71
quit;
72
</code></pre>
73
74 33 Patrice Nadeau
h2. Redmine
75 13 Patrice Nadeau
76 33 Patrice Nadeau
L’installation sera faite dans _\srv\redmine_
77
<pre><code class="bash">
78
cd /srv/
79
svn co http://svn.redmine.org/redmine/branches/2.4-stable redmine
80
cd redmine
81
cp config/database.yml.example config/database.yml
82
cp config/configuration.yml.example config/configuration.yml
83
mkdir public/plugin_assets
84
</code></pre>
85
86
Si un usager MySQL autre que _root_ ou mot de passe diffèrent est utilisé :
87
Éditer le fichier *config/database.yml*, section *Production* et modifier les lignes :
88
* *username*
89
* *password*
90
91
Éditer le fichier _config/configuration.yml_ et modifier la configuration SMTP.
92
93
h2. Ruby
94
95 34 Patrice Nadeau
Installation des gems de Ruby
96 1 Patrice Nadeau
<pre><code class="bash">
97 34 Patrice Nadeau
cd redmine
98
gem install bundler
99
gem install activerecord-mysql2-adapter
100
bundle install --without development test
101 1 Patrice Nadeau
</code></pre>
102 34 Patrice Nadeau
103
h2. Initialisation
104
105
Création de la cryptographie, de la structure et des donnés de base :
106
<pre><code class="bash">
107
cd /srv/redmine
108
rake generate_secret_token
109
RAILS_ENV=production rake db:migrate
110
RAILS_ENV=production rake redmine:load_default_data
111
</code></pre>
112
113
Ouvrir dans le pare-feu :
114
* TCP : 3000
115
116
Lancer le serveur web (test)
117
<pre><code class="bash">
118
cd /srv/redmine
119
ruby script/rails server webrick -e production
120
</code></pre>
121
122
A partir d’un navigateur web, se brancher à http://server:3000.
123
Utiliser l’usager *admin* avec le mot de passe *admin*.
124
Vérifier la configuration dans *Administration*, *Information*.
125 16 Patrice Nadeau
126 35 Patrice Nadeau
h2. Transformation en daemon
127
128
Le script original vient de http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_openSUSE
129
Copier le script dans le fichier */etc/init.d/redmine*
130
131
Le modifier de la manière suivante :
132
* REDMINE_BIN=/srv/redmine/current/script/rails
133
* REDMINE_USER=user
134
* Corriger le «typo» à la ligne 73 : $REDMI-NE_BIN -> $REDMINE_BIN
135
* Dans la section stop, après la ligne killproc, ajouter *rm $PIDFILE*
136
137
Rendre le fichier exécutable, l’ajouter aux services SUSE et l’exécuter au démarrage :
138
<pre><code class="bash">
139
chmod 0755 /etc/init.d/redmine
140
cp -s /etc/init.d/redmine /usr/bin/rcredmine
141
chkconfig -a redmine
142
</code></pre>
143
144 45 Patrice Nadeau
h1. Apache
145
146
> En test, voir #23
147
148
Transformation pour utilisation avec Apache.
149
* N'utilise pas _webrick_
150
* Accessible par le port 80 au lieu de 3000
151
152
Information provenant de :
153
* web : http://martin-denizet.com/install-redmine-2-5-x-with-git-and-subversion-on-debian-with-apache2-rvm-and-passenger/
154
* livre : "Mastering Redmine":http://shop.oreilly.com/product/9781849519144.do
155
156 46 Patrice Nadeau
h2. Modules Apache
157
158
Ajout
159 45 Patrice Nadeau
<pre><code class="bash">
160
zypper install libcurl-devel apache2-devel apache2-mod_perl perl-Apache-DBI 
161
</code></pre>
162
163
Activation des modules Apache
164
<pre><code class="bash">
165
a2enmod ssl
166
a2enmod perl
167
a2enmod dav
168
a2enmod dav_svn
169
a2enmod dav_fs
170
a2enmod rewrite
171
a2enmod headers
172 1 Patrice Nadeau
</code></pre>
173
174 46 Patrice Nadeau
h2. Modules _Passenger_
175
176 45 Patrice Nadeau
<pre><code class="bash">
177
cd /srv/redmine
178
gem install passenger
179
passenger-install-apache2-module2.0
180 1 Patrice Nadeau
</code></pre>
181
182 46 Patrice Nadeau
h2. Activation de la configuration
183
184 45 Patrice Nadeau
<pre><code class="bash">
185
systemctl reload apache2
186 1 Patrice Nadeau
</code></pre>
187 45 Patrice Nadeau
188
Note
189 46 Patrice Nadeau
> Donne une message d'erreur que le module _dav_svn_ n'est pas installé
190 45 Patrice Nadeau
191
Ajouter dans _/etc/apache2/conf.d/passenger.conf_
192
<pre><code class="bash">
193
LoadModule passenger_module /usr/lib64/ruby/gems/2.0.0/gems/passenger-4.0.49/buildout/apache2/mod_passenger.so
194
<IfModule mod_passenger.c>
195
  PassengerRoot /usr/lib64/ruby/gems/2.0.0/gems/passenger-4.0.49
196
  PassengerDefaultRuby /usr/bin/ruby2.0
197
</IfModule>
198
</code></pre>
199
200
Ajouter dans _/etc/apache2/vhosts.d/vhost.conf_
201
<pre><code class="bash">
202
<VirtualHost *:80>
203
    ServerName redmine.yourdomain.com
204
    DocumentRoot /srv/redmine/public
205
206
    RailsEnv production
207
    RailsBaseURI /redmine
208
209
    <Directory "/srv/redmine/public">
210
        Options Indexes ExecCGI FollowSymLinks
211
        AllowOverride None
212
        Order deny,allow
213
        Allow from all
214
    </Directory>
215
</VirtualHost>
216
</code></pre>
217
218
Vérifier la configuration
219
> Plugin assets directory writable
220
221 29 Patrice Nadeau
h1. Personnalisation
222 8 Patrice Nadeau
223 36 Patrice Nadeau
h2. Ajout d’un logo
224
225
Les informations viennent de : http://www.redmine.org/projects/redmine/wiki/Howto_add_a_logo_to_your_Redmine_banner
226
227
Copier le logo dans _/srv/redmine/public/images/logo.png_
228 1 Patrice Nadeau
229 37 Patrice Nadeau
Modifier le fichier _/srv/redmine/app/views/layout/base.rhtml.erb_
230
* Ajouter la ligne 
231 1 Patrice Nadeau
<pre><code class="ruby">
232 37 Patrice Nadeau
<img src="<%= Redmine::Utils.relative_url_root %>/images/logo.png" style="top-margin: 15px; left-margin: 15px;"/>
233
</code></pre>
234
* Si on ne veux plus afficher le titre, mettre en commentaire :
235
<pre><code class="ruby">
236 1 Patrice Nadeau
<!--<h1><%= page_header_title %></h1>-->
237 37 Patrice Nadeau
</code></pre>
238
239
Redémarrer Redmine
240
<pre><code class="bash">
241
rcredmine restart
242 36 Patrice Nadeau
</code></pre>
243
244 1 Patrice Nadeau
h2. Plugins
245
246 38 Patrice Nadeau
h3. Extended Fields
247
248
Permet de créer de nouveau champ dans la basse de donnés.
249
250
http://www.redmine.org/plugins/extended_fields
251
252
Installation : 
253
<pre><code class="bash">
254
cd /srv/redmine
255
svn co http://svn.s-andy.com/extended-fields plugins/extended_fields
256
rake redmine:plugins:migrate RAILS_ENV=production
257
rcredmine restart
258
</code></pre>
259
260 4 Patrice Nadeau
h3. Redmine Rouge
261 12 Patrice Nadeau
262 1 Patrice Nadeau
Permet le support de langage supplémentaire pour l'affichage de la syntaxe d'un code source.
263 4 Patrice Nadeau
264 13 Patrice Nadeau
"Langage supporté":http://rouge.jayferd.us/demo
265 1 Patrice Nadeau
266
https://github.com/ngyuki/redmine_rouge
267
268
<pre>
269
<code class="bash">
270
cd /srv/redmine/plugins
271
git clone https://github.com/ngyuki/redmine_rouge.git
272
cd ..
273
bundle install
274 2 Patrice Nadeau
# Relancer redmine
275
rcredmine restart
276 1 Patrice Nadeau
</code>
277
</pre>
278 5 Patrice Nadeau
279 22 Patrice Nadeau
h3. Code Highlight
280 9 Patrice Nadeau
281 10 Patrice Nadeau
http://www.redmine.org/plugins/codehightlight_button
282 9 Patrice Nadeau
283
Bouton permettant de sélectionner du code et d'activer la syntaxe selon un langage.
284 11 Patrice Nadeau
>Ne fonctionne pas pour les langages supplémentaires supportées par le « plug-in » _Redmine Rouge_. Voir "ici":https://github.com/mediatainment/redmine_codebutton/issues/2
285 9 Patrice Nadeau
286 1 Patrice Nadeau
Installation
287
<pre><code class="bash">
288 10 Patrice Nadeau
cd /srv/redmine/plugins
289
git clone https://github.com/mediatainment/redmine_codebutton.git
290
cd ..
291
rake redmine:plugins
292 9 Patrice Nadeau
rake redmine:plugins:migrate RAILS_ENV=production
293 10 Patrice Nadeau
# Relancer Redmine
294 1 Patrice Nadeau
rcredmine restart
295
</code></pre>
296 11 Patrice Nadeau
297 23 Patrice Nadeau
h3. Redmine Issue Checklist
298 11 Patrice Nadeau
299
Extends issues to store checklist items
300
301
http://redminecrm.com/projects/checklist
302
303
Installation
304
<pre><code class="bash">
305
cd /srv/redmine/plugins
306
wget http://redminecrm.com/license_manager/4200/redmine_issue_checklist-2_0_5.zip
307
unzip redmine_issue_checklist-2_0_5.zip
308
bundle exec rake redmine:plugins NAME=redmine_issue_checklist RAILS_ENV=production
309
# Relancer Redmine
310
rcredmine restart
311
</code></pre>
312
313
Configuration
314
Dans *Administration*
315
* *Plugins*
316
** Choisir les options voulues
317
* *Roles and permissions*
318
** Choisir le rôle
319
Donner les droits voulus sur :
320
*** Done checklist items 
321
*** Edit checklist items 
322 14 Patrice Nadeau
*** View checklist
323 1 Patrice Nadeau
324 24 Patrice Nadeau
h3. Redmine People
325
326 29 Patrice Nadeau
> A faire
327 24 Patrice Nadeau
328 20 Patrice Nadeau
h3. WikiNG
329 1 Patrice Nadeau
330 20 Patrice Nadeau
Personnalisation des items dans le wiki.
331 28 Patrice Nadeau
Ajoute des boutons et des icônes comme FIXME et TODO.
332 29 Patrice Nadeau
> « Écrase » le bouton installé par _Code Highlight_
333 21 Patrice Nadeau
334
Installation
335 27 Patrice Nadeau
<pre><code class="bash">
336 26 Patrice Nadeau
cd /srv/redmine
337
wget http://projects.andriylesyuk.com/attachments/download/564/wiking-1.0.0b.tar.bz2
338
tar xvf wiking-1.0.0b.tar.bz2
339
mv wiking plugins
340
rake redmine:plugins:migrate RAILS_ENV=production
341
# restart Redmine
342
rcredmine restart
343
</code></pre>
344 20 Patrice Nadeau
345 14 Patrice Nadeau
h1. Mise à jour
346 1 Patrice Nadeau
347 14 Patrice Nadeau
S’assurer d'avoir les dernières versions des plugins.
348 9 Patrice Nadeau
349 41 Patrice Nadeau
Disponible a http://www.redmine.org/projects/redmine/wiki/Download 
350
351
Mise à jour de Redmine à partir de SVN (dernière version)
352
353
Vérifier la version pointée par SVN
354
<pre><code class="bash">
355
svn info
356
</code></pre>
357
358
Si ne pointe pas sur la bonne, faire le changement :
359
<pre><code class="bash">
360
svn switch http://svn.redmine.org/redmine/branches/2.4-stable
361
</code></pre>
362
363
Faire la mise à jour :
364
<pre><code class="bash">
365
svn update
366
</code></pre>
367
368
Installation des «gem» de Ruby.
369
>Vérifier la version de _rubygem-mysql2_ et modifier le fichier *Gemfile* pour la même version.
370
371
<pre><code class="bash">
372
cd /srv/redmine
373
rm -r /usr/lib64/ruby/gems/*
374
zypper rm rubygem-mysql2
375
zypper in rubygem-mysql2
376
gem install bundler
377
gem install activerecord-mysql2-adapter
378
bundle install --without development test
379
</code></pre>
380
381
Mise à jour (base de donnés, « plugins ») et ménage :
382
<pre><code class="bash">
383
rake db:migrate RAILS_ENV=production
384
rake redmine:plugins:migrate RAILS_ENV=production
385
rake tmp:cache:clear
386
rake tmp:sessions:clear
387
rcredmine restart
388
</code></pre>
389
390 14 Patrice Nadeau
h1. Copie de sécurité
391 5 Patrice Nadeau
392 40 Patrice Nadeau
Remplacer les items suivants :
393
* *username* : Usager de la base de donnés.
394
* *password* : Mot de passe de la base de donnés.
395
* *database* : Nom de la base de données.
396
* *path* : Emplacement pour recevoir le fichier.
397
398
<pre><code class="bash">
399
/usr/bin/mysqldump -u username -p password database | gzip > /path/redmine_`date +%y_%m_%d`.gz
400
rsync -a /srv/redmine/files /path/
401
</code></pre>
402
403
Script un peu plus evolué :
404 5 Patrice Nadeau
<pre> <code class="bash">
405 42 Patrice Nadeau
406 5 Patrice Nadeau
#!/bin/bash
407
#
408
# backup_redmine.sh
409
# Backup of a Redmine setup
410 1 Patrice Nadeau
# Last Changes: 2013-02-23
411 40 Patrice Nadeau
# Maintainer: Patrice Nadeau  <pnadeau@patricenadeau.com>
412 5 Patrice Nadeau
413
# TODO Verify the results (folder exist, enough disk pace , etc..)
414
415
## The only variable needed to be changed
416
# Directory of the Redmine install
417
declare -r RAIL_ROOT='/srv/redmine'
418
# MySQL database
419
declare -r MYSQL_DB=''
420
# MySQL username for the Redemine db
421
declare -r MYSQL_USER=''
422
# MySQL password for the Redemine db
423
declare -r MYSQL_PASSWORD=''
424
# Directory for the backup (must exist and with no space in the name)
425
declare -r DIR='/root'
426
## end
427
428
# Exit level
429
declare -ir EXIT_OK=0
430
declare -ir EXIT_WARNING=1
431
declare -ir EXIT_ERROR=2
432
433
declare -i STATUS=$EXIT_OK
434
435
# The directory inside the archive 
436
declare -r REDMINE='redmine'
437
TMP_DIR=$DIR/$REDMINE
438
439
# This will be used for the archive file 
440
declare -r DST=$DIR/redmine_$(date +%Y%m%d_%H%M%S).tar.gz
441
442
# The temporary sql file
443
declare -r TMP_MYSQL=$TMP_DIR/$MYSQL_DB.mysql
444
445
echo "Backup in progress in $DST"
446
447
#### Create the temp directory ####
448
mkdir $TMP_DIR
449
450
#### backup MySQL ####
451
if [ $STATUS -eq $EXIT_OK ] 
452
then
453
	STEP='Creating MySQL backup'
454
	mysqldump --user=$MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DB \
455
		> $TMP_MYSQL
456
	STATUS=$?
457
fi
458
459
#### backup the Redmine folder ####
460
if [ $STATUS -eq $EXIT_OK ] 
461
then
462
	STEP='Creating Redmine'"'"' files backup'
463
	cp --recursive $RAIL_ROOT $TMP_DIR
464
	STATUS=$?
465
fi
466
467
#### create the archive file ####
468
if [ $STATUS -eq $EXIT_OK ] 
469
then
470
	STEP="Creating archive"
471
	tar --create --gzip --file $DST --directory=$DIR $REDMINE
472
	STATUS=$?
473
fi
474
475
#### cleanup ####
476
if [ $STATUS -eq $EXIT_OK ] 
477
then
478
	STEP='Cleaning up'
479
	rm --recursive --force $TMP_DIR
480
	STATUS=$?
481
fi
482
483
#### exit ####
484
if [ $STATUS -eq $EXIT_OK ] 
485
then
486
	echo "Backup done"
487
else
488
	echo "Bakup failed with error code $STATUS in step $STEP"
489
fi
490
491
492
exit $STATUS
493
494
</code></pre>
495 39 Patrice Nadeau
496
h1. Dépannage
497
498
h2. Mot de passe perdu
499
500
Le mot de passe admin par défaut est en _hash Sha1_ : *da3174755c5e82a436b6c7ff87c873ee50d6654b* et est *admin.*
501
502
h2. Le service tombe « DEAD » a chaque fois
503
504
Effacer le fichier _/srv/redmine/tmp/pids/server.pid_.