HowTo run Redmine with a Mongrel cluster » History » Version 5
  Jerome Warnier, 2010-03-02 12:04 
  Some fixes, nothing new
| 1 | 1 | Craig Truzzi | h1. HowTo run Redmine with a Mongrel cluster | 
|---|---|---|---|
| 2 | 2 | XDjuj Apsulis | |
| 3 | (Debian & French Version, Translation as soon as possible :) ) | ||
| 4 | |||
| 5 | <pre> | ||
| 6 | ### | ||
| 7 | # UTILISER MONGREL ET AUTOMATISER LE LANCEMENT DE REDMINE | ||
| 8 | ### | ||
| 9 | |||
| 10 | *# Nous supposons que notre dossier Redmine est présent à l'adresse /home/svn/redmine/ et qu'il appartient à l'utilisateur USER* | ||
| 11 | 5 | Jerome Warnier | # Il est important de comprendre que Mongrel est un serveur web applicatif (Web Application Server, un peu comme Tomcat pour Java) | 
| 12 | 1 | Craig Truzzi | # On installe Mongrel et son gestionnaire de cluster | 
| 13 | 5 | Jerome Warnier | # Je pense que gem n'est pas nécessaire mais au cas où, pour info : gem install gem_plugin mongrel mongrel_cluster | 
| 14 | 2 | XDjuj Apsulis | apt-get install mongrel mongrel-cluster | 
| 15 | |||
| 16 | # Créons le fichier de configuration pour Redmine | ||
| 17 | # -e production indique que le serveur doit tourner en mode production | ||
| 18 | 1 | Craig Truzzi | # -p 8000 lance Mongrel sur le port 8000 | 
| 19 | # -N 3 indique qu'il y aura 3 instances du serveur | ||
| 20 | 5 | Jerome Warnier | # -c /home/... le chemin vers la racine de Redmine | 
| 21 | 2 | XDjuj Apsulis | # -C /home/... le chemin vers où le fichier de configuration va être créé | 
| 22 | 5 | Jerome Warnier | # -a dit à Mongrel d'écouter seulement sur localhost | 
| 23 | 2 | XDjuj Apsulis | mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /home/svn/redmine -C /home/svn/redmine/config/mongrel_cluster.yml -a 127.0.0.1 --user USER --group www-data | 
| 24 | |||
| 25 | # On fait un lien de ce fichier de conf pour mongrel | ||
| 26 | ln -s /home/svn/redmine/config/mongrel_cluster.yml /etc/mongrel-cluster/sites-enabled/redmine.yml | ||
| 27 | |||
| 28 | # On configure maintenant le script de lancement mongrel-cluster qui doit se trouver dans /etc/init.d/ | ||
| 29 | CONF_DIR=/etc/mongrel-cluster/sites-enabled | ||
| 30 | 1 | Craig Truzzi | PID_DIR=/home/svn/redmine/tmp/pids | 
| 31 | 2 | XDjuj Apsulis | USER=UTILISATEUR_DE_VOTRE_CHOIX | 
| 32 | GROUP=www-data | ||
| 33 | 1 | Craig Truzzi | |
| 34 | 5 | Jerome Warnier | # On ajoute les droits en exécution sur le fichier | 
| 35 | 2 | XDjuj Apsulis | chmod +x /etc/init.d/mongrel-cluster | 
| 36 | |||
| 37 | # On vérifie que le script est bien lancé au démarrage, c'est normalement le cas : | ||
| 38 | 5 | Jerome Warnier | ls /etc/rc2.d/ | grep mongrel | 
| 39 | S20mongrel-cluster | ||
| 40 | 2 | XDjuj Apsulis | |
| 41 | # Sinon on l'ajoute à l'aide de updaterc.d => http://pwet.fr/man/linux/administration_systeme/update_rc_d | ||
| 42 | update-rc.d -f mongrel-cluster defaults | ||
| 43 | |||
| 44 | # On peut maintenant contrôler le serveur : | ||
| 45 | /etc/init.d/mongrel-cluster start | ||
| 46 | /etc/init.d/mongrel-cluster restart | ||
| 47 | /etc/init.d/mongrel-cluster stop | ||
| 48 | |||
| 49 | # On teste que tout fonctionne | ||
| 50 | 1 | Craig Truzzi | /etc/init.d/mongrel-cluster start | 
| 51 | 2 | XDjuj Apsulis | w3m http://127.0.0.1:8000 | 
| 52 | q | ||
| 53 | /etc/init.d/mongrel-cluster stop | ||
| 54 | 1 | Craig Truzzi | w3m http://127.0.0.1:8000 | 
| 55 | 2 | XDjuj Apsulis | q | 
| 56 | |||
| 57 | 5 | Jerome Warnier | # On configure Apache afin de rediriger les requètes vers le cluster mongrel | 
| 58 | # On active les modules nécessaires | ||
| 59 | 2 | XDjuj Apsulis | a2enmod rewrite | 
| 60 | a2enmod proxy_http | ||
| 61 | a2enmod proxy_balancer | ||
| 62 | |||
| 63 | 5 | Jerome Warnier | # On complète le vhost SVN ou on créé un vhost redmine comme suit on peut peut-être faire mieux comme | 
| 64 | 2 | XDjuj Apsulis | # http://www.paolocorti.net/2007/11/08/ruby-on-rails-applications-with-mongrel-clusters-and-apache-on-ubuntu/ | 
| 65 | |||
| 66 | ########### | ||
| 67 | # REDMINE # | ||
| 68 | ########### | ||
| 69 | |||
| 70 | <VirtualHost *:80> | ||
| 71 | ServerAdmin webmaster@domaine.com | ||
| 72 | ServerName redmine.domaine.fr | ||
| 73 | DocumentRoot /home/svn/redmine/public/ | ||
| 74 | |||
| 75 | <Directory /home/svn/redmine/public/> | ||
| 76 | Options Indexes FollowSymLinks MultiViews | ||
| 77 | AllowOverride All | ||
| 78 | Order allow,deny | ||
| 79 | allow from all | ||
| 80 | </Directory> | ||
| 81 | |||
| 82 | # On active les proxy qui sont par défaut désactivés | ||
| 83 | <Proxy *> | ||
| 84 | Order allow,deny | ||
| 85 | Allow from all | ||
| 86 | </Proxy> | ||
| 87 | <Proxy balancer://mongrel_cluster> | ||
| 88 | BalancerMember http://127.0.0.1:8000 | ||
| 89 | BalancerMember http://127.0.0.1:8001 | ||
| 90 | BalancerMember http://127.0.0.1:8002 | ||
| 91 | </Proxy> | ||
| 92 | |||
| 93 | 	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f | ||
| 94 | RewriteRule (.*) $1 [L] | ||
| 95 | |||
| 96 | ProxyPass / Balancer://mongrel_cluster/ | ||
| 97 | ProxyPassReverse / balancer://mongrel_cluster/ | ||
| 98 | |||
| 99 | AddOutputFilter DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css | ||
| 100 | 1 | Craig Truzzi | BrowserMatch ^Mozilla/4 gzip-only-text/html | 
| 101 | 2 | XDjuj Apsulis | BrowserMatch ^Mozilla/4.0[678] no-gzip | 
| 102 | BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | ||
| 103 | 1 | Craig Truzzi | |
| 104 | 2 | XDjuj Apsulis | ErrorLog /home/svn/redmine/logs/apache2/redmine.error.log | 
| 105 | LogLevel warn | ||
| 106 | CustomLog /home/svn/redmine/logs/apache2/redmine.access.log combined | ||
| 107 | ServerSignature Off | ||
| 108 | </VirtualHost> | ||
| 109 | |||
| 110 | 5 | Jerome Warnier | # Ne pas oublier de créer un dossier /logs/apache2 (ici dans le répertoire redmine) | 
| 111 | 2 | XDjuj Apsulis | mkdir -p /home/svn/redmine/logs/apache2 | 
| 112 | |||
| 113 | a2ensite redmine | ||
| 114 | 5 | Jerome Warnier | apache2ctl graceful | 
| 115 | 2 | XDjuj Apsulis | /etc/init.d/mongrel-cluster start | 
| 116 | |||
| 117 | # Il ne reste normalement plus qu'à se logguer (admin/admin) et à configurer la bête ! | ||
| 118 | |||
| 119 | 4 | Alexandre Sabán | ################################### | 
| 120 | 3 | XDjuj Apsulis | # CONFIGURATION DES MAILS SORTANTS # | 
| 121 | #################################### | ||
| 122 | 1 | Craig Truzzi | |
| 123 | 3 | XDjuj Apsulis | # Redmine offre la possibilité d'adresser des notifications sur certains événements (configurables pour chaque projet) | 
| 124 | # Pour ce faire, il convient de configurer le fichier redmine/config/email.yml | ||
| 125 | cd /home/svn/redmine/config | ||
| 126 | cp email.yml.example email.yml | ||
| 127 | pico email.yml | ||
| 128 | production: | ||
| 129 | delivery_method: :smtp | ||
| 130 | smtp_settings: | ||
| 131 | address: localhost | ||
| 132 | port: 25 | ||
| 133 | domain: domaine.com | ||
| 134 | |||
| 135 | sudo /etc/init.d/mongrel-cluster restart | ||
| 136 | |||
| 137 | # | ||
| 138 | # CADEAU BONUX | ||
| 139 | # | ||
| 140 | # On peut également souhaiter bénéficier des services Google afin de gérer l'envoi des mails : | ||
| 141 | 2 | XDjuj Apsulis | cd /home/svn/redmine/ | 
| 142 | 1 | Craig Truzzi | apt-get install git | 
| 143 | 4 | Alexandre Sabán | |
| 144 | # Sur ma Ubuntu 9.10 le paquet git est "git-core": | ||
| 145 | # sudo apt-get install git-core | ||
| 146 | |||
| 147 | 1 | Craig Truzzi | ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git | 
| 148 | |||
| 149 | 2 | XDjuj Apsulis | # Editer le fichier config/email.yml | 
| 150 | 3 | XDjuj Apsulis | cd /home/svn/redmine/config | 
| 151 | cp email.yml.example email.yml | ||
| 152 | pico email.yml | ||
| 153 | 2 | XDjuj Apsulis | production: | 
| 154 | delivery_method: :smtp | ||
| 155 | smtp_settings: | ||
| 156 | tls: true | ||
| 157 | address: "smtp.gmail.com" | ||
| 158 | port: '587' | ||
| 159 | domain: "smtp.gmail.com" | ||
| 160 | authentication: :plain | ||
| 161 | user_name: "votreadresse@gmail.com" | ||
| 162 | password: "votremotdepasse" | ||
| 163 | </pre> |