Projet

Général

Profil

Wiki » Historique » Version 53

Patrice Nadeau, 2014-10-09 07:36

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