Il y a 389 articles et 19 utilisateurs inscrits (ce bandeau est défini dans MediaWiki:Sitenotice)
Doc/Odysseo
Serveur
Serveur #1
- Debian 6.0 (Squeeze) .
- système 64 bits.
- L'adresse IP du serveur est : 176.31.229.74
- Le nom du serveur est : ns226259.ovh.net
Serveur #2
- Debian 6.0 (Squeeze) .
- système 64 bits.
- L'adresse IP du serveur est : 91.121.108.165
- Le nom du serveur est : ks200294.kimsufi.com
Logiciels
Résolutions de problèmes courants
Le serveur Apache Tomcat à parfois du mal à redémarrer, il suffit de le relancer :
Hypothèse: mauvaise compréhension/utilisation des opérateurs Bash &&. En effet le cron actuel est le suivant :
0 6 * * * /bin/sh /opt/tomcat6/bin/shutdown.sh && /bin/rm -rf /opt/tomcat6/temp/* /opt/tomcat6/work/* && /bin/sh /opt/tomcat6/bin/startup.sh
Ce qui peut amener à des cas où le redémarrage ne se fait pas: si une des commandes avant '/opt/tomcat6/bin/startup.sh' a un code retour différent de 0 :
- pour des explications, voir : Bash Pitfalls#22
- pour une solutions on utilisera l'approche décrite dans Tomcat#Tâche cron journalière de redémarrage.
/opt/tomcat6/bin/catalina.sh start
Points de montage
Liens symboliques
Sauvegardes
Crontab
Expiration des sauvegardes
Tomcat
Suite à des problèmes avec le tomcat (et le serveur étends du Debian), nous décidons de mettre en place plusieurs instance de tomcat pour servir les deux applications (prod et pre-prod
Localisation des serveur
| Description | Production | Recettage |
|---|---|---|
| Emplacement | "$AJLSM_HOME"/server/tomcat6-prod | "$AJLSM_HOME"/server/tomcat6-pre-prod |
| Commande | tomcat6-instance-create /home/ajlsm/server/tomcat6-prod
|
tomcat6-instance-create -p 9090 -c 9005 /home/ajlsm/server/tomcat6-pre-prod
|
| Ports | class="wikitable sortable" | |
| Type de Port | Numéro | |
| arrêt | 8005 | |
| écoute (connecteur HTTP) | 8080 | |
| redirection (connecteur HTTP) | 8443 | |
| écoute (connecteur AJP/1.3) | 8009 | |
| redirection (connecteur AJP/1.3) | 8443 |
|| {| class="wikitable sortable"
|- ! Type de Port !! Numéro |- | arrêt || 9005 |- | écoute (connecteur HTTP) || 9090 |- | redirection (connecteur HTTP) || 9443 |- | écoute (connecteur AJP/1.3) || 9009 |- | redirection (connecteur AJP/1.3) || 9443 |- |} |- |}
Liens vers l'application
| Production | Recettage |
|---|---|
ln -s webapps/current-pleade server/tomcat6-prod/webapps/odysseo
|
ln -s webapps/current-pleade-pprod server/tomcat6-pre-prod/webapps/odysseo_pprod
|
Configuration du serveur : server.xml
| Production | Recettage |
|---|---|
<Connector port="8009" protocol="AJP/1.3"
redirectPort="8443"
emptySessionPath="true"
/>
|
<Connector port="9009" protocol="AJP/1.3"
redirectPort="9443"
emptySessionPath="true"
/>
|
Virtual Host Httpd
| Production | Recettage |
|---|---|
ProxyPass /pprod/ ajp://localhost:8009/odysseo_pprod/
ProxyPassReverse /pprod/ ajp://localhost:8009/odysseo_pprod/
|
ProxyPass /pprod/ ajp://localhost:9009/odysseo_pprod/
ProxyPassReverse /pprod/ ajp://localhost:9009/odysseo_pprod/
|
Allocation de mémoire
Scripts et redémarrage automatique
| Production | Recettage |
|---|---|
#!/bin/bash
"$AJLSM_HOME"/server/tomcat6-prod/bin/shutdown.sh
rm -rf "$AJLSM_HOME"/server/tomcat6-prod/temp/* "$AJLSM_HOME"/server/tomcat6-prod/work/*
"$AJLSM_HOME"/server/tomcat6-prod/bin/startup.sh
|
#!/bin/bash
"$AJLSM_HOME"/server/tomcat6-pre-prod/bin/shutdown.sh
rm -rf "$AJLSM_HOME"/server/tomcat6-pre-prod/temp/* "$AJLSM_HOME"/server/tomcat6-pre-prod/work/*
"$AJLSM_HOME"/server/tomcat6-pre-prod/bin/startup.sh
|
cp restartProd.sh restartPreProd.sh
perl -i -p -e 's/-prod/-pre-prod/g' restartPreProd.sh
chmod u+x ./restartPr*
Arrêt
Apache
De façon à séparer autant que possible les deux applications, on va configurer les deux applications sur des ports différents.
| Description | Production | Recettage |
|---|---|---|
| Port d'écoute | 80 | 90 |
Port d'écoute
L'application de pré-prod étant configurer pour travailler avec le port 90, il faut préciser à httpd d'écouter celui-ci. Pour cela, on va éditer le fichier /etc/apache2/ports.conf :
NameVirtualHost *:90
Listen 90
Production
<VirtualHost *:80>
Servername odysseo.generiques.org
ServerAlias odysseo.ajlsm.com odysseo.org odysseo.net odysseo.com
Alias /robots.txt /home/odysseo/pleade/robots.txt
Alias /aj_ap/ /home/odysseo/php/
Alias /aj_ap_pprod/ /home/odysseo/php_pprod/
Proxypass /pprod/ !
ProxyPass /awstats/ !
ProxyPass /awstatsclasses !
ProxyPass /awstatsicons !
ProxyPass /awstatscss !
ProxyPass /robots.txt !
ProxyPass /munin !
ProxyPass /cacti !
ProxyPass /aj_ap/ !
ProxyPass /aj_ap_pprod/ !
#ProxyPass /tzav/ ajp://localhost:8009/odysseo_tzav/
#ProxyPassReverse /tzav/ ajp://localhost:8009/odysseo_tzav/
# Redirection vers l'application de recette/pré-prod
RedirectPermanent /pprod/ http://odysseo.org:90/pprod/
ProxyPass / ajp://localhost:8009/odysseo/
ProxyPassReverse / ajp://localhost:8009/odysseo/
ErrorLog ${APACHE_LOG_DIR}/error-prod.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access-prod.log combined
</VirtualHost>
Pré-production
<VirtualHost *:90>
Servername odysseo.generiques.org
ServerAlias odysseo.ajlsm.com odysseo.org odysseo.net odysseo.com
Alias /robots.txt /home/odysseo/pleade/robots.txt
Alias /aj_ap/ /home/odysseo/php/
Alias /aj_ap_pprod/ /home/odysseo/php_pprod/
ProxyPass /awstats/ !
ProxyPass /awstatsclasses !
ProxyPass /awstatsicons !
ProxyPass /awstatscss !
ProxyPass /robots.txt !
ProxyPass /munin !
ProxyPass /cacti !
ProxyPass /aj_ap/ !
ProxyPass /aj_ap_pprod/ !
#ProxyPass /tzav/ ajp://localhost:9009/odysseo_tzav/
#ProxyPassReverse /tzav/ ajp://localhost:9009/odysseo_tzav/
<Location /pprod>
AuthType Basic
AuthName "Entrez vos identifiants"
AuthUserFile /home/odysseo/.htpasswd_pprod
AuthGroupFile /dev/null
Require valid-user
</Location>
ProxyPass /pprod/ ajp://localhost:9009/odysseo_pprod/
ProxyPassReverse /pprod/ ajp://localhost:9009/odysseo_pprod/
ErrorLog ${APACHE_LOG_DIR}/error-pre-prod.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access-pre-prod.log combined
</VirtualHost>