Projet

Général

Profil

Wiki » Historique » Version 50

Patrice Nadeau, 2014-10-05 12:19

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