<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>William&#039;s Blog &#187; Sysadmin</title> <atom:link href="http://www.willdurand.fr/category/sysadmin/feed/" rel="self" type="application/rss+xml" /><link>http://www.willdurand.fr</link> <description>Développeur web indépendant, étudiant et passionné ! #Symfony2 #Rails #Diem #Git #Nginx #WebPerfs #SoftwareQuality</description> <lastBuildDate>Thu, 20 Oct 2011 14:59:05 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Mise en place d&#8217;un serveur Git over HTTP</title><link>http://www.willdurand.fr/mise-en-place-dun-serveur-git-over-http/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mise-en-place-dun-serveur-git-over-http</link> <comments>http://www.willdurand.fr/mise-en-place-dun-serveur-git-over-http/#comments</comments> <pubDate>Wed, 23 Feb 2011 20:44:44 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Boulot]]></category> <category><![CDATA[Sysadmin]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=819</guid> <description><![CDATA[Bonjour, Cela fait longtemps que je n&#8217;ai pas écrit ici. En fait, je partage mes récentes aventures sur le blog de ma société Bazinga. Dernier article en date sur la mise en oeuvre d&#8217;un serveur Git accessible via HTTP : http://www.bazingaweb.fr/blog/fr/mise-en-place-d-un-serveur-git-over-http. Enjoy Related Posts No Related Posts]]></description> <content:encoded><![CDATA[<p>Bonjour,</p><p>Cela fait longtemps que je n&#8217;ai pas écrit ici. En fait, je partage mes récentes aventures sur le blog de ma société <strong><a
href="http://www.bazingaweb.fr/">Bazinga</a></strong>.</p><p><strong></strong>Dernier article en date sur la mise en oeuvre d&#8217;un serveur Git accessible via HTTP : <a
href="http://www.bazingaweb.fr/blog/fr/mise-en-place-d-un-serveur-git-over-http">http://www.bazingaweb.fr/blog/fr/mise-en-place-d-un-serveur-git-over-http</a>.</p><p>Enjoy <img
src='http://www.willdurand.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li>No Related Posts</li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;bodytext=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;notes=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;t=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;annotation=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;t=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;body=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&title=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fmise-en-place-dun-serveur-git-over-http%2F&amp;submitHeadline=Mise%20en%20place%20d%27un%20serveur%20Git%20over%20HTTP&amp;submitSummary=Bonjour%2C%0D%0A%0D%0ACela%20fait%20longtemps%20que%20je%20n%27ai%20pas%20%C3%A9crit%20ici.%20En%20fait%2C%20je%20partage%20mes%20r%C3%A9centes%20aventures%20sur%20le%20blog%20de%20ma%20soci%C3%A9t%C3%A9%20Bazinga.%0D%0A%0D%0ADernier%20article%20en%20date%20sur%20la%20mise%20en%20oeuvre%20d%27un%20serveur%20Git%20accessible%20via%20HTTP%20%3A%C2%A0http%3A%2F%2Fwww.bazingawe&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/mise-en-place-dun-serveur-git-over-http/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Réplication MySQL maître-esclave</title><link>http://www.willdurand.fr/replication-mysql-maitre-esclave/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=replication-mysql-maitre-esclave</link> <comments>http://www.willdurand.fr/replication-mysql-maitre-esclave/#comments</comments> <pubDate>Fri, 20 Aug 2010 14:10:36 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Boulot]]></category> <category><![CDATA[Serveur]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[base de données]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Réplication]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=592</guid> <description><![CDATA[Bonjour, je laisse ici une petite note d&#8217;un système de secours que j&#8217;ai mis en place récemment : la réplication de bases de données MySQL. Il y a beaucoup d&#8217;autres articles sur le sujet donc je ne m&#8217;y étendrai pas, seul petite différence, j&#8217;ai fait la réplication d&#8217;une base de prod vers un autre serveur [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Bonjour, je laisse ici une petite note d&#8217;un système de secours que j&#8217;ai mis en place récemment :<strong> la réplication de bases de données MySQL</strong>. Il y a beaucoup d&#8217;autres articles sur le sujet donc je ne m&#8217;y étendrai pas, seul petite différence, j&#8217;ai fait la réplication d&#8217;une base de prod vers un autre serveur de prod utilisé pour tout à fait autre chose (<em>ie.</em> contenant d&#8217;autres bases). C&#8217;est l&#8217;essentiel de mon article d&#8217;aujourd&#8217;hui. Je remercie <a
href="http://twitter.com/n_vogel">Nicolas Vogel</a> de m&#8217;avoir mis sur le bon chemin <img
src='http://www.willdurand.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">La réplication en place me permet de sauvegarder les données contenues de <span
style="text-decoration: underline;">manière instantanée</span>. Si un crash est détecté au niveau du serveur de prod, d&#8217;une part il y a fort à parier que, peu voire aucune donnée n&#8217;aura été perdue (l&#8217;application est déployée sur un serveur unique), et d&#8217;autre part, je pourrais lancer un <span
style="text-decoration: underline;">système de secours</span> sur le serveur &laquo;&nbsp;<em>esclave</em>&laquo;&nbsp;.</p><p
style="text-align: justify;">Voilà ce qu&#8217;il y avait à lire : <a
href="http://dev.mysql.com/doc/refman/5.0/fr/replication-howto.html">http://dev.mysql.com/doc/refman/5.0/fr/replication-howto.html</a></p><p
style="text-align: justify;">Et pour résumer :</p><p
style="text-align: justify;">On commence par la partie <em>Maître</em>, c&#8217;est-à-dire le serveur de prod numéro 1. On modifie le fichier de configuration <em>/etc/mysql/my.cnf</em> de la manière suivante (on veillera à relancer le service <strong>mysql</strong>) :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #7a0874; font-weight: bold;">&#91;</span>mysqld<span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> bind-address&nbsp; = IP serveur maître<br
/> server-id &nbsp; &nbsp; = <span
style="color: #000000;">1</span><br
/> log_bin &nbsp; &nbsp; &nbsp; = <span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>log<span
style="color: #000000; font-weight: bold;">/</span>mysql<span
style="color: #000000; font-weight: bold;">/</span>mysql-bin.log<br
/> <span
style="color: #666666; font-style: italic;"># Dans mon cas, c'est la ligne suivante qui spécifie quelle base répliquer</span><br
/> binlog_do_db&nbsp; = databaseName</div></div><p
style="text-align: justify;">﻿﻿﻿</p><p
style="text-align: justify;">Une fois ceci fait on crée un utilisateur &laquo;&nbsp;<em>replicateur</em>&nbsp;&raquo; pour le deuxième serveur (l&#8217;esclave) :</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">GRANT</span> REPLICATION SLAVE <span
style="color: #993333; font-weight: bold;">ON</span> <span
style="color: #66cc66;">*.*</span> <span
style="color: #993333; font-weight: bold;">TO</span> replicateur@<span
style="color: #ff0000;">'%'</span> <span
style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span
style="color: #993333; font-weight: bold;">BY</span> <span
style="color: #ff0000;">'replicateur'</span>;</div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">On va devoir s&#8217;assurer qu&#8217;aucune nouvelle donnée ne soit enregistrée pendant un petit laps de temps. Cette partie est critique puisque il s&#8217;agit de <strong>bloquer l&#8217;écriture</strong> sur la base que l&#8217;on souhaite répliquer.</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">FLUSH</span> <span
style="color: #993333; font-weight: bold;">TABLES</span> <span
style="color: #993333; font-weight: bold;">WITH</span> <span
style="color: #993333; font-weight: bold;">READ</span> <span
style="color: #993333; font-weight: bold;">LOCK</span>;</div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Il nous faut deux informations que l&#8217;on retrouve avec la commande ci-après : la <strong>position</strong> et le <strong>nom du fichier binaire</strong>.</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">SHOW</span> MASTER <span
style="color: #993333; font-weight: bold;">STATUS</span>;</div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Pour finir, on fait un <strong>dump</strong> de la base (<strong>mysqldump</strong>) et on l&#8217;envoie sur le serveur <em>esclave</em> (<strong>scp</strong>). C&#8217;est tout pour le serveur <em>maître</em>, on y reviendra à la fin pour le <span
style="text-decoration: underline;">déverrouiller</span> en écriture.</p><p
style="text-align: justify;">Au niveau du second serveur, les manip&#8217; sont semblables. On commence par modifier le fichier de conf <em>/etc/mysql/my.cnf</em> puis on redémarre le service <strong>mysql</strong>.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #7a0874; font-weight: bold;">&#91;</span>mysqld<span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> server-id &nbsp; &nbsp; &nbsp; = <span
style="color: #000000;">2</span><br
/> master-host﻿&nbsp; &nbsp; = IP serveur maître<br
/> master-user &nbsp; &nbsp; = replicateur<br
/> master-password = replicateur<br
/> master-port &nbsp; &nbsp; = <span
style="color: #000000;">3306</span><br
/> <span
style="color: #666666; font-style: italic;"># Je rappelle ici la base à répliquer</span><br
/> replicate-do-db = databaseName</div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">On va ensuite se servir des deux infos relevées plus haut en exécutant la commande :</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">CHANGE</span> MASTER <span
style="color: #993333; font-weight: bold;">TO</span><br
/> MASTER_LOG_FILE<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">'FILENAME'</span><span
style="color: #66cc66;">,</span><br
/> MASTER_LOG_POS<span
style="color: #66cc66;">=</span>POSITION;</div></div><p
style="text-align: justify;">Puis on démarre le process <em>maître/esclave</em> depuis l&#8217;esclave :</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">START SLAVE;</div></div><p
style="text-align: justify;">Soit ça marche, soit ça ne marche pas&#8230; Par exemple, pour 1 warning détecté, on devra reprendre les paramètres de conf dans une requête de la forme :</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">CHANGE</span> MASTER <span
style="color: #993333; font-weight: bold;">TO</span><br
/> MASTER_HOST<span
style="color: #66cc66;">=</span>IP serveur maître<span
style="color: #66cc66;">,</span><br
/> MASTER_USER<span
style="color: #66cc66;">=</span>replicateur<span
style="color: #66cc66;">,</span><br
/> <span
style="color: #66cc66;">....</span>;</div></div><p
style="text-align: justify;">A partir de là, <span
style="text-decoration: underline;">la replication est prête</span>. Seulement il faut effectuer le <span
style="text-decoration: underline;">rattrapage</span> sur le serveur <em>esclave</em>. La réplication est démarrée mais notre deuxième serveur n&#8217;est qu&#8217;un <em>esclave</em> qui ne peut recréer la base et se mettre à niveau du <em>maître</em>. Vous comprenez ? Non, tant pis, je recommence. C&#8217;est le <em>maître</em> qui donne les ordres donc comme on vient de commencer notre process <em>maître/esclave</em>, le <em>maître</em> ne sait pas que la base de <em>l&#8217;esclave</em> est vide. Voilà pour la petite histoire et pourquoi un <strong>dump</strong> était utile. Il suffit maintenant d&#8217;insérer le dump transféré au début.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">On retourne sur le serveur <em>maître</em> et on enlève le verrou d&#8217;écriture :</p><div
class="codecolorer-container sql vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #993333; font-weight: bold;">UNLOCK</span> <span
style="color: #993333; font-weight: bold;">TABLES</span>;</div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">La réplication est en place. On peut tester l&#8217;ajout d&#8217;une ligne dans une table pour voir si la réplication fonctionne parfaitement. Dorénavant, tout changement de la base maître (structures, données) sera répercuté sur la base esclave.</p><p
style="text-align: justify;">A noter qu&#8217;un peu de sécurité ne fait pas de mal. On veillera à créer une liaison très restreinte entre les deux serveurs sur le port <em>3306</em>, port par défaut de <strong>MySQL</strong>.</p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/' title='Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL'>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</a></li><li><a
href='http://www.willdurand.fr/connaissiez-vous-replace-en-sql/' title='Connaissiez-vous … REPLACE en SQL ?'>Connaissiez-vous … REPLACE en SQL ?</a></li><li><a
href='http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/' title='Optimiser son application web en jouant sur PHP, MySQL et Apache2'>Optimiser son application web en jouant sur PHP, MySQL et Apache2</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;bodytext=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;notes=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;t=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave%20-%20http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;annotation=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;t=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;body=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&title=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Freplication-mysql-maitre-esclave%2F&amp;submitHeadline=R%C3%A9plication%20MySQL%20ma%C3%AEtre-esclave&amp;submitSummary=Bonjour%2C%20je%20laisse%20ici%20une%20petite%20note%20d%27un%20syst%C3%A8me%20de%20secours%20que%20j%27ai%20mis%20en%20place%20r%C3%A9cemment%20%3A%20la%20r%C3%A9plication%20de%20bases%20de%20donn%C3%A9es%20MySQL.%20Il%20y%20a%20beaucoup%20d%27autres%20articles%20sur%20le%20sujet%20donc%20je%20ne%20m%27y%20%C3%A9tendrai%20pas%2C%20seul%20petite%20diff%C3%A9rence%2C%20j%27ai%20&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/replication-mysql-maitre-esclave/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Déploiement automatisé avec Capistrano et Git pour symfony et Diem</title><link>http://www.willdurand.fr/deploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=deploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem</link> <comments>http://www.willdurand.fr/deploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem/#comments</comments> <pubDate>Wed, 11 Aug 2010 09:09:24 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Diem Project]]></category> <category><![CDATA[symfony]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[Capistrano]]></category> <category><![CDATA[Déploiement]]></category> <category><![CDATA[Diem]]></category> <category><![CDATA[Git]]></category> <category><![CDATA[Murder]]></category> <category><![CDATA[Symfony]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=550</guid> <description><![CDATA[Hier, j&#8217;introduisais mes directives de travail. Aujourd&#8217;hui je vais introduire un sujet souvent sensible : la mise en production. C&#8217;est une tâche qui peut être critique mais si l&#8217;on prend toutes les précautions, nous limitons les risques. On notera bien que le facteur chance est laissé à la porte pour ce genre de manipulation&#8230; La [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><em>Hier, j&#8217;introduisais mes directives de travail. Aujourd&#8217;hui je vais introduire un sujet souvent sensible : la mise en production. C&#8217;est une tâche qui peut être critique mais si l&#8217;on prend toutes les précautions, nous limitons les risques. On notera bien que le facteur chance est laissé à la porte pour ce genre de manipulation&#8230;</em></p><p
style="text-align: justify;"></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">La <strong>mise en production</strong> c&#8217;est passer un projet sur le serveur du client pour le rendre accessible aux utilisateurs finaux. Facile ? Non, très souvent les architectures sont différentes et il convient d&#8217;utiliser plusieurs environnements. Pour ma part, je dispose de 3 environnements : <em>dev </em>(sur ma machine), <em>test </em>(sur serveur distant) et <em>préprod </em>(sur serveur distant également). Ces environnements me permettent de tester mes projets sur plusieurs OS, plusieurs types de machine et sur deux SGBDR (bases de données) : j&#8217;ai pris l&#8217;habitude d&#8217;effectuer mes tests sous <strong><a
href="http://www.sqlite.org/">SQLite</a></strong>, j&#8217;ai ainsi  deux sons de cloche (en plus de <strong><a
href="http://www.mysql.com/">MySQL</a></strong>) me permettant de corriger des étourderies lors de la configuration de la base.</p><p
style="text-align: justify;">Ok, tout ce speech pourquoi ? Pour pouvoir comprendre mon intérêt à <strong>automatiser le process de mise en prod&#8217;</strong>. En effet, mes trois environnements me garantissent une certaine <strong>stabilité </strong>de mon application, je n&#8217;ai donc pas à jongler avec les serveurs de chacun de mes clients (pas toujours&#8230;). Je peux donc déployer (mettre en prod&#8217;) mon application presque les yeux fermés. Et ça, ça n&#8217;a pas de prix !</p><p
style="text-align: justify;">Mais je ne joue pas le lanceur de couteaux sans avoir de lames bien aiguisées. J&#8217;utilise des outils éprouvés comme <a
href="http://www.capify.org/index.php/Capistrano"><strong>Capistrano</strong></a> et <a
href="http://git-scm.com/"><strong>Git</strong></a>.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><strong>Capistrano </strong>est l&#8217;outil par excellence pour déployer des applis <strong>Rails</strong>. Le problème c&#8217;est que je ne m&#8217;y suis pas encore mis&#8230; Mais qu&#8217;importe, il déploiera mes applications <strong>symfony </strong>et <strong>Diem</strong>. La souplesse de configuration via <span
style="text-decoration: underline;">redéfinition</span> des méthodes permet de déployer à peu près ce que l&#8217;on souhaite. De plus, l&#8217;interconnexion avec <strong>Git </strong>se fait sans problème.</p><p
style="text-align: justify;">Maintenant, courte description :</p><ul><li>Capistrano va <span
style="text-decoration: underline;">cloner votre projet</span> (Git inside) ;</li><li>Capistrano peut compresser votre projet (tar) et l&#8217;envoyer à vos X serveurs  ;</li><li>ou Capistrano va demander à X serveurs de récupérer la dernière version de votre projet ;</li><li>Capistrano va lier (symboliquement) la dernière version en tant que version courante ;</li><li>Capistrano va <span
style="text-decoration: underline;">migrer les bases de données</span> (la migration ici, ce n&#8217;est pas l&#8217;histoire avec les oiseaux&#8230; C&#8217;est plutôt la mise à jour structurelle de vos bases) ;</li><li>Capistrano va <span
style="text-decoration: underline;">déployer votre appli très rapidement</span> sur autant de serveurs que vous le souhaiter ;</li><li>Capistrano <span
style="text-decoration: underline;">exécute des commandes</span> avant ou après le déploiement, pratique pour un<em> sf cc </em>;</li><li>Enfin, <span
style="text-decoration: underline;">Capistrano ne fait pas le café</span> (il ne faut pas abuser quand même&#8230;)</li></ul><p
style="text-align: justify;"></p><p
style="text-align: justify;">Intéressant non ? Une fois <strong>Capistrano </strong>installé (<a
href="http://www.capify.org/index.php/Getting_Started">explications ici</a>), on va pouvoir commencer à travailler.</p><p
style="text-align: justify;">Ce que je fais généralement, je crée un répertoire <em>project_name</em> et je tape la commande :</p><p
style="text-align: justify;"><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">capify .</div></div></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Ceci me crée un fichier <em>Capfile</em>, un répertoire <em>config/</em> avec un fichier <em>deploy.rb</em>. C&#8217;est ce dernier qui nous intéresse. Le mieux est de partir d&#8217;un fichier vide. Pour pouvoir utiliser <strong>Git</strong>, il faut écrire ceci :</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set <span
style="color:#ff3333; font-weight:bold;">:scm</span>, <span
style="color:#996600;">&quot;git&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:repository</span>, &nbsp;<span
style="color:#996600;">&quot;~/#{application}.git&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:branch</span>, <span
style="color:#996600;">&quot;master&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:checkout</span>, <span
style="color:#996600;">&quot;export&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:deploy_via</span>, <span
style="color:#ff3333; font-weight:bold;">:remote_cache</span></div></div><p
style="text-align: justify;">J&#8217;indique le chemin de mon dépôt, ici local et la branche (par défaut master). Les paramètres <em>:checkout </em>et <em>:deploy_via </em>ainsi défini permettent de faire un clone complet du projet. Ensuite, quelques paramètres nécessaires :</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color:#008000; font-style:italic;"># Port</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:port</span>, <span
style="color:#006666;">9999</span><br
/> <span
style="color:#008000; font-style:italic;"># App ?</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:application</span>, <span
style="color:#996600;">&quot;project_name&quot;</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Where ?</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span
style="color:#996600;">&quot;/var/www/#{application}&quot;</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Which server ?</span><br
/> role <span
style="color:#ff3333; font-weight:bold;">:app</span>, <span
style="color:#996600;">&quot;localhost&quot;</span><br
/> role <span
style="color:#ff3333; font-weight:bold;">:web</span>, <span
style="color:#996600;">&quot;localhost&quot;</span><br
/> role <span
style="color:#ff3333; font-weight:bold;">:db</span>, <span
style="color:#996600;">&quot;localhost&quot;</span>, <span
style="color:#ff3333; font-weight:bold;">:primary</span> <span
style="color:#006600; font-weight:bold;">=&gt;</span> <span
style="color:#0000FF; font-weight:bold;">true</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Who ?</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:user</span>, <span
style="color:#996600;">&quot;myUs3r&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:password</span>, <span
style="color:#996600;">&quot;p4ssw0rd&quot;</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># More config</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:keep_releases</span>, <span
style="color:#006666;">3</span><br
/> ssh_options<span
style="color:#006600; font-weight:bold;">&#91;</span><span
style="color:#ff3333; font-weight:bold;">:forward_agent</span><span
style="color:#006600; font-weight:bold;">&#93;</span> = <span
style="color:#0000FF; font-weight:bold;">true</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Path to php executable</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:php</span>, <span
style="color:#996600;">&quot;/usr/bin/php&quot;</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Symfony application name (used for migrations)</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:sf_app</span>, <span
style="color:#996600;">&quot;front&quot;</span><br
/> <span
style="color:#008000; font-style:italic;"># Symfony web directory (www, web, public_html, ...)</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:sf_webdir</span>, <span
style="color:#996600;">&quot;www&quot;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Maintenant, une petite chose à savoir. <strong><span
style="text-decoration: underline;">Capistrano </span></strong><span
style="text-decoration: underline;">versionne les déploiements</span> et ça, c&#8217;est bon ! Mon déploiement plante, <span
style="text-decoration: underline;">rollback </span><span
style="text-decoration: underline;">automatique</span> vers la version précédente. Je m&#8217;aperçois que j&#8217;ai fait une grosse faute d&#8217;orthographe, je lance un rollback et l&#8217;appli passe en version précédente. Pour cela, <strong>Capistrano </strong>construit sa propre structure dans le répertoire défini par <em>:deploy_to</em> :</p><p
style="text-align: justify;"><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>www<span
style="color: #000000; font-weight: bold;">/</span>project_name<br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">`</span>_ current <span
style="color: #7a0874; font-weight: bold;">&#40;</span>symlink<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">|</span>_ releases<br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">|</span>_ shared</div></div></p><p
style="text-align: justify;"><em>current </em>est le lien symbolique qui pointe toujours vers la version active de l&#8217;application. Le répertoire <em>releases/ </em>possède X répertoires correspondant aux différents déploiements passés. Vous l&#8217;aurez compris, le lien symbolique <em>current </em>pointe vers l&#8217;un de ces répertoires. Le répertoire <em>shared/</em> quant à lui contient des fichiers partagés par toutes les releases. Exemple : le fichier <em>databases.yml</em> de <strong>symfony </strong>qui définit les identifiants de connexion à la base de données ou encore le répertoire <em>uploads/</em> qui contient des données utilisateurs.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">On peut désormais <span
style="text-decoration: underline;">personnaliser les actions de déploiement</span>. Pour cela, on va redéfinir les actions de <em>:deploy</em>, qui contient les tâches de déploiement appelées lors de tout déploiement.</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">namespace <span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#ff3333; font-weight:bold;">:deploy</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;</span> <span
style="color:#006600; font-weight:bold;">&lt;-</span>DESC<br
/> &nbsp; &nbsp; <span
style="color:#006600; font-weight:bold;">&#91;</span>internal<span
style="color:#006600; font-weight:bold;">&#93;</span> Overriding original task to fit to symfony project needs<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:finalize_update</span>, <span
style="color:#ff3333; font-weight:bold;">:except</span> <span
style="color:#006600; font-weight:bold;">=&gt;</span> <span
style="color:#006600; font-weight:bold;">&#123;</span> <span
style="color:#ff3333; font-weight:bold;">:no_release</span> <span
style="color:#006600; font-weight:bold;">=&gt;</span> <span
style="color:#0000FF; font-weight:bold;">true</span> <span
style="color:#006600; font-weight:bold;">&#125;</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># Fix permissions</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{latest_release} &amp;&amp; find * -type f -exec chmod 644 {} <span
style="color:#000099;">\\</span>;&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{latest_release} &amp;&amp; find * -type d -exec chmod 705 {} <span
style="color:#000099;">\\</span>;&quot;</span><br
/> &nbsp; <br
/> &nbsp; &nbsp; run <span
style="color:#006600; font-weight:bold;">&lt;</span> <span
style="color:#006600; font-weight:bold;">&lt;-</span>CMD<br
/> &nbsp; &nbsp; &nbsp; rm <span
style="color:#006600; font-weight:bold;">-</span>rf <span
style="color:#008000; font-style:italic;">#{latest_release}/log &amp;&amp;</span><br
/> &nbsp; &nbsp; &nbsp; ln <span
style="color:#006600; font-weight:bold;">-</span>s <span
style="color:#008000; font-style:italic;">#{shared_path}/log #{latest_release}/log</span><br
/> &nbsp; &nbsp; CMD<br
/> <br
/> &nbsp; &nbsp; run <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>CMD<br
/> &nbsp; &nbsp; &nbsp; rm <span
style="color:#006600; font-weight:bold;">-</span>rf <span
style="color:#008000; font-style:italic;">#{latest_release}/cache &amp;&amp;</span><br
/> &nbsp; &nbsp; &nbsp; ln <span
style="color:#006600; font-weight:bold;">-</span>s <span
style="color:#008000; font-style:italic;">#{shared_path}/cache #{latest_release}/cache</span><br
/> &nbsp; &nbsp; CMD<br
/> <br
/> &nbsp; &nbsp; stamp = <span
style="color:#CC00FF; font-weight:bold;">Time</span>.<span
style="color:#9900CC;">now</span>.<span
style="color:#9900CC;">utc</span>.<span
style="color:#9900CC;">strftime</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">&quot;%Y%m%d%H%M.%S&quot;</span><span
style="color:#006600; font-weight:bold;">&#41;</span><br
/> &nbsp; &nbsp; asset_paths = <span
style="color:#006600; font-weight:bold;">%</span>w<span
style="color:#006600; font-weight:bold;">&#40;</span>images css js<span
style="color:#006600; font-weight:bold;">&#41;</span>.<span
style="color:#9900CC;">map</span> <span
style="color:#006600; font-weight:bold;">&#123;</span> <span
style="color:#006600; font-weight:bold;">|</span>p<span
style="color:#006600; font-weight:bold;">|</span> <span
style="color:#996600;">&quot;#{latest_release}/#{sf_webdir}/#{p}&quot;</span> <span
style="color:#006600; font-weight:bold;">&#125;</span>.<span
style="color:#9900CC;">join</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">&quot; &quot;</span><span
style="color:#006600; font-weight:bold;">&#41;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;find #{asset_paths} -exec touch -t #{stamp} {} ';'; true&quot;</span>, <span
style="color:#ff3333; font-weight:bold;">:env</span> <span
style="color:#006600; font-weight:bold;">=&gt;</span> <span
style="color:#006600; font-weight:bold;">&#123;</span> <span
style="color:#996600;">&quot;TZ&quot;</span> <span
style="color:#006600; font-weight:bold;">=&gt;</span> <span
style="color:#996600;">&quot;UTC&quot;</span> <span
style="color:#006600; font-weight:bold;">&#125;</span><br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;</span> <span
style="color:#006600; font-weight:bold;">&lt;-</span>DESC<br
/> &nbsp; &nbsp; Overriding original task to exclude restart<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:default</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; update<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Overriding original task to use symfony migrations<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:migrations</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; update<br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;">#sf.migrate</span><br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span> &nbsp;<br
/> &nbsp; <br
/> &nbsp; after <span
style="color:#996600;">&quot;deploy:update&quot;</span>, <span
style="color:#996600;">'deploy:customize'</span><br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Custom tasks<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:customize</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; sf.<span
style="color:#9900CC;">symlinks</span><br
/> &nbsp; &nbsp; sf.<span
style="color:#9900CC;">remove_dev_environments</span><br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># clear cache</span><br
/> &nbsp; &nbsp; sf.<span
style="color:#9900CC;">cc</span><br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># Diem</span><br
/> &nbsp; &nbsp; dm.<span
style="color:#9900CC;">cc</span><br
/> &nbsp; &nbsp; dm.<span
style="color:#9900CC;">setup</span><br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> &nbsp;<br
/> <span
style="color:#9966CC; font-weight:bold;">end</span></div></div><p>&lt;</p><p>p style=&nbsp;&raquo;text-align: justify;&nbsp;&raquo;></p><p
style="text-align: justify;">Après déploiement, on va créer fixer les droits, les répertoires de logs et de cache. Ensuite on met à jour la base de données (Doctrine migration). Pour finir on exécute une série de tâches &laquo;&nbsp;<em>custom</em>&nbsp;&raquo; qui permettent de supprimer les contrôleurs de développement (frontend_dev, backend_dev, &#8230;), de recréer les liens symboliques pour les fichiers partagés, de vider le cache <strong>symfony </strong>ou <strong>Diem</strong>, &#8230;</p><p
style="text-align: justify;">Voyons la suite de commandes pour <strong>symfony </strong>:</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">namespace <span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#ff3333; font-weight:bold;">:sf</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;</span> <span
style="color:#006600; font-weight:bold;">&lt;-</span>DESC<br
/> &nbsp; &nbsp; Run the <span
style="color:#996600;">&quot;doctrine migration&quot;</span> task<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:migrate</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; #{php} symfony doctrine:generate-migrations-diff &amp;&amp; #{php} symfony doctrine:migrate&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Run the <span
style="color:#996600;">&quot;symfony cc&quot;</span> task<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:cc</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; #{php} symfony cc&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; rm -rf cache/*&quot;</span><br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Create symlink to symfony specific targets<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:symlinks</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># symlink to database.yml</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/config/databases.yml&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;ln -s #{shared_path}/databases.yml #{current_path}/config/databases.yml&quot;</span><br
/> &nbsp; &nbsp;<br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># symlink to uploads</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/#{sf_webdir}/uploads&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;ln -s #{shared_path}/uploads #{current_path}/#{sf_webdir}/uploads&quot;</span><br
/> &nbsp; &nbsp; &nbsp;<br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># symlink to .htaccess</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/#{sf_webdir}/.htaccess&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;ln -s #{shared_path}/.htaccess #{current_path}/#{sf_webdir}/.htaccess&quot;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># symlink to app.yml</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/apps/#{sf_app}/config/app.yml&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;ln -s #{shared_path}/app.yml #{current_path}/apps/#{sf_app}/config/app.yml&quot;</span><br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span> <br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Remove DEV environments<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:remove_dev_environments</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/#{sf_webdir}/*dev.php&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span> <br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Disable symfony application<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:disable</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; #{php} symfony project:disable #{sf_app} prod&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span> <br
/> &nbsp; <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Enable symfony application<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:enable</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; #{php} symfony project:enable #{sf_app} prod&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span> &nbsp; <br
/> <span
style="color:#9966CC; font-weight:bold;">end</span></div></div><p>&lt;</p><p>p style=&nbsp;&raquo;text-align: justify;&nbsp;&raquo;>Et voilà la suite de commandes pour <strong>Diem </strong>:</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">namespace <span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#ff3333; font-weight:bold;">:dm</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;</span> <span
style="color:#006600; font-weight:bold;">&lt;-</span>DESC<br
/> &nbsp; &nbsp; Run the <span
style="color:#996600;">&quot;Diem setup&quot;</span> task<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:setup</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;cd #{current_path} &amp;&amp; #{php} symfony dm:setup&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> <br
/> &nbsp; desc <span
style="color:#006600; font-weight:bold;">&lt;&lt;-</span>DESC<br
/> &nbsp; &nbsp; Clear Diem cache <span
style="color:#9966CC; font-weight:bold;">and</span> fix permissions<br
/> &nbsp; DESC<br
/> &nbsp; task <span
style="color:#ff3333; font-weight:bold;">:cc</span> <span
style="color:#9966CC; font-weight:bold;">do</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;rm -rf #{current_path}/#{sf_webdir}/cache&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;mkdir #{current_path}/#{sf_webdir}/cache&quot;</span><br
/> &nbsp; &nbsp; run <span
style="color:#996600;">&quot;chmod 777 #{current_path}/#{sf_webdir}/cache&quot;</span> &nbsp; &nbsp;<br
/> &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span><br
/> &nbsp; <br
/> <span
style="color:#9966CC; font-weight:bold;">end</span></div></div><p>&lt;</p><p>p style=&nbsp;&raquo;text-align: justify;&nbsp;&raquo;>Et voilà ! Un simple <strong>cap deploy</strong> fait tout le reste. Vous pouvez ajouter autant de serveurs que vous le souhaiter et lancer également toutes les commandes qui vous font plaisir.</p><p
style="text-align: justify;">Si vous avez des problèmes d&#8217;hébergement, exemple chez OVH qui ne laisse pas d&#8217;accès externe sur leurs serveurs Plan (&#8230;), vous pouvez utiliser la configuration suivante qui va archiver votre projet et l&#8217;envoyer en SFTP :</p><div
class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set <span
style="color:#ff3333; font-weight:bold;">:deploy_via</span>, <span
style="color:#ff3333; font-weight:bold;">:copy</span><br
/> <br
/> <span
style="color:#008000; font-style:italic;"># Use copy to bypass firewall...</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:copy_strategy</span>, <span
style="color:#ff3333; font-weight:bold;">:export</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:copy_cache</span>, <span
style="color:#996600;">&quot;/tmp/#{application}&quot;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:copy_exclude</span>, <span
style="color:#006600; font-weight:bold;">&#91;</span><span
style="color:#996600;">&quot;.git/*&quot;</span><span
style="color:#006600; font-weight:bold;">&#93;</span><br
/> set <span
style="color:#ff3333; font-weight:bold;">:copy_compression</span>, <span
style="color:#ff3333; font-weight:bold;">:gzip</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Cette configuration est largement inspirée de ces articles :</p><ul
style="text-align: justify;"><li
style="text-align: justify;"><a
href="http://refineweb.co.uk/2010/01/18/preparing-a-symfony-project-ready-for-deployment-into-production-using-capistrano/">http://refineweb.co.uk/2010/01/18/preparing-a-symfony-project-ready-for-deployment-into-production-using-capistrano/</a></li><li><a
href="http://blog.servergrove.com/2010/07/12/symfony-git-capistrano-capifony/">http://blog.servergrove.com/2010/07/12/symfony-git-capistrano-capifony/</a></li><li><a
href="http://blog.codingspree.net/2008/5/12/deploying-symfony-project-with-capistrano/">http://blog.codingspree.net/2008/5/12/deploying-symfony-project-with-capistrano/</a></li></ul><p
style="text-align: justify;"></p><p
style="text-align: justify;">Pour terminer, hier je vous parlais d&#8217;<strong>Hudson</strong>, un serveur d&#8217;intégration continue. En liant les deux, j&#8217;obtiens une <span
style="text-decoration: underline;">automatisation complète</span> de mon &laquo;&nbsp;<em>after code</em>&laquo;&nbsp;. C&#8217;est-à-dire que j&#8217;écris mon code comme un barbu (et mes tests). Lorsque j&#8217;ai bien commité et que je push mes modifs, <strong>Hudson </strong>voit ces mises à jour, il va relancer les tests. Si tout passe la build estampillée &laquo;&nbsp;<em>success</em>&nbsp;&raquo; va être déployée automatiquement par <strong>Capistrano</strong>.</p><p
style="text-align: justify;">Et moi dans l&#8217;histoire ? Je n&#8217;ai rien à faire. Au pire, je suis alerté par mail si un test ne passe pas et si la build ne peut être déployée, <strong>Capistrano </strong>fera un rollback automatiquement sur sa dernière version stable. Manquerait plus qu&#8217;une cafetière USB et une tâche Hudson pour lancer le café et là&#8230; utopie !</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">A noter qu&#8217;un projet nommé <strong>Capifony </strong>a vu le jour depuis quelques temps. C&#8217;est un <strong>Capistrano </strong>réécrit pour gérer nativement les projets <strong>symfony</strong>, je n&#8217;ai pas testé mais cela me semble une excellente option : <a
href="http://github.com/everzet/capifony">http://github.com/everzet/capifony</a>. Pour <strong>Diem</strong>, j&#8217;ai vu passé quelque chose dans le Google Groups, à suivre donc.</p><p
style="text-align: justify;">Vous pouvez, si vous le voulez, utiliser <a
href="http://github.com/lg/murder"><strong>Murder</strong></a>, un projet développé par Twitter pour déployer via <strong>Bittorent </strong>leurs applications sur tous leurs serveurs. C&#8217;est pas une mauvaise idée si vous avez beaucoup de serveurs, leurs temps de déploiements sont assez phénoménales. En parlant de temps, mes temps de déploiements sont de l&#8217;ordre de 2 minutes&#8230;</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">C&#8217;est tout, pour le moment <img
src='http://www.willdurand.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/integrer-un-gestionnaire-de-fichiers-dans-dmckeditorplugin/' title='Intégrer un gestionnaire de fichiers dans dmCkEditorPlugin'>Intégrer un gestionnaire de fichiers dans dmCkEditorPlugin</a></li><li><a
href='http://www.willdurand.fr/symfony-jenkins-co/' title=' Symfony, Jenkins &amp; co'> Symfony, Jenkins &#038; co</a></li><li><a
href='http://www.willdurand.fr/symfony-live-2011/' title='Symfony live 2011'>Symfony live 2011</a></li><li><a
href='http://www.willdurand.fr/symfony-rencontre-hudson-mantis-et-les-autres/' title='symfony rencontre Hudson, Mantis et les autres'>symfony rencontre Hudson, Mantis et les autres</a></li><li><a
href='http://www.willdurand.fr/creation-automatique-dun-projet-symfony-mysql-git-et-apache2/' title='Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2'>Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;bodytext=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;notes=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;t=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;annotation=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;t=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;body=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&title=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fdeploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem%2F&amp;submitHeadline=D%C3%A9ploiement%20automatis%C3%A9%20avec%20Capistrano%20et%20Git%20pour%20symfony%20et%20Diem&amp;submitSummary=Hier%2C%20j%27introduisais%20mes%20directives%20de%20travail.%20Aujourd%27hui%20je%20vais%20introduire%20un%20sujet%20souvent%20sensible%20%3A%20la%20mise%20en%20production.%20C%27est%20une%20t%C3%A2che%20qui%20peut%20%C3%AAtre%20critique%20mais%20si%20l%27on%20prend%20toutes%20les%20pr%C3%A9cautions%2C%20nous%20limitons%20les%20risques.%20On%20noter&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/deploiement-automatise-avec-capistrano-et-git-pour-symfony-et-diem/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</title><link>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql</link> <comments>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/#comments</comments> <pubDate>Sun, 11 Jul 2010 22:55:31 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Serveur]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[Apache2]]></category> <category><![CDATA[APC]]></category> <category><![CDATA[Dedibox]]></category> <category><![CDATA[Memcached]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Nginx]]></category> <category><![CDATA[PHP-FPM]]></category> <category><![CDATA[PHP5]]></category> <category><![CDATA[Postfix]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=520</guid> <description><![CDATA[Bonjour J&#8217;ai récemment pris une Dédibox v3 et pour le moment j&#8217;en suis très satisfait. On m&#8217;a pas mal sollicité ces derniers temps pour que j&#8217;explique comment j&#8217;ai configuré ce serveur ainsi que les services que j&#8217;ai pu mettre en place. C&#8217;est l&#8217;objet de cet article. Premièrement, j&#8217;utilise Debian depuis toujours et c&#8217;est logiquement ce [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Bonjour <img
src='http://www.willdurand.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p
style="text-align: justify;">J&#8217;ai récemment pris une Dédibox v3 et pour le moment j&#8217;en suis très satisfait. On m&#8217;a pas mal sollicité ces derniers temps pour que j&#8217;explique comment j&#8217;ai configuré ce serveur ainsi que les services que j&#8217;ai pu mettre en place. C&#8217;est l&#8217;objet de cet article.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Premièrement, j&#8217;utilise Debian depuis toujours et c&#8217;est logiquement ce qui tourne sur la Dédibox (en version 64 bits).</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><img
class="alignright" src="http://wiki.nginx.org/local/nginx-logo.png" alt="" width="350" height="90" /></p><p
style="text-align: justify;">Le serveur HTTP frontal n&#8217;est pas Apache2 mais <a
href="http://nginx.org/">Nginx</a> (<a
href="http://wiki.nginx.org/Main">wiki</a>) que j&#8217;ai appréhendé seulement depuis l&#8217;obtention de ce serveur. Et je dois avouer que j&#8217;en suis très satisfait, terriblement surpris d&#8217;ailleurs. Apache2 est bien en place mais sert de proxy à Nginx.</p><p
style="text-align: justify;">Nginx est couplé à <a
href="http://php-fpm.org/">php-fpm</a>. La paire formée est excellente et permet l&#8217;utilisation de <a
href="http://memcached.org/">Memcached</a> ou <a
href="http://php.net/manual/fr/book.apc.php">APC</a> sans soucis. Notons que l&#8217;excellent <a
href="http://www.dotdeb.org/">repository Dotdeb</a> fournit un package .deb de php-fpm. Ce repository est certainement un <strong>must-have</strong> puisque Debian n&#8217;est pas forcément très en avance sur les versions de PHP. Pour ma part, j&#8217;ai installé, via ce repository, PHP 5.3.2 ainsi que la dernière version d&#8217;APC (3.1.2 via <a
href="http://pecl.php.net/">pecl</a>). Comme je l&#8217;ai dit plus haut j&#8217;ai installé Memcached avec l&#8217;extension PHP qui va bien. Passons à la configuration.</p><p
style="text-align: justify;"></p><h2>Nginx</h2><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user www-data;<br
/> worker_processes <span
style="color: #000000;">1</span>;<br
/> <br
/> error_log &nbsp;<span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>log<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>error.log;<br
/> pid &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>run<span
style="color: #000000; font-weight: bold;">/</span>nginx.pid;<br
/> <br
/> events <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> worker_connections <span
style="color: #000000;">1024</span>;<br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> http <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> include &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>mime.types;<br
/> default_type &nbsp;application<span
style="color: #000000; font-weight: bold;">/</span>octet-stream;<br
/> <br
/> client_max_body_size 8M;<br
/> <br
/> sendfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<br
/> keepalive_timeout &nbsp; <span
style="color: #000000;">15</span>;<br
/> tcp_nodelay &nbsp; &nbsp; &nbsp; &nbsp; on;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Enable Gzip compression</span><br
/> <span
style="color: #c20cb9; font-weight: bold;">gzip</span> on;<br
/> gzip_disable <span
style="color: #ff0000;">&quot;MSIE [1-6].(?!.*SV1)&quot;</span>;<br
/> gzip_vary on;<br
/> gzip_comp_level <span
style="color: #000000;">3</span>;<br
/> gzip_proxied any;<br
/> gzip_types text<span
style="color: #000000; font-weight: bold;">/</span>plain text<span
style="color: #000000; font-weight: bold;">/</span>html text<span
style="color: #000000; font-weight: bold;">/</span>css application<span
style="color: #000000; font-weight: bold;">/</span>x-javascript text<span
style="color: #000000; font-weight: bold;">/</span>xml application<span
style="color: #000000; font-weight: bold;">/</span>xml application<span
style="color: #000000; font-weight: bold;">/</span>xml+rss text<span
style="color: #000000; font-weight: bold;">/</span>javascript;<br
/> gzip_buffers <span
style="color: #000000;">16</span> 8k;<br
/> <br
/> include <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>conf.d<span
style="color: #000000; font-weight: bold;">/*</span>.conf;<br
/> include <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>sites-enabled<span
style="color: #000000; font-weight: bold;">/*</span>;<br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span></div></div><p
style="text-align: justify;">Le paramètre <em>worker_processes</em> dépend de votre processeur (multi-coeurs ou non). Dans le cas d&#8217;une Dédibox, on ne dispose que d&#8217;un processeur mono-coeur donc on fixe ce paramètre à <em>1</em>. Ensuite j&#8217;active la compression gzip, ce qui permettra de gagner un peu en performances (moins de données à envoyer d&#8217;un coup = plus de données envoyées en même temps).</p><p
style="text-align: justify;">Nginx va servir tous les fichiers statiques, les &laquo;&nbsp;assets&nbsp;&raquo; mais également les pages en cache. Il s&#8217;interface très bien avec <em>Memcached</em>. Il est aussi capable de servir n&#8217;importe quel fichier sur disque.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Voici les deux autres fichiers de configuration de Nginx : <em>proxy.conf</em> pour configurer Apache2 en proxy et fastcgi_params pour php-fpm.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># /etc/nginx/proxy.conf</span><br
/> proxy_redirect &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;off;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Host &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$host</span>;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;X-Real-IP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$remote_addr</span>;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;X-Forwarded-For &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$proxy_add_x_forwarded_for</span>;<br
/> client_max_body_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10m;<br
/> client_body_buffer_size &nbsp; &nbsp; &nbsp; &nbsp; 128k;<br
/> proxy_connect_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">90</span>;<br
/> proxy_send_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">90</span>;<br
/> proxy_read_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">90</span>;<br
/> proxy_buffer_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4k;<br
/> proxy_buffers &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">4</span> 32k;<br
/> proxy_busy_buffers_size &nbsp; &nbsp; &nbsp; &nbsp; 64k;<br
/> proxy_temp_file_write_size &nbsp; &nbsp; &nbsp;64k;</div></div><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># /etc/nginx/factcgi_params</span><br
/> fastcgi_param &nbsp;QUERY_STRING &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$query_string</span>;<br
/> fastcgi_param &nbsp;REQUEST_METHOD &nbsp; &nbsp; <span
style="color: #007800;">$request_method</span>;<br
/> fastcgi_param &nbsp;CONTENT_TYPE &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$content_type</span>;<br
/> fastcgi_param &nbsp;CONTENT_LENGTH &nbsp; &nbsp; <span
style="color: #007800;">$content_length</span>;<br
/> <br
/> fastcgi_param &nbsp;SCRIPT_NAME &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$fastcgi_script_name</span>;<br
/> fastcgi_param &nbsp;REQUEST_URI &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$request_uri</span>;<br
/> fastcgi_param &nbsp;DOCUMENT_URI &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$document_uri</span>;<br
/> fastcgi_param &nbsp;DOCUMENT_ROOT &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$document_root</span>;<br
/> fastcgi_param &nbsp;SERVER_PROTOCOL &nbsp; &nbsp;<span
style="color: #007800;">$server_protocol</span>;<br
/> <br
/> fastcgi_param &nbsp;GATEWAY_INTERFACE &nbsp;CGI<span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #000000;">1.1</span>;<br
/> fastcgi_param &nbsp;SERVER_SOFTWARE &nbsp; &nbsp;nginx<span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$nginx_version</span>;<br
/> <br
/> fastcgi_param &nbsp;REMOTE_ADDR &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$remote_addr</span>;<br
/> fastcgi_param &nbsp;REMOTE_PORT &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$remote_port</span>;<br
/> fastcgi_param &nbsp;SERVER_ADDR &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_addr</span>;<br
/> fastcgi_param &nbsp;SERVER_PORT &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_port</span>;<br
/> fastcgi_param &nbsp;SERVER_NAME &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_name</span>;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># PHP only, required if PHP was built with --enable-force-cgi-redirect</span><br
/> fastcgi_param &nbsp;REDIRECT_STATUS &nbsp; &nbsp;<span
style="color: #000000;">200</span>;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Custom settings</span><br
/> fastcgi_connect_timeout <span
style="color: #000000;">60</span>;<br
/> fastcgi_send_timeout <span
style="color: #000000;">180</span>;<br
/> fastcgi_read_timeout <span
style="color: #000000;">180</span>;<br
/> fastcgi_buffer_size 128k;<br
/> fastcgi_buffers <span
style="color: #000000;">4</span> 256k;<br
/> fastcgi_busy_buffers_size 256k;<br
/> fastcgi_temp_file_write_size 256k;<br
/> fastcgi_intercept_errors on;</div></div><p
style="text-align: justify;">Pour utiliser <em>Apache2 </em>en proxy ou <em>php-fpm</em>, il suffit d&#8217;insérer quelques lignes dans vos configurations de vhosts. C&#8217;est suffisamment détaillé ailleurs, je n&#8217;y reviendrai donc pas.</p><p
style="text-align: justify;"></p><h2>APC</h2><p
style="text-align: justify;">Voilà ma configuration APC, fonctionne bien pour Symfony. Pour certaines applis dont le code laisse à désirer, je suggère de passer le paramètre <em>include_once_override</em> à 0. Cette config provient en grande partie de chez <a
href="http://romain.cambien.net/20564234">Romain Cambien</a>.</p><div
class="codecolorer-container ini vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000066; font-weight:bold;"><span
style="">&#91;</span>apc<span
style="">&#93;</span></span><br
/> apc.enabled<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; 1 segments of 256Mo</span><br
/> apc.shm_segments<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> apc.shm_size<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">256</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; No optimization</span><br
/> apc.optimization<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Never expire</span><br
/> apc.ttl<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> apc.user_ttl<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; workaround for CLI</span><br
/> apc.enable_cli<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Symfony make lot of path lookups, try to optimize</span><br
/> apc.include_once_override<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> apc.canonicalize<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Wait 2 seconds to rebuild cache</span><br
/> apc.file_update_protection<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">2</span></div></div><h2>PHP</h2><p
style="text-align: justify;">La configuration de PHP est celle par défaut aux <em>best practices</em> près (short_tags off, magic quote gpc off, &#8230;). J&#8217;ai surtout calqué sur les &laquo;&nbsp;requirements&nbsp;&raquo; de <a
href="http://diem-project.org/diem-5-0/doc/en/reference-book/requirements">Diem</a>. A noter que l&#8217;on gère 3 fichiers php.ini : pour <em>Apache2</em>, pour <em>php-fpm </em>et pour <em>cli</em>.</p><p
style="text-align: justify;"></p><h2>Memcached</h2><p
style="text-align: justify;">Aucun besoin de modifier la configuration par défaut. Par contre, on peut modifier la taille (64Mo par défaut) si besoin.</p><p
style="text-align: justify;"></p><h2>Apache2</h2><p
style="text-align: justify;">Pour utiliser Apache2 en proxy, on doit nécessairement lui attribuer un port différent du port par défaut (80). Pour cela, on modifie le fichier <em>/etc/apache2/ports.conf</em> :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># If you just change the port or add more ports here, you will likely also</span><br
/> <span
style="color: #666666; font-style: italic;"># have to change the VirtualHost statement in</span><br
/> <span
style="color: #666666; font-style: italic;"># /etc/apache2/sites-enabled/000-default</span><br
/> <span
style="color: #666666; font-style: italic;"># This is also true if you have upgraded from before 2.2.9-3 (i.e. from</span><br
/> <span
style="color: #666666; font-style: italic;"># Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and</span><br
/> <span
style="color: #666666; font-style: italic;"># README.Debian.gz</span><br
/> <br
/> Listen <span
style="color: #000000;">9999</span><br
/> NameVirtualHost <span
style="color: #000000; font-weight: bold;">*</span>:<span
style="color: #000000;">9999</span><br
/> <span
style="color: #666666; font-style: italic;"># SSL name based virtual hosts are not yet supported, therefore no</span><br
/> <span
style="color: #666666; font-style: italic;"># NameVirtualHost statement here</span><br
/> Listen <span
style="color: #000000;">443</span></div></div><p
style="text-align: justify;">J&#8217;ai choisi le prefork MPM d&#8217;Apache2, la directive KeepAlive est désactivé car Apache2 ne sert que du PHP. Après quelques tests, voici la configuration retenue :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># Timeout: The number of seconds before receives and sends time out.</span><br
/> Timeout <span
style="color: #000000;">10</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># KeepAlive: Whether or not to allow persistent connections (more than</span><br
/> <span
style="color: #666666; font-style: italic;"># one request per connection). Set to &quot;Off&quot; to deactivate.</span><br
/> KeepAlive Off<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># MaxKeepAliveRequests: The maximum number of requests to allow</span><br
/> <span
style="color: #666666; font-style: italic;"># during a persistent connection. Set to 0 to allow an unlimited amount.</span><br
/> <span
style="color: #666666; font-style: italic;"># We recommend you leave this number high, for maximum performance.</span><br
/> MaxKeepAliveRequests <span
style="color: #000000;">100</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># KeepAliveTimeout: Number of seconds to wait for the next request from the</span><br
/> <span
style="color: #666666; font-style: italic;"># same client on the same connection.</span><br
/> KeepAliveTimeout <span
style="color: #000000;">2</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># prefork MPM</span><br
/> <span
style="color: #666666; font-style: italic;"># StartServers: number of server processes to start</span><br
/> <span
style="color: #666666; font-style: italic;"># MinSpareServers: minimum number of server processes which are kept spare</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxSpareServers: maximum number of server processes which are kept spare</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxClients: maximum number of server processes allowed to start</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxRequestsPerChild: maximum number of requests a server process serves</span><br
/> StartServers &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">8</span><br
/> MinSpareServers &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">5</span><br
/> MaxSpareServers &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">15</span><br
/> MaxClients &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">80</span><br
/> MaxRequestsPerChild &nbsp; <span
style="color: #000000;">0</span></div></div><h2>MySQL</h2><p
style="text-align: justify;">En SGBD, j&#8217;ai installé MySQL et <a
href="http://www.postgresql.org/">PostgreSQL</a> qui ne sert pas pour le moment. La configuration MySQL est d&#8217;origine à l&#8217;exception d&#8217;un Ramdisk pour le répertoire temporaire. L&#8217;explication pour la création d&#8217;un Ramdisk est expliqué ici : <a
href="http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/">http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/</a>. MySQL est également protégé par une couche Memcached, ce qui permet de faire tenir une charge correcte sans envoyer MySQL dans les choux.</p><p
style="text-align: justify;"></p><h2>Postfix</h2><p
style="text-align: justify;">Configuré en &laquo;&nbsp;Site Internet&nbsp;&raquo;, rien n&#8217;a été touché et les mails transitent bien. Je n&#8217;ai pas besoin de faire de gestion de mail autre.</p><p
style="text-align: justify;"></p><h2>Getmail</h2><p
style="text-align: justify;">Dernière petite chose qui n&#8217;avait pas été relevé dans l&#8217;article précédent : <a
href="http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/">http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/</a>, la sauvegarde de mes emails. Tout est dit <a
href="http://maxime.sh/2010/06/sauvegarder-son-gmail-grace-a-linux/">ici</a>. J&#8217;envoie toutes mes sauvegardes sur un autre serveur privé et inaccessible excepté le temps du transfert.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Voilà.</p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/' title='Optimiser son application web en jouant sur PHP, MySQL et Apache2'>Optimiser son application web en jouant sur PHP, MySQL et Apache2</a></li><li><a
href='http://www.willdurand.fr/replication-mysql-maitre-esclave/' title='Réplication MySQL maître-esclave'>Réplication MySQL maître-esclave</a></li><li><a
href='http://www.willdurand.fr/creation-automatique-dun-projet-symfony-mysql-git-et-apache2/' title='Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2'>Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2</a></li><li><a
href='http://www.willdurand.fr/lerreur-suexec-policy-violation-avec-symfony-chez-ovh/' title='L&#8217;erreur &laquo;&nbsp;suexec policy violation&nbsp;&raquo; avec symfony (chez OVH&#8230;)'>L&#8217;erreur &laquo;&nbsp;suexec policy violation&nbsp;&raquo; avec symfony (chez OVH&#8230;)</a></li><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;bodytext=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;notes=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;t=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;annotation=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;t=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;body=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;submitHeadline=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;submitSummary=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</title><link>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql</link> <comments>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/#comments</comments> <pubDate>Wed, 07 Jul 2010 12:24:14 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Serveur]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[Dedibox]]></category> <category><![CDATA[Rsync]]></category> <category><![CDATA[Script]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=487</guid> <description><![CDATA[Bonjour, suite à mon passage en dédié (Dédibox v3) et à sa configuration aujourd&#8217;hui terminée, j&#8217;ai trouvé nécessaire de m&#8217;occuper de la sauvegarde des données. Pour cela, je me suis aidé de plusieurs sources : http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql (pour backuper MySQL) http://www.casafire.com/fr/content/sauvegarde-incrémentale-de-fichiers-avec-rsync-et-ssh (pour backuper les fichiers) http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/ (pour me rappeler les commandes d&#8217;usage) Sauvegarde des bases MySQL [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Bonjour, suite à mon passage en dédié (Dédibox v3) et à sa configuration aujourd&#8217;hui terminée, j&#8217;ai trouvé nécessaire de m&#8217;occuper de la sauvegarde des données. Pour cela, je me suis aidé de plusieurs sources :</p><ul><li><a
href="http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql">http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql</a> (pour backuper MySQL)</li><li><a
href="http://www.casafire.com/fr/content/sauvegarde-incr%C3%A9mentale-de-fichiers-avec-rsync-et-ssh">http://www.casafire.com/fr/content/sauvegarde-incrémentale-de-fichiers-avec-rsync-et-ssh</a> (pour backuper les fichiers)</li><li><a
href="http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/">http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/</a> (pour me rappeler les commandes d&#8217;usage)</li></ul><h2>Sauvegarde des bases MySQL</h2><p
style="text-align: justify;">Je sauvegarde toutes les bases de données sur une <strong>durée d&#8217;une semaine</strong>. Voici le script, il est possible de le coupler à un envoi de la sauvegarde via FTP. Je conserve ainsi toutes mes sauvegardes sur un serveur distant et complètement déconnecté de ce dont je vais vous parler ensuite.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;">#!/bin/bash</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Paramétrage de la connection MySQL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#Nom de l'utilisateur qui lance le backup</span><br
/> <span
style="color: #007800;">user</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>user<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #666666; font-style: italic;">#Machine sur laquelle on se connecte</span><br
/> <span
style="color: #007800;">host</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>host<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #666666; font-style: italic;">#Mot de passe de l'utilisateur de backup</span><br
/> <span
style="color: #007800;">pass</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>password<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Outil de dump</span><br
/> <span
style="color: #007800;">MYSQLDUMP</span>=mysqldump<br
/> <span
style="color: #666666; font-style: italic;">#Outil de check</span><br
/> <span
style="color: #007800;">MYSQLCHECK</span>=mysqlcheck<br
/> <span
style="color: #666666; font-style: italic;"># Options passées à MYSQLDUMP</span><br
/> <span
style="color: #007800;">OPTIONS</span>=<span
style="color: #ff0000;">&quot;--add-drop-database &nbsp;--add-drop-table --complete-insert --routines --triggers --max_allowed_packet=250M --force&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Paramétrage de la sauvegarde &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Répertoire temporaire pour stocker les backups</span><br
/> <span
style="color: #007800;">TEMPORAIRE</span>=<span
style="color: #ff0000;">&quot;/tmp/bkp_mysql&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Nom du serveur</span><br
/> <span
style="color: #007800;">MACHINE</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(hostname)</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Date courante</span><br
/> <span
style="color: #007800;">DATE</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(date +&quot;%d-%m-%Y&quot;)</span>&quot;</span><br
/> <span
style="color: #666666; font-style: italic;"># Date de conservation maximum</span><br
/> <span
style="color: #007800;">DATE2</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> <span
style="color: #660033;">--date</span> <span
style="color: #ff0000;">'1 week ago'</span> <span
style="color: #ff0000;">&quot;+%d-%m-%Y&quot;</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Nom des fichiers de backup</span><br
/> <span
style="color: #666666; font-style: italic;"># Répertoire de destination du backup</span><br
/> <span
style="color: #007800;">DESTINATION</span>=<span
style="color: #ff0000;">&quot;/home/backuper/mysql&quot;</span><br
/> <span
style="color: #007800;">FICHIER_BACKUP</span>=<span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;_BACKUP_MYSQL_&quot;</span><span
style="color: #007800;">$DATE</span><span
style="color: #ff0000;">&quot;.tar.gz&quot;</span><br
/> <span
style="color: #007800;">FICHIER_EFFACER</span>=<span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;_BACKUP_MYSQL_&quot;</span><span
style="color: #007800;">$DATE2</span><span
style="color: #ff0000;">&quot;.tar.gz&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#Informations FTP</span><br
/> <span
style="color: #007800;">LOGIN_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>user_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #007800;">PASS_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>pass_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #007800;">HOST_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>host_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Process de sauvegarde &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Création du répertoire temporaire</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TEMPORAIRE</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Le repertoire temporaire existe.&quot;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">mkdir</span> <span
style="color: #007800;">$TEMPORAIRE</span>;<br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On construit la liste des bases de données</span><br
/> <span
style="color: #007800;">BASES</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(mysql -u $user -h $host -p$pass -Bse 'show databases')</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On lance le dump des bases</span><br
/> <span
style="color: #000000; font-weight: bold;">for</span> db <span
style="color: #000000; font-weight: bold;">in</span> <span
style="color: #007800;">$BASES</span><br
/> <span
style="color: #000000; font-weight: bold;">do</span><br
/> &nbsp; <span
style="color: #666666; font-style: italic;">#On lance un check et une analyse pour chaque base de données</span><br
/> &nbsp; <span
style="color: #007800;">$MYSQLCHECK</span> <span
style="color: #660033;">-u</span> <span
style="color: #007800;">$user</span> <span
style="color: #660033;">-h</span> <span
style="color: #007800;">$host</span> -p<span
style="color: #007800;">$pass</span> <span
style="color: #660033;">-c</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$db</span><br
/> &nbsp; <span
style="color: #666666; font-style: italic;"># On lance un mysqldump pour chaque base de données</span><br
/> &nbsp; <span
style="color: #007800;">$MYSQLDUMP</span> <span
style="color: #660033;">-u</span> <span
style="color: #007800;">$user</span> <span
style="color: #660033;">-h</span> <span
style="color: #007800;">$host</span> -p<span
style="color: #007800;">$pass</span> <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$db</span> <span
style="color: #660033;">-R</span> <span
style="color: #000000; font-weight: bold;">&gt;</span> <span
style="color: #007800;">$TEMPORAIRE</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;-&quot;</span><span
style="color: #007800;">$db</span><span
style="color: #ff0000;">&quot;-&quot;</span><span
style="color: #007800;">$DATE</span><span
style="color: #ff0000;">&quot;.sql&quot;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">done</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Création de l'archive contenant tout les dump</span><br
/> <span
style="color: #666666; font-style: italic;">#Cette archive est stockée dans le dossier défini pour la sauvegarde</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$DESTINATION</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">cd</span> <span
style="color: #007800;">$TEMPORAIRE</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">tar</span> <span
style="color: #660033;">-cvzf</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_BACKUP</span> <span
style="color: #000000; font-weight: bold;">*</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On transfere l'archive par FTP</span><br
/> <span
style="color: #7a0874; font-weight: bold;">cd</span> <span
style="color: #007800;">$DESTINATION</span><br
/> <span
style="color: #c20cb9; font-weight: bold;">ftp</span> <span
style="color: #660033;">-v</span> <span
style="color: #660033;">-n</span> <span
style="color: #007800;">$HOST_FTP</span> <span
style="color: #000000; font-weight: bold;">&lt;</span> <span
style="color: #000000; font-weight: bold;">&lt;</span>SCRIPT<br
/> user <span
style="color: #007800;">$LOGIN_FTP</span> <span
style="color: #007800;">$PASS_FTP</span> <br
/> bin <br
/> put <span
style="color: #007800;">$FICHIER_BACKUP</span> <br
/> bye<br
/> SCRIPT<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On supprime le fichier de plus de x jours</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_EFFACER</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_EFFACER</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On suprime le répertoire temporaire</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> fichier <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-Rf</span> <span
style="color: #007800;">$TEMPORAIRE</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span></div></div><h2></h2><h2>Sauvegarde incrémentale des fichiers avec rsync</h2><p
style="text-align: justify;">Je sauvegarde mes fichiers à la semaine de la façon suivante :</p><ul
style="text-align: justify;"><li>sauvegarde dans un répertoire nommé : <em>&lt;Année&gt;-&lt;Numéro de semaine&gt;</em></li><li>dans ce répertoire j&#8217;ai un dossier main qui contient l&#8217;intégralité des fichiers. Cette sauvegarde est faite le lundi.</li><li>j&#8217;ai 6 répertoires nommés : <em>&lt;jour&gt;_&lt;date au format jj-mm-aaaa&gt;</em> contenant les sauvegardes incrémentales de la semaine.</li></ul><p
style="text-align: justify;">J&#8217;ai modifié le script pour ajouter une conservation des <strong>sauvegardes de 4 semaines</strong>.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;">#!/bin/bash</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># - By default, the full backup is made monday, you can specify another day</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; by entering a number from 1 to 7 (1 is monday, 2 is tuesday ...) </span><br
/> <span
style="color: #666666; font-style: italic;">#FULL_DAY=1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># - BACKUP_LIST is a text file where you specify files/directories you </span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; want to backup (one per line), the paths on this file must be relative </span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; to the path set in BACKUP_ROOT</span><br
/> <span
style="color: #007800;">BACKUP_ROOT</span>=<span
style="color: #000000; font-weight: bold;">/</span><br
/> <span
style="color: #007800;">BACKUP_LIST</span>=<span
style="color: #ff0000;">&quot;/home/backuper/scripts/backup_list_files&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Excludes file</span><br
/> <span
style="color: #666666; font-style: italic;"># - Contains one wildcard pattern per line of files to exclude</span><br
/> <span
style="color: #666666; font-style: italic;"># - This is a rsync exclude file. See the rsync man page. &nbsp;</span><br
/> <span
style="color: #007800;">EXCLUDES_LIST</span>=<span
style="color: #ff0000;">&quot;/home/backuper/scripts/backup_exclude_files&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Hostname or IP adress of the remote backup server</span><br
/> <span
style="color: #007800;">BACKUP_SRV</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Port SSH</span><br
/> <span
style="color: #007800;">SSH_PORT</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Root directory that stores backups on the remote server</span><br
/> <span
style="color: #007800;">ARCHIVE_ROOT</span>=~<span
style="color: #000000; font-weight: bold;">/</span>files<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Remote user. Used by ssh. This is the user who connects to the remote backup server </span><br
/> <span
style="color: #666666; font-style: italic;"># Must have write access on $ARCHIVE_ROOT</span><br
/> <span
style="color: #007800;">REMOTE_USER</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Mail address for status updates</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;- This is used to email you a status report</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;- Comment it if you don't want to mail the report</span><br
/> <span
style="color: #007800;">MAILADDR</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Log file</span><br
/> <span
style="color: #007800;">LOGFILE</span>=<span
style="color: #ff0000;">&quot;/home/backuper/backup-files.log&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># HOSTNAME</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;This is used for creating a directory specific to this host on the remote host</span><br
/> <span
style="color: #007800;">HOSTNAME</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(hostname)</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#########################################</span><br
/> <span
style="color: #666666; font-style: italic;"># From here on out, you probably don't &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; want to change anything unless you &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; know what you're doing. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</span><br
/> <span
style="color: #666666; font-style: italic;">#########################################</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">touch</span> <span
style="color: #007800;">$LOGFILE</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Calculate WEEK_NUM</span><br
/> <span
style="color: #666666; font-style: italic;"># - This is the week number of year, it depends on the variable FULL_DAY</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;the value of FULL_DAY is considered as the first day of week</span><br
/> <span
style="color: #666666; font-style: italic;"># - By default the command `date +%W` considers monday as first day of week, so if the day of</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;the full backup is different from monday then we must make additional operations</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #660033;">-le</span> <span
style="color: #000000;">7</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>u<span
style="color: #000000; font-weight: bold;">`</span> <span
style="color: #660033;">-ge</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span> <br
/> &nbsp; <span
style="color: #007800;">WEEK_NUM</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> $<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>W<span
style="color: #7a0874; font-weight: bold;">&#41;</span> + <span
style="color: #000000;">1</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #007800;">WEEK_NUM</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>W<span
style="color: #000000; font-weight: bold;">`</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># ARCHIVE_DIR</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;This is the directory (full path) of the current week backups (on the remote host)</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;The name of directory indicates the number of the week in the year (e.g 2007-32)</span><br
/> <span
style="color: #007800;">ARCHIVE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #780078;">`date +%Y`</span>-<span
style="color: #007800;">$WEEK_NUM</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Directory which holds our current datastore</span><br
/> <span
style="color: #007800;">CURRENT</span>=main<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Directory which we save incremental changes to (e.g monday_06-08-2007)</span><br
/> <span
style="color: #007800;">INCREMENTDIR</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>A_<span
style="color: #000000; font-weight: bold;">%</span>d-<span
style="color: #000000; font-weight: bold;">%</span>m-<span
style="color: #000000; font-weight: bold;">%</span>Y<span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Options to pass to rsync</span><br
/> <span
style="color: #666666; font-style: italic;"># -r for recursivity must be explicite in spite of -a because --files-from (see man rsync)</span><br
/> <span
style="color: #007800;">OPTIONS</span>=<span
style="color: #ff0000;">&quot;--force --ignore-errors --delete --delete-excluded <span
style="color: #000099; font-weight: bold;">\<br
/> </span> --exclude-from=<span
style="color: #007800;">$EXCLUDES_LIST</span> --backup --backup-dir=<span
style="color: #007800;">$ARCHIVE_DIR</span>/<span
style="color: #007800;">$INCREMENTDIR</span> <span
style="color: #000099; font-weight: bold;">\<br
/> </span> -arhv --files-from=<span
style="color: #007800;">$BACKUP_LIST</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Our actual rsyncing function</span><br
/> do_rsync<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; rsync <span
style="color: #660033;">-e</span> <span
style="color: #ff0000;">&quot;ssh -p <span
style="color: #007800;">$SSH_PORT</span>&quot;</span> <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$BACKUP_ROOT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span>:<span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000;">2</span><span
style="color: #000000; font-weight: bold;">&gt;&amp;</span><span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; rsync <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$BACKUP_ROOT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span>:<span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000;">2</span><span
style="color: #000000; font-weight: bold;">&gt;&amp;</span><span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp;<span
style="color: #7a0874; font-weight: bold;">return</span> <br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Our post rsync accounting function</span><br
/> do_accounting<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$1</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Backup accounting for day <span
style="color: #007800;">$INCREMENTDIR</span> on <span
style="color: #007800;">$HOSTNAME</span>:&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #660033;">-p</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">du</span> <span
style="color: #660033;">-s</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/*</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">du</span> <span
style="color: #660033;">-s</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/*</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">cat</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">grep</span> <span
style="color: #ff0000;">&quot;rsync: &quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Mail $1 -s &quot;</span><span
style="color: #007800;">$HOSTNAME</span> Backup Report<span
style="color: #ff0000;">&quot; &lt; /tmp/rsync_script_tmpfile&quot;</span><br
/> &nbsp; &nbsp; mail <span
style="color: #007800;">$1</span> <span
style="color: #660033;">-s</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$HOSTNAME</span> Backup Report&quot;</span> <span
style="color: #000000; font-weight: bold;">&lt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm /tmp/rsync_script_tmpfile&quot;</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Clean old backups</span><br
/> do_clean<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Nb weeks</span><br
/> &nbsp; &nbsp; <span
style="color: #007800;">NB_WEEKS_MAX</span>=<span
style="color: #000000;">4</span><br
/> &nbsp; &nbsp; <span
style="color: #007800;">LIMIT</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #007800;">$WEEK_NUM</span> - <span
style="color: #007800;">$NB_WEEKS_MAX</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$LIMIT</span> <span
style="color: #660033;">-le</span> <span
style="color: #000000;">0</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">NB</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #007800;">$NB_WEEKS_MAX</span> - <span
style="color: #007800;">$WEEK_NUM</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">NB</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #000000;">52</span> - <span
style="color: #007800;">$NB</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">LAST_YEAR</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> $<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>Y<span
style="color: #7a0874; font-weight: bold;">&#41;</span> - <span
style="color: #000000;">1</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">TO_DELETE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #007800;">$LAST_YEAR</span>-<span
style="color: #007800;">$NB</span>&quot;</span><br
/> <br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TO_DELETE_DIR</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm -rf <span
style="color: #007800;">$TO_DELETE_DIR</span>&quot;</span> &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-rf</span> <span
style="color: #007800;">$TO_DELETE_DIR</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">TO_DELETE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #780078;">`date +%Y`</span>-<span
style="color: #007800;">$LIMIT</span>&quot;</span><br
/> <br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TO_DELETE_DIR</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm -rf <span
style="color: #007800;">$TO_DELETE_DIR</span>&quot;</span> &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-rf</span> <span
style="color: #007800;">$TO_DELETE_DIR</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Some error handling and/or run our backup and accounting</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$BACKUP_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$EXCLUDES_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$BACKUP_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$EXCLUDES_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># make sure our backup tree exists</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #660033;">-p</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">install</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">install</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;=========================================================&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #780078;">`date`</span> : Backup started.&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; do_rsync <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$?</span> <span
style="color: #660033;">-eq</span> <span
style="color: #000000;">0</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;OK. Backup succeeded&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do_clean<br
/> &nbsp; &nbsp; do_accounting <span
style="color: #007800;">$MAILADDR</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">0</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Backup failed. See <span
style="color: #007800;">$LOGFILE</span> for debug info.&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; do_accounting <span
style="color: #007800;">$MAILADDR</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$EXCLUDES_LIST</span>: File not found or not a regular file. Backup aborted&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span>; <br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$BACKUP_LIST</span>: File not found or not a regular file. Backup aborted&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;You must edit the script file and set the variable EXCLUDES_LIST&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;You must edit the script file and set the variable BACKUP_LIST&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">2</span></div></div><p
style="text-align: justify;">Je sauvegarde ces fichiers :</p><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var/www<br
/> var/log<br
/> etc/apache2<br
/> etc/apt/sources.list<br
/> etc/fstab<br
/> etc/crontab<br
/> etc/hostname<br
/> etc/hosts<br
/> etc/group<br
/> etc/memcached.conf<br
/> etc/mysql<br
/> etc/nginx<br
/> etc/php5<br
/> etc/phpmyadmin<br
/> etc/postfix<br
/> etc/ssh<br
/> etc/fail2ban<br
/> home</div></div><p
style="text-align: justify;">Et j&#8217;exclue ceux-là :</p><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">home/backuper/backup-files.log<br
/> home/backuper/files<br
/> etc/mysql/debian.cnf<br
/> etc/ssh/ssh_host*<br
/> etc/phpmyadmin/htpasswd.setup<br
/> .*_history<br
/> .Xauthority<br
/> .lesshst<br
/> .ssh</div></div><p
style="text-align: justify;"></p><h2>Automatisation</h2><p
style="text-align: justify;">J&#8217;ai rajouté dans mon <em>crontab</em>, deux lignes pour lancer les sauvegardes différées de 2h :</p><p
style="text-align: justify;"></p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000;">0</span> <span
style="color: #000000;">1</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">/</span>home<span
style="color: #000000; font-weight: bold;">/</span>backuper<span
style="color: #000000; font-weight: bold;">/</span>scripts<span
style="color: #000000; font-weight: bold;">/</span>backup_mysql.sh<br
/> <span
style="color: #000000;">0</span> <span
style="color: #000000;">3</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">/</span>home<span
style="color: #000000; font-weight: bold;">/</span>backuper<span
style="color: #000000; font-weight: bold;">/</span>scripts<span
style="color: #000000; font-weight: bold;">/</span>backup_files.sh</div></div><p></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/' title='Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL'>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</a></li><li><a
href='http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/' title='Gravatar : De beaux avatars dans les commentaires'>Gravatar : De beaux avatars dans les commentaires</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;bodytext=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;notes=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;t=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;annotation=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;t=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;body=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;submitHeadline=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;submitSummary=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 1/28 queries in 0.017 seconds using memcached
Object Caching 2411/2471 objects using memcached

Served from: www.willdurand.fr @ 2012-02-06 09:37:21 -->
