<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
<id>https://blog.hbis.fr/</id>
<title>Blog de Boris HUISGEN</title>
<author>
<name>Boris HUISGEN</name>

<email>bhuisgen@hbis.fr</email>
</author>
<rights>Boris HUISGEN</rights>


<icon>/logo128.png</icon>
<logo>/logo.png</logo>
<updated>2026-06-09T03:43:28Z</updated>
<link rel="self" type="application/atom+xml" href="https://blog.hbis.fr/fr/index.atom" hreflang="fr"/>
<link rel="alternate" type="text/html" href="https://blog.hbis.fr/" hreflang="fr"/>
<entry>
<title>Coder votre projet ESP8266 avec CLion IDE</title>

<id>https://blog.hbis.fr/2019/10/01/esp8266-cmake-clion/</id>
<updated>2019-10-01T20:54:59.000Z</updated>
<published>2019-10-01T20:54:59.000Z</published>
<summary type="text">La prochaine version du SDK [RTOS](https://github.com/espressif/ESP8266_RTOS_SDK) - version 4 et plus - va utiliser CMake comme outil de build par défaut mais il est déjà présent dans la version 3.2. Ainsi, il est déjà possible d'utiliser l'IDE CLion pour coder votre projet. Cet article va vous expliquer comment configurer votre IDE favori dans ce but.</summary>
<content type="html">&lt;p&gt;La prochaine version du SDK &lt;a href=&#34;https://github.com/espressif/ESP8266_RTOS_SDK&#34;&gt;RTOS&lt;/a&gt; - version 4 et plus - va utiliser CMake comme outil de build par défaut mais il est déjà présent dans la version 3.2. Ainsi, il est déjà possible d&amp;rsquo;utiliser l&amp;rsquo;IDE CLion pour coder votre projet. Cet article va vous expliquer comment configurer votre IDE favori dans ce but.&lt;/p&gt;

&lt;h2 id=&#34;create-your-project&#34;&gt;Créer votre project&lt;/h2&gt;

&lt;p&gt;Copiez en premier lieu le squelette de project &lt;code&gt;getting-started&lt;/code&gt; présent dans le répertoire &lt;code&gt;exemple&lt;/code&gt; du SDK ESP.&lt;/p&gt;

&lt;p&gt;Ouvrez le répertoire dans CLion. Il sera détecté comme un projet CMake.&lt;/p&gt;

&lt;h2 id=&#34;configure-a-new-toolchain&#34;&gt;Configurer une nouvelle toolchain&lt;/h2&gt;

&lt;p&gt;&lt;img src=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1.png&#34; alt=&#34;Build toolchain&#34; width=&#34;1189&#34; height=&#34;779&#34; srcset=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1-100.png 100w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1-200.png 200w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1-500.png 500w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1-800.png 800w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image1.png 1189w&#34; sizes=&#34;(max-width: 320px) 200px, (max-width: 768px) 500px, (min-width: 768px) 800px&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Ouvrez les paramètres de l&amp;rsquo;IDE, rubrique &lt;strong&gt;Build, Execution, Deployment / Toolchains&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Créer la toolchain &lt;code&gt;xtensa-lx106-elf&lt;/code&gt; et spécifiez les répertoires requis aux outils de compilation &lt;code&gt;gcc&lt;/code&gt; et &lt;code&gt;g++&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;configure-the-cmake-profile&#34;&gt;Configurer le profil CMake&lt;/h2&gt;

&lt;p&gt;&lt;img src=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2.png&#34; alt=&#34;Build CMake profile&#34; width=&#34;1189&#34; height=&#34;779&#34; srcset=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2-100.png 100w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2-200.png 200w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2-500.png 500w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2-800.png 800w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image2.png 1189w&#34; sizes=&#34;(max-width: 320px) 200px, (max-width: 768px) 500px, (min-width: 768px) 800px&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Toujours dans les paramètres, rendez-vous à la rubrique &lt;strong&gt;Build, Execution, Deployment / CMake&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sélectionnez la nouvelle toolchain &lt;code&gt;xtensa-lx106-elf&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Ajoutez l&amp;rsquo;option CMake:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-DIDF_PATH=/home/boris/.local/share/ESP8266_RTOS_SDK
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Ajoutez les variables d&amp;rsquo;environnement:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;IDF_PATH=/home/boris/.local/share/ESP8266_RTOS_SDK;PATH=/home/boris/.local/share/xtensa-lx106-elf/bin
BATCH_BUILD=1
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;configure-the-ide-terminal&#34;&gt;Configurer le terminal de l&amp;rsquo;IDE&lt;/h2&gt;

&lt;p&gt;&lt;img src=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3.png&#34; alt=&#34;Terminal configuration&#34; width=&#34;1189&#34; height=&#34;779&#34; srcset=&#34;https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3-100.png 100w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3-200.png 200w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3-500.png 500w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3-800.png 800w, https://blog-storage.hbis.fr/content/default/content/post/esp8266-cmake-clion/image3.png 1189w&#34; sizes=&#34;(max-width: 320px) 200px, (max-width: 768px) 500px, (min-width: 768px) 800px&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Rendez-vous à la rubrique &lt;strong&gt;Tools / Terminal&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Configurez l&amp;rsquo;environnement du terminal:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;IDF_PATH=/home/boris/.local/share/ESP8266_RTOS_SDK
PATH=/home/boris/.local/share/xtensa-lx106-elf/bin:/usr/bin:/bin:/home/boris/.local/share/ESP8266_RTOS_SDK/tools
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;reload-the-project&#34;&gt;Recharger le project&lt;/h2&gt;

&lt;p&gt;Rechargez le project CMake par clic droit sur le nom du project dans la vue project et vérifiez qu&amp;rsquo;aucune erreur CMake
n&amp;rsquo;est générée.&lt;/p&gt;

&lt;p&gt;Vous pouvez à présenter générer le projet.&lt;/p&gt;

&lt;h2 id=&#34;flash-your-device&#34;&gt;Flasher votre périphérique&lt;/h2&gt;

&lt;p&gt;Pour flasher le firmware à votre périphérique ESP, sélectionnez la configuration de build &lt;code&gt;flash&lt;/code&gt; et exécutez-la.&lt;/p&gt;

&lt;p&gt;Vous pouvez également ouvrir le terminal de l&amp;rsquo;IDE et exécutez la commande équivalente:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ idf.py flash monitor
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Il ne vous reste plus qu&amp;rsquo;à coder!&lt;/p&gt;
</content>
</entry>
<entry>
<title>Singleton thread-safe en Python</title>

<id>https://blog.hbis.fr/2019/03/23/python-singleton/</id>
<updated>2019-03-23T14:12:05.000Z</updated>
<published>2019-03-23T14:12:05.000Z</published>
<summary type="text">Le singleton est probablement le design pattern le plus utilisé pour limiter la consommation des ressources comme le nombre de connexions aux bases de données ou tout autre service. Son implémentation est relativement simple mais elle peut rapidement devenir source d'ennuis si le code doit être thread-safe.</summary>
<content type="html">&lt;p&gt;Le singleton est probablement le design pattern le plus utilisé pour limiter la consommation des ressources comme le nombre de connexions aux bases de données ou tout autre service. Son implémentation est relativement simple mais elle peut rapidement devenir source d&amp;rsquo;ennuis si le code doit être thread-safe.&lt;/p&gt;

&lt;p&gt;Un code thread-safe est généralement garanti par utilisation d&amp;rsquo;un système de synchronisation comme un verrou dont Python possède grâce à sa primitive &lt;a href=&#34;https://docs.python.org/3/library/threading.html#lock-objects&#34;&gt;Lock&lt;/a&gt; du module &lt;a href=&#34;https://docs.python.org/3/library/threading.html&#34;&gt;threading&lt;/a&gt;, mais une autre astuce est nécessaire pour un support thread-safe.&lt;/p&gt;

&lt;h2 id=&#34;implementation&#34;&gt;Implémentation&lt;/h2&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;logging&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 2&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;threading&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 3&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 4&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 5&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;None&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 6&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;_lock&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;threading&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Lock&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;threading&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Lock&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 7&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 8&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;fm&#34;&gt;__new__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;cls&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 9&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Create a new instance&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;is&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;None&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;k&#34;&gt;with&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_lock&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;is&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;None&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;                    &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;super&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;cls&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;fm&#34;&gt;__new__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;cls&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;14&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;                    &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_initialized&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;15&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;16&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;17&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;18&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;fm&#34;&gt;__init__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;19&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Initialize the instance&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;20&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_initialized&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;is&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;False&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;21&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_logger&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;logging&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;getLogger&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;vm&#34;&gt;__class__&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;vm&#34;&gt;__name__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;22&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_count&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;23&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_initialized&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;True&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;24&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;25&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_logger&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;debug&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;using instance: &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;%s&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;%&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_instance&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;26&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;27&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;increment&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;28&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Increment the counter&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;29&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_count&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;30&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;31&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_logger&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;debug&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;count = &lt;/span&gt;&lt;span class=&#34;si&#34;&gt;%d&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;%&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;_count&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;L&amp;rsquo;astuce est donc d&amp;rsquo;utiliser un verrou combiné à un autre objet qui va conserver l&amp;rsquo;instance partagée de votre classe singleton.&lt;/p&gt;

&lt;h2 id=&#34;test&#34;&gt;Test&lt;/h2&gt;

&lt;p&gt;Pour tester son fonctionnement, lancez une console Python:&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;code&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;logging&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;basicConfig&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;level&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;logging&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;handlers&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;logging&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;StreamHandler&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;using&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;instance&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;__main__&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;at&lt;/span&gt; &lt;span class=&#34;mh&#34;&gt;0x7f8bee80c550&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;b&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;using&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;instance&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;__main__&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;at&lt;/span&gt; &lt;span class=&#34;mh&#34;&gt;0x7f8bee80c550&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;increment&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;count&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;increment&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;count&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;increment&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;DEBUG&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;MySingleton&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;count&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Comme vous pouvez le voir, les instances &lt;em&gt;a&lt;/em&gt; et &lt;em&gt;b&lt;/em&gt; sont identiques.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Générer un certificat wilcard Let's Encrypt</title>

<id>https://blog.hbis.fr/2018/10/28/letsencrypt-wildcard-certificate/</id>
<updated>2018-10-28T14:08:10.000Z</updated>
<published>2018-10-28T14:08:10.000Z</published>
<summary type="text">Un certificat wildcard est utile pour protéger plusieurs services avec des alias différents du même nom de domaine, en lieu et place d'un certificat différent par alias. Let's Encrypt propose à présent un tel service gratuitement.</summary>
<content type="html">&lt;p&gt;Un certificat wildcard est utile pour protéger plusieurs services avec des alias différents du même nom de domaine, en lieu et place d&amp;rsquo;un certificat différent par alias. Let&amp;rsquo;s Encrypt propose à présent un tel service gratuitement.&lt;/p&gt;

&lt;p&gt;La création du certificat &lt;a href=&#34;https://letsencrypt.org/fr/&#34;&gt;Let&amp;rsquo;s Encrypt&lt;/a&gt; est effectuée avec le client CLI &lt;a href=&#34;https://certbot.eff.org&#34;&gt;certbot&lt;/a&gt; qu&amp;rsquo;il convient d&amp;rsquo;installer selon votre distribution:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo apt install certbot
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Un répertoire de travail doit être créer pour stocker les différents fichiers :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ mkdir -p ~/certbot/{config,work,logs}
$ cd ~/certbot
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pour générer un certificat, lancez la commande suivante en spécifiant votre nom de domaine sans aucun alias :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ certbot certonly --config-dir config/ --work-dir work/ --logs-dir logs/ \
    --server https://acme-v02.api.letsencrypt.org/directory --manual \
    -d &#39;*.monsite.fr&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Le processus de création vous invitera à ajouter un enregistrement à la zone DNS du domaine. Une fois effectué, le certificat sera généré dans votre répertoire. Il conviendra de réutiliser cette même commande pour le renouveler avant sa date d&amp;rsquo;expiration.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Interface réseau dummy avec NetworkManager</title>

<id>https://blog.hbis.fr/2018/03/12/networkmanager-dummy-interface/</id>
<updated>2018-03-12T21:57:01.000Z</updated>
<published>2018-03-12T21:57:01.000Z</published>
<summary type="text">La création d'une interface réseau `dummy` permet de simplifier la gestion des services locaux d'un hôte en leur permettant d'être attaché à une adresse IP fixe, et par extension de disposer d'un réseau virtuel.</summary>
<content type="html">&lt;p&gt;La création d&amp;rsquo;une interface réseau &lt;code&gt;dummy&lt;/code&gt; permet de simplifier la gestion des services locaux d&amp;rsquo;un hôte en leur permettant d&amp;rsquo;être attaché à une adresse IP fixe, et par extension de disposer d&amp;rsquo;un réseau virtuel.&lt;/p&gt;

&lt;p&gt;Pour ajouter une interface dummy avec &lt;a href=&#34;https://wiki.gnome.org/Projects/NetworkManager&#34;&gt;NetworkManager&lt;/a&gt;, une nouvelle connexion doit être créer:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo vim /etc/Network/Manager/dummy
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;[connection]
id=dummy
uuid=6ad57828-f873-4e4c-9ebd-ac3f49b99cbe
type=dummy
interface-name=dummy0
permissions=
timestamp=1520895027

[ipv4]
address1=169.254.1.1/24
dns-search=
method=manual

[ipv6]
addr-gen-mode=eui64
dns-search=
method=ignore
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;La configuration peut être appliquée à chaud :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo nmcli connection reload
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;L&amp;rsquo;interface réseau doit être disponible :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ip addr show dummy0
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;5: dummy0: &amp;lt;BROADCAST,NOARP,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 26:ed:f7:10:de:ba brd ff:ff:ff:ff:ff:ff
inet 169.254.1.1/24 brd 169.254.1.255 scope link noprefixroute dummy0
valid_lft forever preferred_lft forever
inet6 fe80::24ed:f7ff:fe10:deba/64 scope link
valid_lft forever preferred_lft forever
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Il vous reste à attacher vos services réseaux sur cette interface.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Gestion des zones DNS Gandi avec Terraform</title>

<id>https://blog.hbis.fr/2018/01/01/terraform-gandi-livedns/</id>
<updated>2018-01-01T19:03:10.000Z</updated>
<published>2018-01-01T19:03:10.000Z</published>
<summary type="text">La gestion des zones DNS Gandi avec Terraform est possible grâce à un module open-source.</summary>
<content type="html">&lt;p&gt;La gestion des zones DNS Gandi avec Terraform est possible grâce à un module open-source.&lt;/p&gt;

&lt;h2 id=&#34;installation-du-provider&#34;&gt;Installation du provider&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ go get github.com/tiramiseb/terraform-provider-gandi
$ cd $GOPATH/go/src/github.com/tiramiseb/terraform-provider-gandi
$ go build -o terraform-provider-gandi
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Comme indiqué dans la documentation du &lt;a href=&#34;https://github.com/go-gandi/terraform-provider-gandi&#34;&gt;module&lt;/a&gt;, seules sont supportées les zones &lt;em&gt;LiveDNS&lt;/em&gt; de la nouvelle infrastructure DNS. Il convient donc de migrer vos anciennes zones le cas échéant. Une clé API est également à générer pour permettre les modifications distantes depuis Terraform.&lt;/p&gt;

&lt;h2 id=&#34;projet-terraform&#34;&gt;Projet Terraform&lt;/h2&gt;

&lt;p&gt;Débutons par la création du projet Terraform :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ mkdir ~/Projects/terraform-gandi-dns
$ cd ~/Projects/terraform-gandi-dns
$ touch main.tf providers.tf variables.tf outputs.tf terraform.tfvars
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Fichier &lt;code&gt;provider.tf&lt;/code&gt; :&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;provider&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;key&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;var&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;gandi_key&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Fichier &lt;code&gt;variable.tf&lt;/code&gt; :&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;variable&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi_key&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Fichier &lt;code&gt;main.tf&lt;/code&gt; :&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;resource&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi_zone&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;hbis_fr&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 2&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;name&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;hbis.fr&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 3&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 4&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 5&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;resource&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi_domainattachment&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;hbis_fr&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 6&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;domain&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;hbis.fr&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 7&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;zone&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;gandi_zone&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;hbis_fr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;id&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 8&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt; 9&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;resource&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi_zonerecord&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;root&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;zone&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;gandi_zone&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;hbis_fr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;id&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;name&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;@&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;type&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;A&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;14&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;ttl&lt;/span&gt; = &lt;span class=&#34;m&#34;&gt;3600&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;15&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;values&lt;/span&gt; = &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;16&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s2&#34;&gt;&amp;#34;51.15.171.130&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;17&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;18&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;19&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;20&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kr&#34;&gt;resource&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;gandi_zonerecord&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;www&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;21&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;zone&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;gandi_zone&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;hbis_fr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;id&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;22&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;name&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;www&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;23&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;type&lt;/span&gt; = &lt;span class=&#34;s2&#34;&gt;&amp;#34;A&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;24&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;ttl&lt;/span&gt; = &lt;span class=&#34;m&#34;&gt;3600&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;25&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;na&#34;&gt;values&lt;/span&gt; = &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;26&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;s2&#34;&gt;&amp;#34;51.15.171.130&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;27&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;28&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;En plus du code des ressources, une variable Terraform sera utilisée pour fournir la clé API.&lt;/p&gt;

&lt;h2 id=&#34;importation-de-la-zone-dns&#34;&gt;Importation de la zone DNS&lt;/h2&gt;

&lt;p&gt;Le projet est à initialiser :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Avant de débuter l&amp;rsquo;importation, l&amp;rsquo;étape essentielle est de récupérer l&amp;rsquo;identifiant de la zone en utilisant l&amp;rsquo;API Gandi:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ curl -s -H &amp;quot;Content-Type: application/json&amp;quot; -H &amp;quot;X-Api-Key: ******&amp;quot; https://dns.api.gandi.net/api/v5/zones|jq -r
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;[
  {
    &amp;quot;retry&amp;quot;: 3600,
    &amp;quot;uuid&amp;quot;: &amp;quot;72e4069e-eeef-11e7-8db5-00163e6dc886&amp;quot;,
    &amp;quot;zone_href&amp;quot;: &amp;quot;https://dns.api.gandi.net/api/v5/zones/72e4069e-eeef-11e7-8db5-00163e6dc886&amp;quot;,
    &amp;quot;minimum&amp;quot;: 10800,
    &amp;quot;domains_href&amp;quot;: &amp;quot;https://dns.api.gandi.net/api/v5/zones/72e4069e-eeef-11e7-8db5-00163e6dc886/domains&amp;quot;,
    &amp;quot;refresh&amp;quot;: 10800,
    &amp;quot;zone_records_href&amp;quot;: &amp;quot;https://dns.api.gandi.net/api/v5/zones/72e4069e-eeef-11e7-8db5-00163e6dc886/records&amp;quot;,
    &amp;quot;expire&amp;quot;: 604800,
    &amp;quot;sharing_id&amp;quot;: &amp;quot;4aace8e0-b393-11e7-bcf1-00163ec388ae&amp;quot;,
    &amp;quot;serial&amp;quot;: 1514825087,
    &amp;quot;email&amp;quot;: &amp;quot;hostmaster.gandi.net.&amp;quot;,
    &amp;quot;primary_ns&amp;quot;: &amp;quot;ns1.gandi.net&amp;quot;,
    &amp;quot;name&amp;quot;: &amp;quot;hbis.fr&amp;quot;
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;La valeur UUID est l&amp;rsquo;identifiant à récupérer pour lancer l&amp;rsquo;importation de la ressource &lt;code&gt;gandi_zone&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform import -var &#39;gandi_key=******&#39; gandi_zone.hbis_fr 72e4069e-eeef-11e7-8db5-00163e6dc886
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Terraform devrait avoir confirmer l&amp;rsquo;importation de la ressource dans son fichier d&amp;rsquo;état, ce qui peut-être vérifié :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform show
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;gandi_zone.hbis_fr:
id = 72e4069e-eeef-11e7-8db5-00163e6dc886
name = hbis.fr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;La ressource &lt;code&gt;gandi_domainattachment&lt;/code&gt; est également à importer:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform import -var &#39;gandi_key=******&#39; gandi_domainattachment.hbis_fr hbis.fr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Si des alias DNS sont déjà existants, ils seront également à importer. L&amp;rsquo;identifiant interne des ressources &lt;code&gt;gandi_zonerecord&lt;/code&gt; a le format : &amp;lt;UUID&amp;gt;/&amp;lt;NAME&amp;gt;/&amp;lt;TYPE&amp;gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform import -var &#39;gandi_key=******&#39; gandi_zonerecord.root 72e4069e-eeef-11e7-8db5-00163e6dc886/@/A
$ terraform import -var &#39;gandi_key=******&#39; gandi_zonerecord.blog 72e4069e-eeef-11e7-8db5-00163e6dc886/www/A
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;verification-du-plan&#34;&gt;Vérification du plan&lt;/h2&gt;

&lt;p&gt;Le fichier d&amp;rsquo;état étant peuplé de toutes les ressources nécessaires, vérifiez que le plan ne requiert aucune modification :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ terraform plan -var &#39;gandi_key=******&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Vous pouvez à présent gérer votre zone et ses enregistrements depuis votre projet Terraform.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Plugin Maven de build Docker</title>

<id>https://blog.hbis.fr/2017/10/22/docker-maven-plugin-0-2-0/</id>
<updated>2017-10-22T16:58:40.000Z</updated>
<published>2017-10-22T16:58:40.000Z</published>
<summary type="text">Suite à un besoin professionnel, j'ai développer un plugin Maven pour générer les images Docker de certains projets Java. Je viens de publier la version 0.2.0 qui fixe quelques problèmes.</summary>
<content type="html">&lt;p&gt;Suite à un besoin professionnel, j&amp;rsquo;ai développer un plugin Maven pour générer les images Docker de certains projets Java. Je viens de publier la version 0.2.0 qui fixe quelques problèmes.&lt;/p&gt;

&lt;p&gt;Le plugin est disponible sur ce dépôt &lt;a href=&#34;https://github.com/bhuisgen/docker-maven-plugin&#34;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Forcer Debian apt en IPv4</title>

<id>https://blog.hbis.fr/2017/10/13/debian-apt-force-ipv4/</id>
<updated>2017-10-13T20:56:21.000Z</updated>
<published>2017-10-13T20:56:21.000Z</published>
<summary type="text">La commande Debian `apt` a parfois tendance à poser problème sur des hosts en configuration réseau dual-stack IPv4 et IPv6. Pour y remédier, il convient de forcer l'utilisation d'IPv4.</summary>
<content type="html">&lt;p&gt;La commande Debian &lt;code&gt;apt&lt;/code&gt; a parfois tendance à poser problème sur des hosts en configuration réseau dual-stack IPv4 et IPv6. Pour y remédier, il convient de forcer l&amp;rsquo;utilisation d&amp;rsquo;IPv4.&lt;/p&gt;

&lt;p&gt;L&amp;rsquo;activation du mode forcé IPv4 permet d&amp;rsquo;éviter les lenteurs et échecs réseaux et au final garantir la récupération des mises à jour.&lt;/p&gt;

&lt;p&gt;Une option est à ajouter à votre configuration :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# echo &#39;Acquire::ForceIPv4 &amp;quot;true&amp;quot;;&#39; &amp;gt; /etc/apt/apt.conf.d/99forceipv4
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Supprimer un fichier sensible d'un dépôt Git</title>

<id>https://blog.hbis.fr/2017/07/22/git-remove-sensitive-data/</id>
<updated>2017-07-22T21:31:49.000Z</updated>
<published>2017-07-22T21:31:49.000Z</published>
<summary type="text">Parfois, un fichier sensible tel une clé, un token ou encore un certificat, se retrouve ajouté par erreur dans un dépôt Git. Seule solution faire une passe complète des commits pour le supprimer.</summary>
<content type="html">&lt;p&gt;Parfois, un fichier sensible tel une clé, un token ou encore un certificat, se retrouve ajouté par erreur dans un dépôt Git. Seule solution faire une passe complète des commits pour le supprimer.&lt;/p&gt;

&lt;p&gt;Pour filtrer un fichier à supprimer, utilisez la commande &lt;code&gt;git&lt;/code&gt; suivante :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# git filter-branch --force \
   --index-filter &#39;git rm --cached --ignore-unmatch path/to/file&#39; \
   --prune-empty --tag-name-filter cat -- --all
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Le dépôt devra par la suite être republié par force push.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Activer IPv6 sur une instance EC2 Debian</title>

<id>https://blog.hbis.fr/2017/05/08/ec2-debian-ipv6/</id>
<updated>2017-05-08T11:13:04.000Z</updated>
<published>2017-05-08T11:13:04.000Z</published>
<summary type="text">Suite à l'assignation d'un bloc IPv6 à votre VPC et aux subnets réseaux, il reste à activer le support IPv6 sur chaque instance EC2.</summary>
<content type="html">&lt;p&gt;Suite à l&amp;rsquo;assignation d&amp;rsquo;un bloc IPv6 à votre VPC et aux subnets réseaux, il reste à activer le support IPv6 sur chaque instance EC2.&lt;/p&gt;

&lt;p&gt;Dans le cas d&amp;rsquo;une distribution Debian, l&amp;rsquo;activation de l&amp;rsquo;IPv6 s&amp;rsquo;effectue en ajoutant la ligne suivante au fichier de configuration des interfaces réseaux:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/network/interfaces
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;auto eth0
iface eth0 inet dhcp
   post-up sleep 2
iface eth0 inet6 dhcp
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;L&amp;rsquo;instance est ensuite à redémarrer.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Nettoyer les branches Git locales</title>

<id>https://blog.hbis.fr/2017/04/10/git-clean-local-branches/</id>
<updated>2017-04-10T21:34:36.000Z</updated>
<published>2017-04-10T21:34:36.000Z</published>
<summary type="text">Suite à l'évolution d'un dépôt git, les branches sont supprimées au fur et à mesure sur le serveur. Cependant, les anciennes branches locales demeurent côté client et il est également nécessaire de les supprimer en veillant à ne supprimer aucune branche active.</summary>
<content type="html">&lt;p&gt;Suite à l&amp;rsquo;évolution d&amp;rsquo;un dépôt git, les branches sont supprimées au fur et à mesure sur le serveur. Cependant, les anciennes branches locales demeurent côté client et il est également nécessaire de les supprimer en veillant à ne supprimer aucune branche active.&lt;/p&gt;

&lt;p&gt;Voici la commande &lt;code&gt;git&lt;/code&gt; pour supprimer toutes les branches locales fusionnées et déjà supprimées sur le serveur :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ git branch -r | \
    awk &#39;{print $1}&#39; | \
    egrep -v -f /dev/fd/0 &amp;lt;(git branch -vv | grep origin) | \
    awk &#39;{print $1}&#39; | \
    xargs git branch -d
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Installation de Kodi 17.1 sur RaspberryPI</title>

<id>https://blog.hbis.fr/2017/04/02/raspbian-kodi-17-1/</id>
<updated>2017-04-02T15:56:45.000Z</updated>
<published>2017-04-02T15:56:45.000Z</published>

<content type="html">&lt;p&gt;Un dépôt de paquets est disponible pour installer facilement Kodi sur RaspberryPI.&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;La procédure d&amp;rsquo;installation se limite aux commandes suivantes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# echo &#39;deb http://pipplware.pplware.pt/pipplware/dists/jessie/main/binary /&#39; | sudo tee --append /etc/apt/sources.list.d/pipplware_jessie.list
# wget -O - http://pipplware.pplware.pt/pipplware/key.asc | apt-key add -
# apt update
# apt install kodi
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Zabbix-docker 0.2.1</title>

<id>https://blog.hbis.fr/2017/03/11/zabbix-docker-0-2-1/</id>
<updated>2017-03-11T19:54:58.000Z</updated>
<published>2017-03-11T19:54:58.000Z</published>
<summary type="text">Zabbix-docker est un agent de monitoring des containers Docker pour Zabbix permettant de récupérer l'ensemble des métriques des containers d'un host particulier ou d'un cluster.</summary>
<content type="html">&lt;p&gt;Zabbix-docker est un agent de monitoring des containers Docker pour Zabbix permettant de récupérer l&amp;rsquo;ensemble des métriques des containers d&amp;rsquo;un host particulier ou d&amp;rsquo;un cluster.&lt;/p&gt;

&lt;p&gt;Les métriques actuellement supportées sont :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;le statut des containers dont le healthcheck&lt;/li&gt;
&lt;li&gt;les statistiques RAM, CPU, des interfaces réseau et des périphériques de stockage&lt;/li&gt;
&lt;li&gt;l&amp;rsquo;état des processus en exécution&lt;/li&gt;
&lt;li&gt;les évènements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;La version 0.2 apporte en particulier l&amp;rsquo;exécution de commandes distantes dans les containers monitorés par Docker. Ainsi, en ajoutant vos scripts de collecte des métriques &lt;em&gt;trapper&lt;/em&gt; à vos images Docker.&lt;/p&gt;

&lt;p&gt;Le dépôt du projet est disponible sur &lt;a href=&#34;https://github.com/bhuisgen/zabbix-docker&#34;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Gérer vos certificats Let's Encrypt avec dehydrated</title>

<id>https://blog.hbis.fr/2017/03/11/letsencrypt-dehydrated/</id>
<updated>2017-03-11T19:06:08.000Z</updated>
<published>2017-03-11T19:06:08.000Z</published>

<content type="html">&lt;p&gt;&lt;a href=&#34;https://github.com/lukas2511/dehydrated&#34;&gt;Dehydrated&lt;/a&gt; permet de gérer vos certificats SSL/TLS &lt;a href=&#34;https://letsencrypt.org/&#34;&gt;Let&amp;rsquo;s Encrypt&lt;/a&gt; depuis la ligne de commandes.&lt;/p&gt;

&lt;p&gt;Le package logiciel est disponible sur la plupart des distributions Linux :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# apt install dehydated
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Les noms de domaines des certificats à gérer sont à lister dans le fichier &lt;code&gt;domains.txt&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/dehydated/domains.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;blog.hbis.fr www.hbis.fr
mail.hbis.fr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Chaque ligne correspond à un certificat. Dans le cas où des noms alternatifs sont nécessaires, ils sont à spécifier sur la même ligne suite au nom principal du certificat.&lt;/p&gt;

&lt;p&gt;Au sujet de la configuration, éditez les paramètres de validation des certificats:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/dehydrated/conf.d/letsencrypt.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;!--  --&gt;

&lt;pre&gt;&lt;code&gt;BASEDIR=&amp;quot;/var/lib/letsencrypt/&amp;quot;
WELLKNOWN=&amp;quot;/var/www/hbis.fr/blog/html/.well-known/acme-challenge&amp;quot;
CONTACT_EMAIL=&amp;quot;postmaster@hbis.fr&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Les certificats peuvent enfin être générés :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# dehydrated -c
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Afin de renouveller les certificats avant leur expiration, un script cron doit être créé:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/cron.monthly/dehydrated
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash

/usr/bin/dehydrated -c
systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;# chmod +x /etc/cron.montly/dehydrated
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Extraire une chaîne de certificats avec OpenSSL</title>

<id>https://blog.hbis.fr/2017/02/11/openssl-certificate-chain/</id>
<updated>2017-02-11T20:58:49.000Z</updated>
<published>2017-02-11T20:58:49.000Z</published>
<summary type="text">La commande `openssl` permet de récupérer la chaîne de certificats d'un hôte.</summary>
<content type="html">&lt;p&gt;La commande &lt;code&gt;openssl&lt;/code&gt; permet de récupérer la chaîne de certificats d&amp;rsquo;un hôte.&lt;/p&gt;

&lt;p&gt;La commande suivante permet de récupérer la chaîne complète et la stocke dans un fichier:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ echo | openssl s_client -connect my.host.com:443 -showcerts 2&amp;gt;&amp;amp;1 |  \
    sed -ne &#39;/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p&#39; &amp;gt; fullchain.pem
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Inspecter les healthchecks Docker</title>

<id>https://blog.hbis.fr/2017/01/19/docker-inspect-healthcheck/</id>
<updated>2017-01-19T15:05:58.000Z</updated>
<published>2017-01-19T15:05:58.000Z</published>
<summary type="text">L'inspection des évènements Docker permet de détecter les containers dont les fréquences d'exécution des healthchecks est trop aggressive.</summary>
<content type="html">&lt;p&gt;L&amp;rsquo;inspection des évènements Docker permet de détecter les containers dont les fréquences d&amp;rsquo;exécution des healthchecks est trop aggressive.&lt;/p&gt;

&lt;p&gt;Pour analyser l&amp;rsquo;exécution des commandes healthcheck, le filtre d&amp;rsquo;évènements à appliquer est &lt;code&gt;exec_start&lt;/code&gt; :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ docker system events --filter event=exec_start
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;2017-01-19T14:53:32.979634882+01:00 container exec_start: /bin/sh -c /etc/cont-consul/check || exit 1 fa7c8221a53e2a76e61f290c4008f67ea2548b923cc42a11e9234ee0db4cab54 (com.docker.compose.config-hash=b4b13e5e0066bd757aa944cc01869736eb1d150ac04516e19028d070ef5f502c, com.docker.compose.container-number=1, com.docker.compose.oneoff=False, com.docker.compose.project=dev, com.docker.compose.service=zabbix-agent, com.docker.compose.version=1.9.0, image=registry.hbis.fr/base/zabbix-agent, name=dev_zabbix-agent_1)
2017-01-19T14:53:33.985556968+01:00 container exec_start: /bin/sh -c /etc/cont-consul/check || exit 1 a009ecbbb3cdce6da2bdf6ae073b9d323bcc2921eafc82206f7e4719e37a617a (com.docker.compose.config-hash=2e83302dfa763cf4185883bed56a64cd8e9207d3a78f06fd250bc158aafedde6, com.docker.compose.container-number=1, com.docker.compose.oneoff=False, com.docker.compose.project=dev, com.docker.compose.service=rabbitmq, com.docker.compose.version=1.9.0, image=registry.hbis.fr/base/rabbitmq, name=dev_rabbitmq_1)
2017-01-19T14:53:35.252389013+01:00 container exec_start: /bin/sh -c /etc/cont-consul/check || exit 1 a7398fd76d95544ac6cd8d02fbacb9608d5fd3443c1afb4fa0b4606dc032476c (com.docker.compose.config-hash=3c3cae569ff98e6a7e91b8e6734bfed22e9c5df90c8bd593539ef4876e2bda25, com.docker.compose.container-number=1, com.docker.compose.oneoff=False, com.docker.compose.project=dev, com.docker.compose.service=mariadb, com.docker.compose.version=1.9.0, image=registry.hbis.fr/base/mariadb, name=dev_mariadb_1)
2017-01-19T14:53:39.875116453+01:00 container exec_start: /bin/sh -c /etc/cont-consul/check || exit 1 1f41e9a3b5b63601042dbf5dcd758342e217f0f5d5685d76e9f61b2a2c155a5a (com.docker.compose.config-hash=733b83db2c39e867d08158e3101decdc5e3d70fa0653fea7f44139e29b47d2fa, com.docker.compose.container-number=1, com.docker.compose.oneoff=False, com.docker.compose.project=dev, com.docker.compose.service=dynamodb, com.docker.compose.version=1.9.0, image=registry.hbis.fr/base/dynamodb, name=dev_dynamodb_1)
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Redémarrer un host distant avec Fabric</title>

<id>https://blog.hbis.fr/2016/10/23/fabric-fix-reboot/</id>
<updated>2016-10-23T17:38:07.000Z</updated>
<published>2016-10-23T17:38:07.000Z</published>
<summary type="text">Le redémarrage d'un host avec Fabric est parfois compliqué à gérer.</summary>
<content type="html">&lt;p&gt;Le redémarrage d&amp;rsquo;un host avec Fabric est parfois compliqué à gérer.&lt;/p&gt;

&lt;p&gt;L&amp;rsquo;opération &lt;code&gt;reboot&lt;/code&gt; fournie par Fabric étant dysfonctionnelle et dépréciée, il convient d&amp;rsquo;utiliser une méthode manuelle et sûre :&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;fabric.state&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;mytask&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;sudo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;shutdown -r +1&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;120&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;connections&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;env&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;get_transport&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;close&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;uptime&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Le délai d&amp;rsquo;attente peut être adaptée au besoin, mais la déconnexion à l&amp;rsquo;hôte est requise pour que Fabric puisse ré-établir le tunnel SSH.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Corriger la keymap FR d'un clavier mac alu sous Linux</title>

<id>https://blog.hbis.fr/2016/09/29/linux-keyboard-mac-alu/</id>
<updated>2016-09-29T20:22:02.000Z</updated>
<published>2016-09-29T20:22:02.000Z</published>
<summary type="text">La keymap des claviers mac FR sous Linux est erronée : les touches _arobase/dièse_ et _inférieur/supérieur_ sont inversées.</summary>
<content type="html">&lt;p&gt;La keymap des claviers mac FR sous Linux est erronée : les touches &lt;em&gt;arobase/dièse&lt;/em&gt; et &lt;em&gt;inférieur/supérieur&lt;/em&gt; sont inversées.&lt;/p&gt;

&lt;p&gt;Voici le fix :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# echo 0 &amp;gt; /sys/module/hid_apple/parameters/iso_layout
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Et pour rendre la configuration permanente:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/modprobe.d/hid_apple.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;!-- --&gt;

&lt;pre&gt;&lt;code&gt;options hid_apple iso_layout=0
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Docker : images Alpine Linux avec intégration Consul</title>

<id>https://blog.hbis.fr/2016/05/22/docker-alpine/</id>
<updated>2016-05-22T20:29:40.000Z</updated>
<published>2016-05-22T20:29:40.000Z</published>
<summary type="text">Depuis quelques mois, j'utilise mes propres images Docker basées sous Alpine Linux.</summary>
<content type="html">&lt;p&gt;Depuis quelques mois, j&amp;rsquo;utilise mes propres images Docker basées sous Alpine Linux.&lt;/p&gt;

&lt;p&gt;En dehors d&amp;rsquo;un gain substantiel d&amp;rsquo;espace disque, ces images sont destinées à une utilisation avec Consul d&amp;rsquo;Hashicorp
afin de prendre en charge la configuration/reconfiguration à chaud des services. Les processus sont gérés par s6-overlay
et les fichiers de configuration dynamiques par Consul-template.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bhuisgen/docker-alpine&#34;&gt;Docker-alpine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://alpinelinux.org/&#34;&gt;Alpine Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/just-containers/s6-overlay&#34;&gt;s6-overlay&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/hashicorp/consul&#34;&gt;consul&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/hashicorp/consul-template&#34;&gt;consul-template&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
</entry>
<entry>
<title>Docker : erreur Resource temporarily unavailable (11)</title>

<id>https://blog.hbis.fr/2016/03/25/docker-resource_temporarily_unavailable/</id>
<updated>2016-03-25T20:04:48.000Z</updated>
<published>2016-03-25T20:04:48.000Z</published>

<content type="html">&lt;p&gt;Si vous obtenez l&amp;rsquo;erreur suivante lors du build d&amp;rsquo;une image Docker :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Failed to create thread: Resource temporarily unavailable (11)
Aborted (core dumped)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Il s&amp;rsquo;agit d&amp;rsquo;une limitation de ressources appliquée par systemd :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# systemctl status docker

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─custom.conf
   Active: active (running) since Fri 2016-03-25 10:04:16 CET; 4h 27min ago
     Docs: https://docs.docker.com
 Main PID: 927 (docker)
    Tasks: 436 (limit: 512)
   CGroup: /system.slice/docker.service
           ├─  927 /usr/bin/docker daemon -H fd:// --iptables=false --dns 8.8.8.8 --dns 8.8.4.4
           ├─10390 docker-proxy -proto tcp -host-ip 172.18.0.1 -host-port 8500 -container-ip 172.18.0.2 -container-port 8500
           ├─10411 docker-proxy -proto tcp -host-ip 172.18.0.1 -host-port 8301 -container-ip 172.18.0.2 -container-port 8301
           ├─10907 docker-proxy -proto tcp -host-ip 172.19.0.1 -host-port 61613 -container-ip 172.19.0.3 -container-port 61613
           ├─10949 docker-proxy -proto tcp -host-ip 172.19.0.1 -host-port 15672 -container-ip 172.19.0.3 -container-port 15672
           ├─10957 docker-proxy -proto tcp -host-ip 172.19.0.1 -host-port 5672 -container-ip 172.19.0.3 -container-port 5672
           ├─10965 docker-proxy -proto tcp -host-ip 172.19.0.1 -host-port 1883 -container-ip 172.19.0.3 -container-port 1883
           └─11188 docker-proxy -proto tcp -host-ip 172.19.0.1 -host-port 80 -container-ip 172.19.0.4 -container-port 80
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Il convient d&amp;rsquo;augmenter le nombre de tâches autorisées, ou tout simplement désactiver cette limitation, dans le fichier
service du démon docker :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# cat /etc/systemd/system/docker.service.d/custom.conf

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --iptables=false --dns 8.8.8.8 --dns 8.8.4.4
TasksMax=infinity

# systemctl daemon-reload
# systemctl restart docker.service
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Maven : vérifier les mises à jour disponibles</title>

<id>https://blog.hbis.fr/2016/03/06/maven-show_available_updates/</id>
<updated>2016-03-06T18:30:29.000Z</updated>
<published>2016-03-06T18:30:29.000Z</published>

<content type="html">&lt;p&gt;Vérifier les mises à jour des plugins Maven :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;boris@debian:~$ mvn versions:display-plugin-updates
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Vérifier les mises à jour des dépendances du projet :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;boris@debian:~$ mvn versions:display-dependency-updates
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>NetworkManager : désactiver la gestion d'une interface réseau</title>

<id>https://blog.hbis.fr/2016/03/06/networkmanager-disable_interface_management/</id>
<updated>2016-03-06T18:26:20.000Z</updated>
<published>2016-03-06T18:26:20.000Z</published>

<content type="html">&lt;p&gt;Par défaut, &lt;em&gt;NetworkManager&lt;/em&gt; s&amp;rsquo;accapare de la gestion de toutes les interfaces réseaux. Dans le cadre de
l&amp;rsquo;utilisation de système de virtualisation, ceci est problématique. Il est nécessaire de désactiver cette gestion en
précisant soit le nom/regex de l&amp;rsquo;interface réseau, soit son adresse MAC.&lt;/p&gt;

&lt;p&gt;Voici un exemple couvrant ces deux cas :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;boris@debian:~$ vim /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=interface-name:vboxnet*;interface-name:docker0
unmanaged-devices=mac:74:da:38:60:15:cd

boris@debian:~$ sudo systemctl restart network-manager
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Firefox : supprimer la configuration HSTS d'un site</title>

<id>https://blog.hbis.fr/2016/03/06/firefox-remove_hsts_history/</id>
<updated>2016-03-06T18:17:49.000Z</updated>
<published>2016-03-06T18:17:49.000Z</published>

<content type="html">&lt;p&gt;L&amp;rsquo;effacement de l&amp;rsquo;historique Firefox ne supprime pas la configuration de
&lt;a href=&#34;https://fr.wikipedia.org/wiki/HTTP_Strict_Transport_Security&#34;&gt;HSTS&lt;/a&gt;. Pour y remédier, l&amp;rsquo;édition du fichier
&lt;em&gt;SiteSecurityServiceState.txt&lt;/em&gt; présent dans votre profil est obligatoire :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# cd ~/.mozilla/firefox/eue6le58.dev-edition-default/
# vim SiteSecurityServiceState.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Supprimez-le ou les lignes concernées.&lt;/p&gt;
</content>
</entry>
<entry>
<title>Nginx : création d'un fichier htpasswd avec openssl</title>

<id>https://blog.hbis.fr/2016/03/06/nginx-htpasswd_openssl/</id>
<updated>2016-03-06T18:12:43.000Z</updated>
<published>2016-03-06T18:12:43.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;boris@debian:~$ printf &amp;quot;USER:$(openssl passwd -crypt PASSWORD)\n&amp;quot; &amp;gt; vhost.htpasswd
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Maven : construire une image Docker et y intégrer le JAR du projet</title>

<id>https://blog.hbis.fr/2016/02/24/maven-build_docker_image/</id>
<updated>2016-02-24T00:24:17.000Z</updated>
<published>2016-02-24T00:24:17.000Z</published>

<content type="html">&lt;p&gt;Le but est de construire l&amp;rsquo;image Docker d&amp;rsquo;un projet Java par Maven. L&amp;rsquo;image est générée par le plugin Maven
&lt;a href=&#34;https://github.com/spotify/docker-maven-plugin&#34;&gt;docker-maven-plugin&lt;/a&gt; mais afin de ne pas casser le versioning, le nom
du JAR original n&amp;rsquo;est pas modifié; une copie est réalisée avant intégration (un nom de fichier fixe est obligatoire).&lt;/p&gt;

&lt;p&gt;Au niveau du projet Maven, un répertoire dédié est créé pour le Dockerfile et l&amp;rsquo;ensemble des fichiers de génération de
l&amp;rsquo;image :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bhuisgen@local:~/Projects/java/demo$ find src/main/docker/

src/main/docker/
src/main/docker/Dockerfile
src/main/docker/root
src/main/docker/root/etc
src/main/docker/root/etc/services.d
src/main/docker/root/etc/services.d/app
src/main/docker/root/etc/services.d/app/finish
src/main/docker/root/etc/services.d/app/run
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;L&amp;rsquo;image repose sur une base Alpine Linux avec gestion des services par &lt;em&gt;s6-overlay&lt;/em&gt; auquel est ajouté le strict
nécessaire :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bhuisgen@local:~/Projects/java/demo$ cat src/main/docker/Dockerfile

FROM bhuisgen/alpine-base:latest
MAINTAINER Boris HUISGEN &amp;lt;bhuisgen@hbis.fr&amp;gt;

RUN apk add --update openjdk8-jre &amp;amp;&amp;amp; \
    rm -rf /var/cache/apk/*

COPY root /

ENTRYPOINT [&amp;quot;/init&amp;quot;]
CMD []
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A noter que la commande de copie du JAR n&amp;rsquo;est pas présente; le plugin l&amp;rsquo;ajoutera de lui-même. Le reste est donc à
ajouter au fichier POM :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bhuisgen@local:~/Projects/java/demo$ vim pom.xml

[...]
    &amp;lt;build&amp;gt;
        &amp;lt;plugins&amp;gt;
[...]
            &amp;lt;!-- copy and rename the JAR to a fixed filename --&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-antrun-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                        &amp;lt;configuration&amp;gt;
                            &amp;lt;target&amp;gt;
                                &amp;lt;copy
                                    file=&amp;quot;${project.build.directory}/${project.artifactId}-${project.version}.jar&amp;quot;
                                    tofile=&amp;quot;${project.build.directory}/app.jar&amp;quot; /&amp;gt;
                            &amp;lt;/target&amp;gt;
                        &amp;lt;/configuration&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
            &amp;lt;/plugin&amp;gt;

            &amp;lt;!-- build the Docker image --&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;com.spotify&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;docker-maven-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;0.4.0&amp;lt;/version&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;build&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;imageName&amp;gt;${docker.image.prefix}/${project.artifactId}&amp;lt;/imageName&amp;gt;
                    &amp;lt;imageTag&amp;gt;${project.version}&amp;lt;/imageTag&amp;gt;
                    &amp;lt;imageTag&amp;gt;latest&amp;lt;/imageTag&amp;gt;
                    &amp;lt;dockerDirectory&amp;gt;src/main/docker&amp;lt;/dockerDirectory&amp;gt;
                    &amp;lt;resources&amp;gt;
                        &amp;lt;resource&amp;gt;
                            &amp;lt;directory&amp;gt;${project.build.directory}&amp;lt;/directory&amp;gt;
                            &amp;lt;include&amp;gt;app.jar&amp;lt;/include&amp;gt;
                            &amp;lt;targetPath&amp;gt;/&amp;lt;/targetPath&amp;gt;
                        &amp;lt;/resource&amp;gt;
                    &amp;lt;/resources&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/plugin&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;L&amp;rsquo;image sera générée lors de la phase &lt;em&gt;package&lt;/em&gt; et un tag y sera appliqué pour conserver le numéro de version de
l&amp;rsquo;application.&lt;/p&gt;
</content>
</entry>
<entry>
<title>OpenSSH : accès au prompt</title>

<id>https://blog.hbis.fr/2016/02/23/openssh-prompt/</id>
<updated>2016-02-23T23:14:40.000Z</updated>
<published>2016-02-23T23:14:40.000Z</published>

<content type="html">&lt;p&gt;Raccourci-clavier : [Entrée] + [~] + [?]&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;~?
Supported escape sequences:
 ~.   - terminate connection (and any multiplexed sessions)
 ~B   - send a BREAK to the remote system
 ~C   - open a command line
 ~R   - request rekey
 ~V/v - decrease/increase verbosity (LogLevel)
 ~^Z  - suspend ssh
 ~#   - list forwarded connections
 ~&amp;amp;   - background ssh (when waiting for connections to terminate)
 ~?   - this message
 ~~   - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Boto : gérer le logging</title>

<id>https://blog.hbis.fr/2016/02/23/boto-gerer-le-logging/</id>
<updated>2016-02-23T23:12:47.000Z</updated>
<published>2016-02-23T23:12:47.000Z</published>

<content type="html">&lt;p&gt;Pour activer le log de debug :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import logging

logging.basicConfig(filename=&amp;quot;boto.log&amp;quot;, level=logging.DEBUG)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pour supprimer tout le logging (par exemple avec S3) hormis les erreurs critiques :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import logging

logging.getLogger(&#39;boto&#39;).setLevel(logging.CRITICAL)
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Amazon EC2 : scripts de gestion des disques éphémères</title>

<id>https://blog.hbis.fr/2016/01/22/ephemeral-scripts/</id>
<updated>2016-01-22T00:03:52.000Z</updated>
<published>2016-01-22T00:03:52.000Z</published>

<content type="html">&lt;p&gt;Voici les scripts et unités &lt;em&gt;systemd&lt;/em&gt; que j&amp;rsquo;utilise pour gérer les disques éphémères de mes instances Amazon EC2.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dépôt git : &lt;a href=&#34;https://github.com/bhuisgen/ephemeral-scripts&#34;&gt;ephemeral-scripts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
</entry>
<entry>
<title>Java : log syslog avec log4j</title>

<id>https://blog.hbis.fr/2015/12/19/java-log4j_syslog/</id>
<updated>2015-12-19T13:43:03.000Z</updated>
<published>2015-12-19T13:43:03.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;package syslog;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.net.SyslogAppender;

public class test {
    private static final Logger log = Logger.getLogger(test.class);

    public static void main(String[] args) {
        Logger rootLogger = Logger.getRootLogger();

        rootLogger.setLevel(Level.DEBUG);

        PatternLayout layout = new PatternLayout(&amp;quot;%t: %p: %m%n&amp;quot;);
        SyslogAppender syslogAppender = new SyslogAppender(layout, &amp;quot;localhost&amp;quot;,
                SyslogAppender.LOG_USER);

        Logger.getRootLogger().addAppender(syslogAppender);

        log.info(&amp;quot;log message&amp;quot;);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ne pas oublier d&amp;rsquo;activer l&amp;rsquo;écoute réseau du serveur syslog local :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# vim /etc/rsyslog.conf

# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Git : annuler le dernier commit amend</title>

<id>https://blog.hbis.fr/2015/12/19/git-undo_amend/</id>
<updated>2015-12-19T13:39:38.000Z</updated>
<published>2015-12-19T13:39:38.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# git reset --soft HEAD@{1}
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Docker : activer les restrictions RAM et swap</title>

<id>https://blog.hbis.fr/2015/09/20/docker-memory_cgroup/</id>
<updated>2015-09-20T23:28:43.000Z</updated>
<published>2015-09-20T23:28:43.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# vim /etc/default/grub

GRUB_CMDLINE_LINUX=&amp;quot;cgroup_enable=memory swapaccount=1&amp;quot;

# update-grub

# vim /etc/default/docker

DOCKER_OPTS=&amp;quot;--exec-opt native.cgroupdriver=cgroupfs&amp;quot;

# shutdown -r now
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Debian : fix startup Docker 1.7 et kernel 4.1</title>

<id>https://blog.hbis.fr/2015/09/20/debian-fix_docker_1-7_and_kernel-4-1/</id>
<updated>2015-09-20T19:44:18.000Z</updated>
<published>2015-09-20T19:44:18.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;sept. 20 19:34:19 muse systemd[1]: Started Docker Application Container Engine.
sept. 20 19:34:19 muse docker[18643]: time=&amp;quot;2015-09-20T19:34:19.773439875+02:00&amp;quot; level=error msg=&amp;quot;[graphdriver] prior storage driver \&amp;quot;aufs\&amp;quot; failed: driver not supported&amp;quot;
sept. 20 19:34:19 muse docker[18643]: time=&amp;quot;2015-09-20T19:34:19.773487551+02:00&amp;quot; level=fatal msg=&amp;quot;Error starting daemon: error initializing graphdriver: driver not supported&amp;quot;

# systemctl start docker
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Debian : fix crash Netbeans 8</title>

<id>https://blog.hbis.fr/2015/09/20/debian-fix_netbeans_crash/</id>
<updated>2015-09-20T19:25:58.000Z</updated>
<published>2015-09-20T19:25:58.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# vim /etc/java-8-openjdk/accessibility.properties

#assistive_technologies=org.GNOME.Accessibility.AtkWrapper
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Git : appliquer une stratégie de merge différente</title>

<id>https://blog.hbis.fr/2015/09/20/git-merge_strategy/</id>
<updated>2015-09-20T19:22:14.000Z</updated>
<published>2015-09-20T19:22:14.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# git checkout master
# git merge --no-ff release -X theirs
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>MongoDB : déployer rapidement un replicat set local</title>

<id>https://blog.hbis.fr/2015/09/18/mongodb-local_replicatset/</id>
<updated>2015-09-18T15:15:50.000Z</updated>
<published>2015-09-18T15:15:50.000Z</published>

<content type="html">&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/allanbank/mongodb-tricks&#34;&gt;https://github.com/allanbank/mongodb-tricks&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/allanbank/mongodb-tricks/blob/master/src/main/scripts/replica-set-start.sh&#34;&gt;https://github.com/allanbank/mongodb-tricks/blob/master/src/main/scripts/replica-set-start.sh&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
</entry>
<entry>
<title>Linux : afficher la consommation swap par processus</title>

<id>https://blog.hbis.fr/2015/09/01/linux-used_swap_by_process/</id>
<updated>2015-09-01T09:21:40.000Z</updated>
<published>2015-09-01T09:21:40.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# for file in /proc/*/status ; do awk &#39;/^(VmSwap|Pid|Name)/{printf $2 &amp;quot; &amp;quot; $3}END{ print &amp;quot;&amp;quot;}&#39; $file; done | sort
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Git : prompt bash</title>

<id>https://blog.hbis.fr/2015/08/31/bash-git_prompt/</id>
<updated>2015-08-31T12:16:16.000Z</updated>
<published>2015-08-31T12:16:16.000Z</published>

<content type="html">&lt;p&gt;Un prompt bash spécialisé pour l&amp;rsquo;utilisation de Git : &lt;a href=&#34;https://github.com/magicmonty/bash-git-prompt&#34;&gt;https://github.com/magicmonty/bash-git-prompt&lt;/a&gt;&lt;/p&gt;
</content>
</entry>
<entry>
<title>Linux : tester les performances I/O</title>

<id>https://blog.hbis.fr/2015/07/15/linux-iodisk_benchmark/</id>
<updated>2015-07-15T13:33:34.000Z</updated>
<published>2015-07-15T13:33:34.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# hdparm -t -T /dev/sda

# dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync

# bonnie++ -d /mnt -r 8000 -u toto
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>PostgreSQL : afficher les droits spécifiques associés à un table</title>

<id>https://blog.hbis.fr/2015/07/08/postgresql-table_grants/</id>
<updated>2015-07-08T11:16:32.000Z</updated>
<published>2015-07-08T11:16:32.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;dbname=# SELECT grantee,privilege_type FROM information_schema.role_table_grants WHERE table_name=&#39;mytable&#39;;

 grantee  | privilege_type
----------+----------------
 user1    | INSERT
 user1    | SELECT
 user1    | UPDATE
 user1    | DELETE
 user1    | TRUNCATE
 user1    | REFERENCES
 user1    | TRIGGER
 user2    | INSERT
 user2    | SELECT
 user2    | UPDATE
 user2    | DELETE
(11 rows)
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Talend : erreur avec le service IComponentsService</title>

<id>https://blog.hbis.fr/2015/07/08/talend-error_icomponentservice/</id>
<updated>2015-07-08T10:59:40.000Z</updated>
<published>2015-07-08T10:59:40.000Z</published>

<content type="html">&lt;p&gt;Une petite erreur classique lors de l&amp;rsquo;utilisation du logiciel Talend :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;java.lang.RuntimeException: Le service org.talend.core.model.components.IComponentsService n&#39;a pas été enregistré.
    at org.talend.core.GlobalServiceRegister.getService(Unknown Source)
    at org.talend.repository.model.ComponentsFactoryProvider.getInstance(Unknown Source)
    at org.talend.core.CoreService.componentsReset(Unknown Source)
    at org.talend.core.repository.model.ProxyRepositoryFactory.logOnProject(Unknown Source)
    at org.talend.repository.ui.login.LoginDialog$1.run(Unknown Source)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pour la corriger, le répertoire suivant est à supprimer :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# rmdir C:\Talend\workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Docker : supprimer tous les containers à l'arrêt</title>

<id>https://blog.hbis.fr/2015/05/13/docker-cleanup_stopped_cts/</id>
<updated>2015-05-13T14:46:14.000Z</updated>
<published>2015-05-13T14:46:14.000Z</published>

<content type="html">&lt;pre&gt;&lt;code&gt;# docker rm $(docker ps -a|grep &amp;quot;Exited&amp;quot;|awk &amp;quot;{print \$1}&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
</feed>
