Eolisation de l'applicatif MSE
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

61-pve 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. function synchroHost()
  3. {
  4. local hst=${1}
  5. local WORKDIR=${2}
  6. echo "#### Working on ${hst}"
  7. local cmd="cd ${WORKDIR};"
  8. echo "#### Synchro MSE"
  9. rsync -e ssh -av \
  10. --exclude="app/aglae/*" \
  11. --exclude="app/cache" \
  12. --exclude="app/doc" \
  13. --exclude="app/DoctrineMigrations" \
  14. --exclude="app/izly" \
  15. --exclude="app/logs" \
  16. --exclude="app/uploads" \
  17. --exclude="app/webservices" \
  18. --exclude="components" \
  19. --exclude="certs" \
  20. --exclude="dist" \
  21. --exclude="patch" \
  22. --exclude="scripts" \
  23. /var/www/html/mse/ root@${hst}:/var/www/html/mse/
  24. echo "#### Synchro Apache"
  25. rsync -e ssh -av \
  26. --include="mse.conf" \
  27. /etc/apache2/sites-available/ root@${hst}:/etc/apache2/sites-available/
  28. echo "#### Synchro Apache MPM"
  29. rsync -e ssh -av \
  30. --include="mpm_worker.conf" \
  31. /etc/apache2/mods-available/ root@${hst}:/etc/apache2/mods-available/
  32. echo "#### Synchro PHP-FPM"
  33. rsync -e ssh -av \
  34. --include="php.ini" \
  35. --include="pool.d" \
  36. --include="pool.d/mse.conf" \
  37. /etc/php5/fpm/ root@${hst}:/etc/php5/fpm/
  38. # Nettoyage du cache
  39. cmd="${cmd} rm -rf ${WORKDIR}/app/cache/*;"
  40. cmd="${cmd} php -r \"apc_clear_cache(); apc_clear_cache('user'); apc_clear_cache('opcode');\";"
  41. # Warm up du cache
  42. cmd="${cmd} php app/console cache:warmup --env=prod --no-debug;"
  43. # Réinitialisation des droits
  44. cmd="${cmd} mkdir -p app/{aglae,doc,DoctrineMigration,izly,cache,logs,spool,webservices,uploads};"
  45. cmd="${cmd} mkdir -p {components,certs,dist,patch,scripts};"
  46. cmd="${cmd} chown -R :www-data app/{cache,logs,spool,webservices};"
  47. cmd="${cmd} chmod -R g+rw app/{cache,logs,spool,webservices};"
  48. # Activation mods apache
  49. cmd="${cmd} a2dismod mpm_event;"
  50. cmd="${cmd} a2enmod mpm_worker;"
  51. apacheMods="proxy_fcgi rewrite expires"
  52. for mod in ${apacheMods}
  53. do
  54. cmd="${cmd} a2enmod ${mod};"
  55. done
  56. # Redémarrage service apache
  57. cmd="${cmd} a2ensite mse;"
  58. cmd="${cmd} service php5-fpm restart;"
  59. cmd="${cmd} service apache2 restart;"
  60. ssh ${hst} "${cmd}"
  61. echo "### Work on ${HOST} DONE"
  62. }
  63. chmod +x /var/www/html/mse/scripts/scribe-post-install.sh
  64. CreoleRun "/var/www/html/mse/scripts/scribe-post-install.sh" web
  65. LOGFILE=/var/log/eole/mse-sync.log
  66. if [[ -e ${LOGFILE} ]]
  67. then
  68. [[ -e ${LOGFILE}.bck ]] && rm ${LOGFILE}.bck
  69. mv ${LOGFILE} ${LOGFILE}.bck
  70. fi
  71. WORKDIR="/var/www/html/mse"
  72. childs=""
  73. for worker in $(CreoleGet mseSlaves)
  74. do
  75. synchroHost ${worker} ${WORKDIR} 2>&1 >> /var/log/eole/mse-sync.log &
  76. childs+="${worker}:${!} "
  77. done
  78. for child in ${childs}
  79. do
  80. name=${child%:*}
  81. pid=${child#*:}
  82. while [[ -d /proc/${pid} ]]
  83. do
  84. sleep 1
  85. done
  86. echo Worker ${name} sync done
  87. done