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