<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by elaurichenickson on Medium]]></title>
        <description><![CDATA[Stories by elaurichenickson on Medium]]></description>
        <link>https://medium.com/@3l4un1ck?source=rss-edf9b23f42f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*elIcofQCNnK0RPTcxQL6pA.png</url>
            <title>Stories by elaurichenickson on Medium</title>
            <link>https://medium.com/@3l4un1ck?source=rss-edf9b23f42f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:28:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@3l4un1ck/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Déploiement d’AWX (Ansible Web UI) sur un VPS : Le Guide MicroK8s et Nginx]]></title>
            <link>https://medium.com/@3l4un1ck/d%C3%A9ploiement-dawx-ansible-web-ui-sur-un-vps-le-guide-microk8s-et-nginx-f1e7bb9c17fd?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1e7bb9c17fd</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 13:27:41 GMT</pubDate>
            <atom:updated>2025-11-26T13:27:41.662Z</atom:updated>
            <content:encoded><![CDATA[<h3>Déploiement d’AWX (Ansible Web UI) sur un VPS : Le Guide MicroK8s et Nginx</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlf48HKTK-g-JlQn_BTNUg.png" /></figure><p><strong>AWX</strong> est l’interface web Open Source pour gérer, planifier et monitorer Ansible. Ce guide vous montre comment déployer AWX sur votre propre VPS en utilisant <strong>MicroK8s</strong> (un Kubernetes léger) et un <strong>Reverse Proxy Nginx</strong> pour un accès sécurisé et fiable.</p><h3>💡 L’Architecture</h3><p>Nous allons utiliser une architecture robuste : MicroK8s pour l’orchestration, l’AWX Operator pour la gestion du cycle de vie de l’application, l’exposition via <strong>NodePort</strong>, et Nginx pour router le trafic web standard (port 80/443) vers le cluster.</p><h3>1. Préparation du VPS et Installation de MicroK8s</h3><p>Assurez-vous que votre VPS dispose d’au moins <strong>4 Go de RAM</strong> pour éviter les problèmes de performance de la base de données.</p><h3>1.1 Mise à Jour du Système</h3><pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre><h3>1.2 Installation de MicroK8s</h3><p>Nous utilisons la version stable et ajoutons votre utilisateur au groupe pour éviter l’usage constant de sudo.</p><pre># Installation de MicroK8s<br>sudo snap install microk8s --classic --channel=1.28/stable<br><br># Ajout de l&#39;utilisateur et application du changement<br>sudo usermod -aG microk8s $USER<br>newgrp microk8s<br><br># Attendre que le cluster soit opérationnel<br>microk8s status --wait-ready</pre><h3>1.3 Activation des Addons Essentiels</h3><p>Nous activons le stockage persistant (hostpath-storage) et le DNS.</p><pre>microk8s enable dns<br>microk8s enable hostpath-storage</pre><h3>1.4 Installation de kubectl</h3><pre>sudo snap install kubectl --classic</pre><h3>2. Installation de l’AWX Operator (Méthode Stable)</h3><p>Pour éviter les erreurs courantes de téléchargement ou de version (erreurs 404, git), nous allons cloner le dépôt et basculer sur le dernier <em>tag</em> stable.</p><h3>2.1 Clonage du Dépôt et Sélection de la Version</h3><pre>cd ~<br><br># Cloner le dépôt de l&#39;Operator<br>git clone https://github.com/ansible/awx-operator.git<br>cd awx-operator<br><br># Récupérer la dernière version stable<br>RELEASE_TAG=$(curl -s https://api.github.com/repos/ansible/awx-operator/releases/latest | grep tag_name | cut -d &#39;&quot;&#39; -f 4)<br>echo &quot;Version stable sélectionnée : $RELEASE_TAG&quot;<br><br># Basculer sur ce tag précis pour une stabilité maximale<br>git checkout $RELEASE_TAG</pre><h3>2.2 Déploiement de l’Operator</h3><p>Bash</p><pre># Créer le namespace dédié à AWX<br>microk8s kubectl create namespace awx<br><br><br># Déployer l&#39;AWX Operator via Kustomize<br>microk8s kubectl apply -k config/default -n awx<br><br># Vérification : attendez que le Pod de l&#39;Operator soit &quot;Running&quot;<br>microk8s kubectl get pods -n awx</pre><h3>3. Déploiement de l’Instance AWX</h3><p>L’Opérateur étant prêt, nous lui soumettons la définition de notre instance en utilisant le type de service <strong>NodePort</strong>.</p><h3>3.1 Création du Fichier de Configuration</h3><p>Créez le fichier awx-instance.yml :</p><p>Bash</p><pre>cat &lt;&lt;EOF &gt; awx-instance.yml<br>apiVersion: awx.ansible.com/v1beta1<br>kind: AWX<br>metadata:<br>  name: awx-instance<br>  namespace: awx<br>spec:<br>  # Utilisation de NodePort pour exposer l&#39;interface web<br>  service_type: nodeport<br>EOF</pre><h3>3.2 Application et Suivi du Déploiement</h3><pre># Appliquer la configuration<br>microk8s kubectl apply -f awx-instance.yml<br># Suivi du Déploiement (attendez que tous les Pods soient Running/Completed)<br>microk8s kubectl get pods -n awx -w</pre><h3>4. Configuration du Reverse Proxy Nginx et Accès</h3><p>Le service AWX est maintenant exposé sur un port élevé de votre VPS (ex: 3xxxx). Nous allons utiliser Nginx pour le rendre accessible via le port 80.</p><h3>4.1 Installation de Nginx</h3><pre>sudo apt install nginx -y</pre><h3>4.2 Détermination du NodePort</h3><p>Trouvez le port alloué (la valeur 3xxxx) par Kubernetes. Le nom du service est <strong>awx-instance-service</strong>.</p><pre>microk8s kubectl get svc awx-instance-service -n awx</pre><h3>4.3 Configuration du Reverse Proxy</h3><p>Créez le fichier de configuration /etc/nginx/sites-available/awx.conf. <strong>N&#39;oubliez pas de remplacer </strong><strong>votre.domaine.com et </strong><strong>$AWX_NODE_PORT !</strong></p><pre>sudo nano /etc/nginx/sites-available/awx.conf</pre><p><strong>Contenu de </strong><strong>awx.conf :</strong></p><pre>server {<br>    listen 80;<br>    listen [::]:80;<br>    # REMPLACER PAR VOTRE DOMAINE OU IP PUBLIQUE<br><br>    server_name votre.domaine.com; <br>    location / {<br>        # REMPLACER PAR LE NODEPORT RÉCUPÉRÉ (ex: 30007)<br>        proxy_pass http://127.0.0.1:$AWX_NODE_PORT; <br>        # En-têtes obligatoires<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>        # Timeouts pour les connexions AWX<br>        proxy_read_timeout 900;<br>        proxy_connect_timeout 900;<br>    }<br>}</pre><h3>4.4 Activation de Nginx</h3><pre># Créer le lien symbolique et supprimer la configuration par défaut<br>sudo ln -s /etc/nginx/sites-available/awx.conf /etc/nginx/sites-enabled/<br>sudo rm -f /etc/nginx/sites-enabled/default<br># Tester la configuration et redémarrer<br>sudo nginx -t<br>sudo systemctl restart nginx</pre><h3>5. Accès Final à AWX</h3><h3>5.1 Récupérer le Mot de Passe Admin</h3><p>Le mot de passe de l’utilisateur par défaut admin est généré automatiquement.</p><pre>microk8s kubectl get secret awx-instance-admin-password -n awx -o jsonpath=&quot;{.data.password}&quot; | base64 --decode ; echo</pre><h3>5.2 Connexion</h3><p>Ouvrez votre navigateur et accédez à l’URL : <a href="http://votre.domaine.com./">http://votre.domaine.com.</a></p><ul><li><strong>Utilisateur :</strong> admin</li><li><strong>Mot de passe :</strong> Celui récupéré ci-dessus.</li></ul><p>Félicitations, vous avez déployé AWX sur votre VPS !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1e7bb9c17fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[# Guide CI/CD GitLab ↔ SonarQube (Docker) — pas à pas + dépannage]]></title>
            <link>https://medium.com/@3l4un1ck/guide-ci-cd-gitlab-sonarqube-docker-pas-%C3%A0-pas-d%C3%A9pannage-f58fcbfe5e65?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f58fcbfe5e65</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 10:22:08 GMT</pubDate>
            <atom:updated>2025-08-26T10:22:08.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Guide CI/CD GitLab ↔ SonarQube (Docker) — pas à pas + dépannage</h3><p>Ce guide explique <strong>de A à Z</strong> comment :</p><ol><li>Déployer SonarQube avec Postgres et Traefik,</li><li>Activer l’authentification <strong>GitLab OAuth</strong>,</li><li>Installer un <strong>GitLab Runner</strong> en Docker Compose (auto‑enregistrement),</li><li>Brancher un pipeline <strong>GitLab CI</strong> qui exécute tests + analyse SonarQube et <strong>bloque le déploiement</strong> si la Quality Gate échoue,</li><li>Résoudre les <strong>problèmes concrets</strong> rencontrés : bouton qui n’apparaît pas, « not authorized », jobs bloqués faute de runner, pom.xml introuvable, erreur Unrecognized option avec sonar-scanner, etc.</li></ol><h3>Prérequis</h3><ul><li>Un domaine public interne pour SonarQube (ex. sonarqube.entreprise.local) pointant vers Traefik.</li><li>Docker &amp; Docker Compose installés.</li><li>Accès admin à <strong>SonarQube</strong> et à <strong>GitLab</strong>.</li><li>Un réseau Docker externe Traefik (ex. traefik).</li></ul><h3>1) Déployer SonarQube + Postgres + Traefik</h3><p><strong>docker-compose.yml</strong> (adapter le réseau/labels Traefik à votre infra) :</p><pre>version: &quot;3.8&quot;<br><br>services:<br>  sonarqube:<br>    image: sonarqube:latest<br>    container_name: sonarqube<br>    depends_on:<br>      - db<br>    environment:<br>      - SONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar<br>      - SONAR_JDBC_USERNAME=${SONAR_JDBC_USERNAME}<br>      - SONAR_JDBC_PASSWORD=${SONAR_JDBC_PASSWORD}<br>      # (GitLab OAuth ajouté à l&#39;étape 2)<br>    volumes:<br>      - sonarqube_data:/opt/sonarqube/data<br>      - sonarqube_extensions:/opt/sonarqube/extensions<br>      - sonarqube_logs:/opt/sonarqube/logs<br>    networks:<br>      - traefik<br>    labels:<br>      - &quot;traefik.enable=true&quot;<br>      - &quot;traefik.http.routers.sonarqube.rule=Host(`${SONAR_HOST}`)&quot;<br>      - &quot;traefik.http.routers.sonarqube.entrypoints=websecure&quot;<br>      - &quot;traefik.http.routers.sonarqube.tls.certresolver=myresolver&quot;<br>      - &quot;traefik.http.services.sonarqube.loadbalancer.server.port=9000&quot;<br> db:<br>    image: postgres:16<br>    container_name: sonarqube_db<br>    environment:<br>      - POSTGRES_USER=${SONAR_JDBC_USERNAME}<br>      - POSTGRES_PASSWORD=${SONAR_JDBC_PASSWORD}<br>      - POSTGRES_DB=sonar<br>    volumes:<br>      - postgresql:/var/lib/postgresql<br>      - postgresql_data:/var/lib/postgresql/data<br>    networks:<br>      - traefik<br>volumes:<br>  sonarqube_data:<br>  sonarqube_extensions:<br>  sonarqube_logs:<br>  postgresql:<br>  postgresql_data:<br>networks:<br>  traefik:<br>    external: true</pre><p><strong>.env</strong> :</p><pre>SONAR_JDBC_USERNAME=sonar<br>SONAR_JDBC_PASSWORD=superpassword<br>SONAR_HOST=sonarqube.entreprise.local</pre><p>Démarrer :</p><pre>docker compose --env-file .env up -d</pre><h3>2) Activer l’auth GitLab (OAuth2)</h3><h3>2.1 Créer l’application OAuth côté GitLab</h3><ol><li>GitLab <strong>Admin Area → Applications</strong> (ou <em>User → Applications</em> si autorisé).</li><li><strong>Name</strong> : SonarQube</li><li><strong>Redirect URI</strong> : https://&lt;votre_domaine_sonar&gt;/oauth2/callback/gitla1<br>ex. <a href="https://sonarqube.entreprise.local/oauth2/callback/gitlab">https://sonarqube.entreprise.local/oauth2/callback/gitlab</a></li><li><strong>Scopes</strong> : read_user (min.) ; ajoutez api si vous voulez synchroniser des groupes.</li><li>Notez <strong>Application ID</strong> et <strong>Secret</strong>.</li></ol><h3>2.2 Ajouter la conf OAuth à SonarQube</h3><p>Dans docker-compose.yml (service sonarqube) :</p><pre>environment:<br>  - SONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar<br>  - SONAR_JDBC_USERNAME=${SONAR_JDBC_USERNAME}<br>  - SONAR_JDBC_PASSWORD=${SONAR_JDBC_PASSWORD}<br>  # --- GitLab OAuth ---<br>  - SONAR_AUTH_GITLAB_ENABLED=true<br>  - SONAR_AUTH_GITLAB_CLIENT_ID=${GITLAB_CLIENT_ID}<br>  - SONAR_AUTH_GITLAB_CLIENT_SECRET=${GITLAB_CLIENT_SECRET}<br>  - SONAR_AUTH_GITLAB_URL=https://gitlab.entreprise.local<br>  - SONAR_AUTH_GITLAB_API_URL=https://gitlab.entreprise.local/api/v4<br>  - SONAR_AUTH_GITLAB_ALLOW_USERS_TO_SIGN_UP=true<br>  # (optionnel)<br>  # - SONAR_AUTH_GITLAB_GROUPS_SYNC=true<br>  # - SONAR_AUTH_GITLAB_ALLOWED_GROUPS=dev,ops</pre><p><strong>.env</strong> :</p><pre>GITLAB_CLIENT_ID=xxxxxxxx<br>GITLAB_CLIENT_SECRET=yyyyyyyy</pre><p>Redémarrer SonarQube :</p><pre>docker compose down &amp;&amp; docker compose up -d</pre><h3>2.3 Dépannage Auth GitLab</h3><p><strong>Le bouton “Log in with GitLab” n’apparaît pas</strong></p><ul><li>Vérifiez les logs : docker logs -f sonarqube | grep -i gitlab</li><li>Assurez-vous que l’URL de callback est <strong>exacte</strong>.</li><li>Variables .env <strong>sans guillemets</strong> ; relancer avec --env-file .env.</li></ul><p><strong>Après login : “You’re not authorized…”</strong></p><ul><li>Message complet rencontré :</li><li>You&#39;re not authorized to access this page. Please contact the administrator.</li><li><strong>Reason:</strong> &#39;gitlab&#39; users are not allowed to sign up</li><li>Cause : SONAR_AUTH_GITLAB_ALLOW_USERS_TO_SIGN_UP non appliqué / à false.</li></ul><p><strong>Correctifs :</strong></p><ol><li>Mettre SONAR_AUTH_GITLAB_ALLOW_USERS_TO_SIGN_UP=true (sans guillemets), redémarrer.</li><li>Se connecter en <strong>admin local</strong> → <em>Administration → Security → Users</em> → donner les droits à l’utilisateur GitLab.</li></ol><h3>3) Installer un GitLab Runner (Docker Compose, auto‑register)</h3><p><strong>Objectif</strong> : éviter docker exec … register en faisant l’enregistrement automatiquement au démarrage.</p><p><strong>docker-compose.runner.yml</strong> :</p><pre>version: &quot;3.8&quot;<br>services:<br>  gitlab-runner:<br>    image: gitlab/gitlab-runner:latest<br>    container_name: gitlab-runner<br>    restart: always<br>    volumes:<br>      - ./gitlab-runner/config:/etc/gitlab-runner<br>      - /var/run/docker.sock:/var/run/docker.sock<br>    environment:<br>      CI_SERVER_URL: &quot;https://gitlab.entreprise.local/&quot;<br>      REGISTRATION_TOKEN: &quot;${GITLAB_RUNNER_TOKEN}&quot;<br>      RUNNER_NAME: &quot;docker-runner&quot;<br>      RUNNER_TAG_LIST: &quot;docker&quot;   # doit matcher vos jobs, sinon retirez les tags côté CI<br>      RUNNER_EXECUTOR: &quot;docker&quot;<br>      DOCKER_IMAGE: &quot;alpine:3.19&quot;<br>    entrypoint: [&quot;/bin/sh&quot;, &quot;-c&quot;]<br>    command: &gt;<br>      if [ ! -s /etc/gitlab-runner/config.toml ]; then<br>        gitlab-runner register --non-interactive \<br>          --url &quot;$CI_SERVER_URL&quot; \<br>          --registration-token &quot;$REGISTRATION_TOKEN&quot; \<br>          --executor &quot;$RUNNER_EXECUTOR&quot; \<br>          --description &quot;$RUNNER_NAME&quot; \<br>          --tag-list &quot;$RUNNER_TAG_LIST&quot; \<br>          --docker-image &quot;$DOCKER_IMAGE&quot; \<br>          --run-untagged=&quot;true&quot; \<br>          --locked=&quot;false&quot; \<br>          --access-level=&quot;not_protected&quot;;<br>      fi;<br>      exec gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner</pre><p><strong>.env</strong> :</p><pre>GITLAB_RUNNER_TOKEN=GR1348941xxxxxxxx</pre><p>Démarrer :</p><pre>docker compose -f docker-compose.runner.yml --env-file .env up -d</pre><h3>3.1 Vérifier que le runner est online</h3><ul><li>UI GitLab → <em>Settings → CI/CD → Runners</em> : il doit être <strong>vert</strong>.</li><li>Logs : docker logs -f gitlab-runner (vous devriez voir « Checking for jobs… »).</li></ul><h3>3.2 Problèmes fréquents &amp; correctifs</h3><ul><li><strong>Job bloqué</strong> : This job is stuck… no active runners / no runners that match tags: docker</li><li>Le runner n’a pas le tag docker <strong>ou</strong> le job a un tag qui ne matche aucun runner → alignez les deux <strong>ou</strong> supprimez les tags côté CI et cochez <em>Run untagged jobs</em>.</li><li>Branche <strong>protected</strong> : autorisez le runner pour les protected branches.</li><li><strong>Runner non enregistré</strong> (logs ressemblants à « Initializing executor providers » sans autre chose)</li><li>Mauvais token/URL ou pas d’enregistrement automatique → vérifiez REGISTRATION_TOKEN et l’URL, relancez.</li></ul><h3>4) Pipeline GitLab CI : tests → Sonar → déploiement</h3><h3>4.1 Variables GitLab CI/CD à définir (projet)</h3><ul><li>SONAR_HOST_URL : ex. https://sonarqube.entreprise.local (⚠️ sans slash final)</li><li>SONAR_PROJECT_KEY : identifiant unique du projet dans SonarQube</li><li>SONAR_TOKEN : token perso généré dans SonarQube (<em>My Account → Security → Generate Token</em>, à <strong>masquer</strong>)</li></ul><h3>4.2 Exemple avec SonarScanner CLI (agnostique au build)</h3><pre>stages: [test, quality, deploy]</pre><pre>unit_tests:<br>  stage: test<br>  image: node:20<br>  script:<br>    - npm ci<br>    - npm test<br>  tags: [docker]</pre><pre>sonarqube_scan:<br>  stage: quality<br>  image: sonarsource/sonar-scanner-cli:latest<br>  script:<br>    - sonar-scanner<br>      -Dsonar.projectKey=$SONAR_PROJECT_KEY<br>      -Dsonar.sources=.<br>      -Dsonar.host.url=$SONAR_HOST_URL<br>      -Dsonar.login=$SONAR_TOKEN<br>      -Dsonar.qualitygate.wait=true<br>  needs: [unit_tests]<br>  tags: [docker]</pre><pre>deploy:<br>  stage: deploy<br>  image: alpine:3.19<br>  script:<br>    - echo &quot;🚀 Déploiement…&quot;<br>  only:<br>    - dev<br>  needs: [sonarqube_scan]<br>  tags: [docker]</pre><blockquote><strong><em>Astuce syntaxe</em></strong><em> : évitez les </em><em>\ à la fin des lignes dans YAML. Listez chaque </em><em>-D… sur sa propre ligne </em><strong><em>sans indentation superflue</em></strong><em> (sinon </em><em>sonar-scanner peut afficher </em><em>ERROR Unrecognized option à cause d’un espace en trop).</em></blockquote><h3>4.3 Exemple Java/Maven (si vous avez un pom.xml)</h3><pre>sonarqube_maven:<br>  stage: quality<br>  image: maven:3.9-eclipse-temurin-17<br>  script:<br>    - mvn -v<br>    - mvn -q -DskipTests=true clean verify<br>    - mvn sonar:sonar \<br>        -Dsonar.projectKey=$SONAR_PROJECT_KEY \<br>        -Dsonar.host.url=$SONAR_HOST_URL \<br>        -Dsonar.login=$SONAR_TOKEN \<br>        -Dsonar.qualitygate.wait=true<br>  tags: [docker]</pre><blockquote><strong><em>Si votre </em></strong><strong><em>pom.xml n’est pas à la racine</em></strong><em> : ajoutez </em><em>cd backend (ou le sous-dossier réel) avant la commande Maven. Erreur type : </em><em>The goal you specified requires a project… there is no POM in this directory.</em></blockquote><h3>5) Dépannage — erreurs réelles &amp; solutions</h3><h3>A) Le bouton GitLab n’apparaît pas</h3><ul><li>Mauvaise config OAuth ou .env non chargé.</li><li>Vérifier logs Sonar (grep -i gitlab), callback exact, variables sans guillemets.</li></ul><h3>B) Après login : not authorized</h3><ul><li>Erreur vue :</li><li>You&#39;re not authorized to access this page. Please contact the administrator.</li><li><strong>Reason</strong>: &#39;gitlab&#39; users are not allowed to sign up</li><li>Solution : mettre SONAR_AUTH_GITLAB_ALLOW_USERS_TO_SIGN_UP=true, redémarrer. Puis donner des droits via le compte admin local si besoin.</li></ul><h3>C) Job CI bloqué (runners)</h3><ul><li>Message : This job is stuck because ... no active runners online ... or no runners that match all of the job&#39;s tags: docker</li><li>Solutions :</li><li>Vérifier que le runner est <strong>online</strong> (UI GitLab + docker logs -f gitlab-runner).</li><li>Aligner les <strong>tags</strong> : soit mettre docker au runner <strong>et</strong> dans les jobs, soit retirer les tags et activer <em>Run untagged jobs</em>.</li><li>Autoriser le runner pour les <strong>protected branches</strong> si dev est protégée.</li></ul><h3>D) Maven : no POM in this directory</h3><ul><li>Le pom.xml n’est pas au répertoire courant.</li><li>Solution : cd dans le sous-dossier correct <strong>avant</strong> d’exécuter mvn.</li></ul><h3>E) SonarScanner CLI : ERROR Unrecognized option: -Dsonar.projectKey=...</h3><ul><li>Cause : mauvaise mise en forme YAML (espace <strong>avant</strong> -D…, ou \ + indentation qui ajoute un espace).</li><li>Solution : utilisez la <strong>forme multi‑lignes YAML</strong> sans antislash, une option -D… par ligne (voir §4.2).</li></ul><h3>F) Quality Gate ne bloque pas le déploiement</h3><ul><li>Ajoutez -Dsonar.qualitygate.wait=true au job d’analyse <strong>et</strong> faites dépendre le job deploy de l’analyse (needs/stages). En cas d’échec de la Quality Gate, le job Sonar échouera et <strong>le déploiement ne partira pas</strong>.</li></ul><h3>G) Variables et secrets</h3><ul><li>Dans GitLab → <em>Settings → CI/CD → Variables</em> :</li><li>SONAR_HOST_URL, SONAR_PROJECT_KEY, SONAR_TOKEN.</li><li>Marquez SONAR_TOKEN comme <strong>masked/protected</strong>.</li><li>Dans .env Docker, <strong>pas de guillemets</strong> autour des valeurs.</li></ul><h3>6) Check‑list finale</h3><ul><li>[ ] SonarQube up sur https://&lt;domaine&gt; via Traefik.</li><li>[ ] GitLab OAuth configuré, login OK, <strong>Allow users to sign up = true</strong>.</li><li>[ ] GitLab Runner online (vert), tags alignés avec les jobs <strong>ou</strong> jobs sans tags + <em>Run untagged jobs</em>.</li><li>[ ] Variables CI/CD définies (SONAR_HOST_URL, SONAR_PROJECT_KEY, SONAR_TOKEN).</li><li>[ ] sonar-scanner avec <strong>une option </strong><strong>-D… par ligne</strong>, pas d’espace parasite.</li><li>[ ] Quality Gate en <strong>wait=true</strong> pour bloquer en cas d’échec.</li></ul><h3>Annexes — commandes utiles</h3><pre># Logs SonarQube<br>docker logs -f sonarqube<br><br># Logs Runner<br>docker logs -f gitlab-runner<br><br># Vérifier la version Maven / emplacement<br>mvn -v<br>pwd<br># Tester un scan local rapide (si accès réseau OK)<br>docker run --rm \<br>  -e SONAR_HOST_URL=https://sonarqube.entreprise.local \<br>  -e SONAR_LOGIN=xxxxx \<br>  -v &quot;$PWD&quot;:/usr/src \<br>  sonarsource/sonar-scanner-cli:latest \<br>  sonar-scanner -Dsonar.projectKey=test -Dsonar.sources=.</pre><h3>Besoin d’un exemple adapté à ta stack (Java, Node, Python, .NET, monorepo) ?</h3><p>Donne-moi ton arborescence et je te fournis le .gitlab-ci.yml prêt à l’emploi (tests + Sonar + déploiement).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f58fcbfe5e65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Fix “Disk Space is Below Threshold of 1.00 GiB on /tmp” in Jenkins]]></title>
            <link>https://medium.com/@3l4un1ck/how-to-fix-disk-space-is-below-threshold-of-1-00-gib-on-tmp-in-jenkins-1d360e4b86f4?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d360e4b86f4</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 07:47:26 GMT</pubDate>
            <atom:updated>2025-06-21T07:47:26.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fcCcFexaDz6s0NXZhZIvJQ.png" /></figure><h3>🔍 Problem Overview</h3><p>If you’re managing a Jenkins server and encounter the following warning:</p><blockquote><strong><em>“Disk space is below threshold of 1.00 GiB. Only 979.28 MiB out of 983.75 MiB left on /tmp.”</em></strong></blockquote><p>It means Jenkins has detected low available space on the /tmp partition — typically used for temporary files during build processes. When this threshold is crossed, Jenkins might halt or cancel builds to prevent system instability.</p><p>This issue is especially common on systems where /tmp is mounted as a RAM-based filesystem (tmpfs) with limited space.</p><h3>❗ Why It Happens</h3><ul><li><strong>/tmp is mounted using </strong><strong>tmpfs</strong> (i.e., in RAM), often with a small default size (e.g., 1 GiB).</li><li>Jenkins uses /tmp to store temporary files during builds, tests, and plugins.</li><li>If that space is exhausted or falls below the configured threshold, Jenkins raises an alert or stops build execution.</li></ul><h3>✅ Solution 1: Increase /tmp Size (If Using tmpfs)</h3><h4>Step 1: Check if /tmp uses tmpfs</h4><pre>mount | grep /tmp</pre><p>If you see something like:</p><pre>tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=1007360k, ...)</pre><p>Then /tmp is a tmpfs mount limited in size (about 1 GiB in this case).</p><h4>Step 2: Increase tmpfs size to 2 GiB</h4><p>Edit /etc/fstab:</p><pre>sudo nano /etc/fstab</pre><p>Find or add:</p><pre>tmpfs /tmp tmpfs defaults,size=2G 0 0</pre><p>Then remount /tmp:</p><pre>sudo mount -o remount /tmp</pre><p>Verify:</p><pre>df -h /tmp</pre><h3>✅ Solution 2: Redirect Jenkins Temporary Folder</h3><p>Instead of relying on /tmp, you can configure Jenkins to use a different location with more disk space.</p><h4>Step 1: Create a new temporary folder</h4><pre>sudo mkdir -p /var/jenkins_tmp<br>sudo chown jenkins:jenkins /var/jenkins_tmp</pre><h4>Step 2: Modify Jenkins configuration</h4><p>Edit Jenkins default settings file (Debian/Ubuntu example):</p><pre>sudo nano /etc/default/jenkins</pre><p>Add or modify the following line:</p><pre>JAVA_ARGS=&quot;-Djava.io.tmpdir=/var/jenkins_tmp&quot;</pre><p>Then restart Jenkins:</p><pre>sudo systemctl restart jenkins</pre><h3>✅ Solution 3: Clean /tmp and Jenkins Workspace</h3><p>If increasing space is not feasible, try cleaning:</p><ul><li>Temporary files:</li></ul><pre>sudo rm -rf /tmp/*</pre><ul><li>Jenkins old builds:</li></ul><p>→ Go to Jenkins UI → Manage Jenkins → Build Discarder</p><p>→ Or delete unused jobs manually in $JENKINS_HOME/jobs</p><h3>🛠 Bonus: Automated Bash Script</h3><p>You can automate these steps with the following script:</p><pre>#!/bin/bash<br>set -e<br><br># Create new temp dir<br>sudo mkdir -p /var/jenkins_tmp<br>sudo chown jenkins:jenkins /var/jenkins_tmp<br><br># Update Jenkins config<br>JENKINS_CONFIG=&quot;/etc/default/jenkins&quot;<br>JAVA_ARGS=&#39;JAVA_ARGS=&quot;-Djava.io.tmpdir=/var/jenkins_tmp&quot;&#39;<br>if grep -q &quot;Djava.io.tmpdir&quot; &quot;$JENKINS_CONFIG&quot;; then<br>  sudo sed -i &quot;s|.*Djava.io.tmpdir=.*|$JAVA_ARGS|&quot; &quot;$JENKINS_CONFIG&quot;<br>else<br>  echo &quot;$JAVA_ARGS&quot; | sudo tee -a &quot;$JENKINS_CONFIG&quot; &gt; /dev/null<br>fi<br><br># Update /tmp to 2G<br>if grep -q &quot;tmpfs /tmp tmpfs&quot; /etc/fstab; then<br>  sudo sed -i &#39;s|tmpfs /tmp tmpfs.*|tmpfs /tmp tmpfs defaults,size=2G 0 0|&#39; /etc/fstab<br>else<br>  echo &quot;tmpfs /tmp tmpfs defaults,size=2G 0 0&quot; | sudo tee -a /etc/fstab &gt; /dev/null<br>fi<br><br># Remount and restart<br>sudo mount -o remount /tmp<br>sudo systemctl restart jenkins<br>echo &quot;[✔] Jenkins temp directory configured and /tmp resized.&quot;</pre><h3>🧾 Conclusion</h3><p>The Disk space is below threshold warning in Jenkins is a common but easily solvable issue. Whether you choose to enlarge /tmp, redirect the temp folder, or clean unused files, these solutions will restore stability and allow Jenkins builds to proceed smoothly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d360e4b86f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Deploy Jenkins with Nginx and Secure it Using Certbot SSL (Let’s Encrypt)]]></title>
            <link>https://medium.com/@3l4un1ck/how-to-deploy-jenkins-with-nginx-and-secure-it-using-certbot-ssl-lets-encrypt-e883d5645d7b?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e883d5645d7b</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 07:30:09 GMT</pubDate>
            <atom:updated>2025-06-21T18:28:38.364Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Xg-4GhhHnp2U6qAgIH_Iw.png" /></figure><p><strong>Jenkins</strong> is a widely-used automation server that helps developers build, test, and deploy code. To run Jenkins securely in a production environment, it’s essential to serve it over HTTPS using a domain name. In this guide, we’ll walk through deploying Jenkins on a Linux server (Ubuntu), setting up <strong>Nginx</strong> as a reverse proxy, and securing the server with <strong>Certbot</strong>and a <strong>Let’s Encrypt SSL certificate</strong>.</p><h3>🔧 Prerequisites</h3><p>Before starting, make sure you have:</p><ul><li>A Linux server (Ubuntu 22.04 or similar)</li><li>A domain name pointing to your server IP (e.g., jenkins.example.com)</li><li>sudo access</li></ul><h3>Step 1: Install Jenkins</h3><p>Jenkins requires Java, so start by installing OpenJDK.</p><pre>sudo apt update<br>sudo apt install -y openjdk-17-jdk</pre><p>Next, add the Jenkins repository and install Jenkins:</p><pre>sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \<br>  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key<br>echo &quot;deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]&quot; \<br>  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \<br>  /etc/apt/sources.list.d/jenkins.list &gt; /dev/null<br>sudo apt-get update<br>sudo apt-get install jenkins</pre><p>Start and enable Jenkins to run on boot:</p><pre>sudo systemctl start jenkins<br>sudo systemctl enable jenkins</pre><p>By default, Jenkins runs on port 8080.</p><h3>Step 2: Install and Configure Nginx</h3><p>We’ll use Nginx to forward requests from port 80/443 to Jenkins on port 8080.</p><h3>Install Nginx</h3><pre>sudo apt install -y nginx<br>sudo systemctl start nginx<br>sudo systemctl enable nginx</pre><h3>Configure a Reverse Proxy</h3><p>Create a new Nginx configuration file for Jenkins:</p><pre>sudo nano /etc/nginx/sites-available/jenkins</pre><p>Paste the following configuration:</p><pre>server {<br>    listen 80;<br>    server_name jenkins.example.com;<br>    location / {<br>        proxy_pass http://localhost:8080;<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &#39;upgrade&#39;;<br>        proxy_set_header Host $host;<br>        proxy_cache_bypass $http_upgrade;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}<br></pre><p>Enable the site and test the config:</p><pre>sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/<br>sudo nginx -t<br>sudo systemctl reload nginx</pre><p>Now, navigating to http://jenkins.example.com should proxy to Jenkins.</p><h3>Step 3: Secure Jenkins with SSL Using Certbot</h3><p>To enable HTTPS, we’ll use <strong>Certbot</strong> to install a free SSL certificate from Let’s Encrypt.</p><h3>Install Certbot</h3><pre>sudo apt install -y certbot python3-certbot-nginx</pre><h3>Obtain and Install SSL Certificate</h3><pre>sudo certbot --nginx -d jenkins.example.com</pre><p>Certbot will:</p><ul><li>Communicate with Let’s Encrypt</li><li>Automatically update your Nginx config</li><li>Reload Nginx with the new SSL configuration</li></ul><p>After completion, your site will be accessible via <a href="https://jenkins.example.com./">https://jenkins.example.com.</a></p><h3>Step 4: Test SSL Auto-Renewal</h3><p>Let’s Encrypt certificates expire every 90 days, but Certbot installs a system timer to handle auto-renewal. You can test it with:</p><pre>sudo certbot renew --dry-run</pre><h3>Optional: Adjust Firewall Rules</h3><p>If UFW is enabled, allow HTTP and HTTPS:</p><pre>sudo ufw allow OpenSSH<br>sudo ufw allow &#39;Nginx Full&#39;<br>sudo ufw enable</pre><h3>✅ Conclusion</h3><p>You now have a fully functioning Jenkins server behind Nginx with HTTPS enabled using Let’s Encrypt. This setup improves security, protects sensitive data, and is ready for production.</p><h3>🧱 Recap</h3><ul><li>Installed Jenkins and ensured it runs on port 8080</li><li>Set up Nginx as a reverse proxy</li><li>Secured the application with SSL using Certbot and Let’s Encrypt</li><li>Configured auto-renewal of certificates</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e883d5645d7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️ Understanding Load Balancing: Principles, Functioning, and Implementation]]></title>
            <link>https://medium.com/@3l4un1ck/%EF%B8%8F-understanding-load-balancing-principles-functioning-and-implementation-8d2f21e64e99?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d2f21e64e99</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 11:12:35 GMT</pubDate>
            <atom:updated>2025-03-26T11:12:35.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4m4yRpIqDcYScyE5TI0f7w.png" /></figure><p><strong>Load Balancing</strong> is a crucial technique that efficiently distributes network traffic across multiple servers. This strategy ensures <strong>optimal performance</strong>, <strong>high availability</strong>, and i<strong>ncreased resilience </strong>for applications and websites.</p><h3>🎯 What is Load Balancing?</h3><p>Load Balancing dynamically distributes workloads across multiple resources (servers, databases, containers, etc.). The goal is to prevent a single server from being overloaded, which could lead to performance degradation or downtime.</p><h3>✅ Why Use Load Balancing?</h3><p>🔹 <strong>Performance Optimization</strong>: Ensures each server operates efficiently without overload.</p><p>🔹 <strong>High Availability</strong>: If one server fails, the load is redistributed to others.</p><p>🔹 <strong>Scalability</strong>: Easily add or remove servers as demand fluctuates.</p><p>🔹 <strong>Enhanced Security</strong>: Some solutions offer protection against DDoS attacks.</p><h3>⚙️ How Does Load Balancing Work?</h3><p>A Load Balancer acts as an intermediary between clients and backend servers. It receives incoming requests, decides where to route them, and ensures balanced distribution.</p><h3><strong>📌 Types of Load Balancing</strong></h3><p>🔸 Layer 3 (Network): Distribution based on IP addresses.</p><p>🔸 Layer 4 (Transport): Routing based on TCP/UDP protocols.</p><p>🔸 Layer 7 (Application): Load balancing based on URLs, cookies, or HTTP headers.</p><h3>🔄 Load Balancing Algorithms</h3><p>▶️ Round Robin: Requests are distributed sequentially across servers.</p><p>▶️ Least Connections: Directs traffic to the server with the fewest active connections.</p><p>▶️ IP Hash: Assigns a server based on the client’s IP address.</p><p>▶️ Weighted Round Robin: Distribution is based on a weight assigned to each server.</p><h3>🛠️ Load Balancing Tools and Technologies</h3><h4>🏢 Hardware Load Balancers</h4><p>💻<strong> F5 Networks, Citrix, A10 Networks</strong>: Robust hardware solutions for critical infrastructures.</p><h4>🔧 Software Load Balancers</h4><p>💡 NGINX: High-performance web server and proxy.</p><p>💡 HAProxy: Advanced load balancing (Layer 4 and 7).</p><p>💡 Traefik: Ideal for microservices.</p><p>💡 Envoy: Modern Load Balancer for cloud-native architectures.</p><h4>☁️ Cloud Load Balancing</h4><p>🚀 AWS Elastic Load Balancer (ELB)</p><p>🚀 Google Cloud Load Balancer</p><p>🚀 Azure Load Balancer</p><h3>🏗️ Setting Up a Load Balancer</h3><h4>📌 With NGINX</h4><pre>sudo apt update &amp;&amp; sudo apt install nginx -y</pre><p>Add the following configuration to `/etc/nginx/nginx.conf`:</p><pre>http {<br>    upstream backend_servers {<br>        server 192.168.1.101;<br>        server 192.168.1.102;<br>    }<br>    server {<br>        listen 80;<br>        location / {<br>            proxy_pass http://backend_servers;<br>        }<br>    }<br>}</pre><p>Restart NGINX:</p><pre>sudo systemctl restart nginx</pre><h4>📌 With Traefik</h4><p>Create a traefik.yml file:</p><pre>entryPoints:<br>  web:<br>    address: &quot;:80&quot;<br>providers:<br>  file:<br>    filename: &quot;/etc/traefik/dynamic.yml&quot;</pre><p>Create dynamic.yml:</p><pre>http:<br>  routers:<br>    myrouter:<br>      rule: &quot;Host(`example.com`)&quot;<br>      service: &quot;myservice&quot;<br>  services:<br>    myservice:<br>      loadBalancer:<br>        servers:<br>          - url: &quot;http://192.168.1.101&quot;<br>          - url: &quot;http://192.168.1.102&quot;</pre><p>Start Traefik:</p><pre>docker run -d -p 80:80 -v $PWD/traefik.yml:/traefik.yml traefik:v2.9</pre><h4>📌 With Envoy</h4><p>Create an envoy.yaml configuration file:</p><pre>static_resources:<br>  listeners:<br>  - name: listener_0<br>    address:<br>      socket_address: { address: 0.0.0.0, port_value: 80 }<br>    filter_chains:<br>    - filters:<br>      - name: envoy.filters.network.http_connection_manager<br>        typed_config:<br>          &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager<br>          stat_prefix: ingress_http<br>          codec_type: AUTO<br>          route_config:<br>            virtual_hosts:<br>            - name: backend<br>              domains: [&quot;*&quot;]<br>              routes:<br>              - match: { prefix: &quot;/&quot; }<br>                route:<br>                  cluster: backend_service<br>          http_filters:<br>          - name: envoy.filters.http.router<br>  clusters:<br>  - name: backend_service<br>    connect_timeout: 0.25s<br>    type: STRICT_DNS<br>    lb_policy: ROUND_ROBIN<br>    load_assignment:<br>      cluster_name: backend_service<br>      endpoints:<br>      - lb_endpoints:<br>        - endpoint:<br>            address:<br>              socket_address: { address: 192.168.1.101, port_value: 80 }<br>        - endpoint:<br>            address:<br>              socket_address: { address: 192.168.1.102, port_value: 80 }</pre><p>Start Envoy:</p><pre>docker run -d -p 80:80 -v $PWD/envoy.yaml:/etc/envoy/envoy.yaml envoyproxy/envoy</pre><h4>🏗️ Load Balancing with Kubernetes</h4><p>Kubernetes simplifies Load Balancing with built-in features like Services, Ingress, and LoadBalancer. Here’s how you can configure a Load Balancer on Kubernetes.</p><p>📌 <strong>Installing Kubernetes</strong><br> Before setting up the Load Balancer, ensure you have a working Kubernetes cluster. You can install Kubernetes with Minikube (for local testing) or deploy a cluster on a cloud provider (AWS, Google Cloud, Azure).</p><p>1️⃣ <strong>Install Minikube (for local testing)</strong></p><pre>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64  <br>sudo install minikube-linux-amd64 /usr/local/bin/minikube  <br>minikube start</pre><p>2️⃣ <strong>Install kubectl (Kubernetes management tool)</strong></p><pre>curl -LO &quot;https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl&quot;  <br>sudo install kubectl /usr/local/bin/</pre><h4>🚀 <strong>Setting Up Load Balancing with Kubernetes</strong></h4><p>📌 <strong>1. Creating a LoadBalancer Service</strong><br> A Service exposes an application running on a set of pods. Kubernetes offers several types of Services:</p><ul><li><strong>ClusterIP (default):</strong> Internal cluster access.</li><li><strong>NodePort:</strong> Exposes the application on a Kubernetes node port.</li><li><strong>LoadBalancer:</strong> Provides an external access point with automatic load balancing.</li></ul><p>Create a service-loadbalancer.yaml file:</p><pre>apiVersion: v1  <br>kind: Service  <br>metadata:  <br>  name: my-loadbalancer-service  <br>spec:  <br>  type: LoadBalancer  <br>  selector:  <br>    app: my-app  <br>  ports:  <br>    - protocol: TCP  <br>      port: 80  <br>      targetPort: 8080</pre><p>Deploy the service using:</p><pre>kubectl apply -f service-loadbalancer.yaml</pre><p>Check its status:</p><pre>kubectl get services</pre><p>On a cloud provider like AWS or Google Cloud, an external IP will be assigned to handle load balancing.</p><p>📌 <strong>2. Configuring an Ingress Controller</strong><br> For advanced Load Balancing with HTTP routing, use Ingress.</p><p>Create an ingress.yaml file:</p><pre>apiVersion: networking.k8s.io/v1  <br>kind: Ingress  <br>metadata:  <br>  name: my-ingress  <br>spec:  <br>  rules:  <br>  - host: example.com  <br>    http:  <br>      paths:  <br>      - path: /  <br>        pathType: Prefix  <br>        backend:  <br>          service:  <br>            name: my-loadbalancer-service  <br>            port:  <br>              number: 80</pre><p>Apply the configuration:</p><pre>kubectl apply -f ingress.yaml</pre><h3>📊 <strong>Monitoring Load Balancing</strong></h3><p>Monitor your servers with Prometheus + Grafana:</p><pre>docker run -d -p 9090:9090 prom/prometheus</pre><p>Install Grafana:</p><pre>docker run -d -p 3000:3000 grafana/grafana</pre><p>Add Prometheus as a data source and visualize the metrics!</p><p>🎯 <strong>Conclusion</strong></p><p>Load Balancing is essential for scalability and resilience. With NGINX, Traefik, Envoy, Kubernetes, and monitoring tools, you ensure a high-performance system!</p><p>🔹 <strong>Which solution do you use? </strong>Share in the comments!<strong> 🚀</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d2f21e64e99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding __init__.py in Python: Role and Usage]]></title>
            <link>https://medium.com/@3l4un1ck/understanding-init-py-in-python-role-and-usage-deab6f441870?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/deab6f441870</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 08:35:55 GMT</pubDate>
            <atom:updated>2025-03-24T08:35:55.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5d6bpkYBDvsSq4XmekiC9A.png" /></figure><h3>Introduction</h3><p>In Python, the __init__.py file plays a crucial role in the structure of modules and packages. While it may seem insignificant, it is essential for properly organizing code and efficiently utilizing modules. This article explores what __init__.py is, its purpose, how to use it, and best practices.</p><h3>What is __init__.py?</h3><p>The __init__.py file is a special file that allows Python to recognize a directory as a package. Before Python 3.3, its presence was mandatory for a directory to be considered a module. Although this requirement has been relaxed, __init__.py is still useful for controlling package behavior.</p><h3>What is a Hook in Programming?</h3><p>A <strong>hook</strong> is a mechanism that allows executing an action at a specific moment in a program’s lifecycle. It is used to intercept and modify the normal execution of a program. In the context of __init__.py, a hook can be used to run code automatically when a package is imported, such as initializing global variables, configuring logs, or registering plugins.</p><h3>Purpose of __init__.py</h3><ol><li><strong>Marking a directory as a package</strong>:</li></ol><ul><li>When a directory contains an __init__.py file, Python recognizes it as a package (an organized set of Python modules used for structuring a project) and allows importing its submodules.</li></ul><p><strong>2. Executing initialization code</strong>:</p><ul><li>The file can contain code executed when the package is imported, such as setting up global variables or registering hooks.</li></ul><p><strong>3. Controlling imports</strong>:</p><ul><li>It allows importing submodules and exposing them at the package level, making access easier.</li></ul><h3>How to Use __init__.py</h3><h4>1. Creating a Simple Package</h4><p>File structure:</p><pre>my_project/<br>    my_package/<br>        __init__.py<br>        module1.py<br>        module2.py</pre><p>The __init__.py file can be empty, which is sufficient to mark my_package as a package.</p><h4>2. Exposing Modules at the Package Level</h4><p>You can define the package content by exposing certain modules:</p><pre># my_package/__init__.py<br>from .module1 import function1<br>from .module2 import Class1</pre><p>This allows importing like this:</p><pre>from my_package import function1</pre><p>instead of:</p><pre>from my_package.module1 import function1</pre><h4>3. Running Code on Import</h4><p>The file can contain code that runs when the package is imported:</p><pre># my_package/__init__.py<br>print(&quot;The my_package package has been imported!&quot;)</pre><p>When import my_package is executed, this message will appear.</p><h4>4. Managing Imports with __all__</h4><p>You can define which modules are accessible when using from my_package import *:</p><pre># my_package/__init__.py<br>__all__ = [&#39;module1&#39;, &#39;module2&#39;]</pre><h4>5. Using Hooks for Automatic Initialization</h4><p>If you want to execute specific code on every import, you can use hooks inside __init__.py:</p><pre># my_package/__init__.py<br>import logging<br>logging.basicConfig(level=logging.INFO)<br>logging.info(&quot;The my_package package is initialized&quot;)</pre><p>This will configure logging automatically when the package is imported.</p><h3>Best Practices</h3><ul><li><strong>Keep </strong><strong>__init__.py lightweight</strong>: Avoid complex logic inside this file.</li><li><strong>Use </strong><strong>__all__ with caution</strong>: It can be useful for exposing specific submodules, but avoid import * when possible.</li><li><strong>Organize imports logically</strong>: Do not overload the file with too many imports for better readability.</li><li><strong>Use hooks for specific tasks</strong>: Avoid excessive global initializations and prefer dedicated modules.</li></ul><h3>Conclusion</h3><p>The __init__.py file is a key component of module organization in Python. Although it is no longer mandatory, it remains highly useful for structuring projects and controlling module imports. When used properly, it enhances package accessibility and maintainability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deab6f441870" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comprendre __init__.py en Python : Rôle et Utilisation]]></title>
            <link>https://medium.com/@3l4un1ck/comprendre-init-py-en-python-r%C3%B4le-et-utilisation-607be6629d78?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/607be6629d78</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 08:32:16 GMT</pubDate>
            <atom:updated>2025-03-24T08:32:16.117Z</atom:updated>
            <content:encoded><![CDATA[<h3>Comprendre __init__.py en Python : Rôle et Utilisation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5d6bpkYBDvsSq4XmekiC9A.png" /></figure><h3>Introduction</h3><p>En Python, le fichier __init__.py joue un rôle fondamental dans la structure des modules et des paquets. Bien qu&#39;il puisse sembler anodin, il est essentiel pour organiser proprement le code et permettre une utilisation efficace des modules. Dans cet article, nous allons explorer ce qu&#39;est __init__.py, son utilité, comment l&#39;utiliser et les bonnes pratiques à adopter.</p><h3>Qu’est-ce que __init__.py ?</h3><p>Le fichier __init__.py est un fichier spécial qui permet à Python de reconnaître un répertoire comme un package. Avant Python 3.3, sa présence était obligatoire pour qu&#39;un répertoire soit considéré comme un module. Depuis, ce n&#39;est plus strictement nécessaire, mais son usage reste pertinent pour contrôler le comportement des paquets.</p><h3>Qu’est-ce qu’un hook en programmation ?</h3><p>Un <strong>hook</strong> (ou crochet en français) est un mécanisme permettant d’exécuter une action à un moment spécifique du cycle de vie d’un programme. Il sert à intercepter et modifier l’exécution normale d’un programme. Dans le contexte de __init__.py, un hook peut être utilisé pour exécuter du code automatiquement lorsqu&#39;un package est importé, comme l&#39;initialisation de variables globales, la configuration de logs ou l&#39;enregistrement de plugins.</p><h3>À quoi sert __init__.py ?</h3><ol><li><strong>Marquer un dossier comme un package</strong> :</li></ol><ul><li>Lorsqu’un dossier contient un fichier __init__.py, Python le considère comme un package (un ensemble organisé de modules Python permettant de structurer un projet) et permet d&#39;importer ses sous-modules.</li></ul><p><strong>2. Exécuter un code d’initialisation</strong> :</p><ul><li>Le fichier peut contenir du code qui sera exécuté lors de l’importation du package, par exemple pour initialiser des variables globales ou enregistrer des hooks.</li></ul><p><strong>3. Contrôler les imports</strong> :</p><ul><li>Il permet d’importer des sous-modules et de les exposer au niveau du package, facilitant ainsi leur accès.</li></ul><h3>Comment utiliser __init__.py ?</h3><h3>1. Création d’un package simple</h3><p>Structure de fichiers :</p><pre>mon_projet/<br>    mon_package/<br>        __init__.py<br>        module1.py<br>        module2.py</pre><p>Le fichier __init__.py peut être vide, ce qui est suffisant pour marquer mon_package comme un package.</p><h3>2. Exposer des modules au niveau du package</h3><p>On peut définir le contenu du package en exposant certains modules :</p><pre># mon_package/__init__.py<br>from .module1 import fonction1<br>from .module2 import classe1</pre><p>Ainsi, au lieu de devoir importer comme ceci :</p><pre>from mon_package.module1 import fonction1</pre><p>On peut directement faire :</p><pre>from mon_package import fonction1</pre><h3>3. Exécuter du code lors de l’import</h3><p>Le fichier peut contenir du code exécuté lors de l’importation du package :</p><pre># mon_package/__init__.py<br>print(&quot;Le package mon_package a été importé !&quot;)</pre><p>Ainsi, lorsque l’on fait import mon_package, ce message s&#39;affichera.</p><h3>4. Gérer les imports avec __all__</h3><p>On peut définir une liste de modules accessibles lorsqu’on utilise from mon_package import * :</p><pre># mon_package/__init__.py<br>__all__ = [&#39;module1&#39;, &#39;module2&#39;]</pre><h3>5. Utiliser des hooks pour l’initialisation automatique</h3><p>Si vous souhaitez exécuter du code spécifique à chaque import, vous pouvez utiliser des hooks dans __init__.py :</p><pre># mon_package/__init__.py<br>import logging<br>logging.basicConfig(level=logging.INFO)<br>logging.info(&quot;Le package mon_package est initialisé&quot;)</pre><p>Ce code configurera automatiquement les logs lors de l’importation du package.</p><h3>Bonnes pratiques</h3><ul><li><strong>Ne surchargez pas </strong><strong>__init__.py</strong> : Gardez ce fichier simple et évitez d&#39;y mettre du code complexe.</li><li><strong>Utilisez </strong><strong>__all__ avec précaution</strong> : Cela peut être utile pour exposer certains sous-modules, mais il est préférable d&#39;éviter import *.</li><li><strong>Regroupez les imports logiquement</strong> : Ne surchargez pas le fichier avec trop d’importations pour améliorer la lisibilité.</li><li><strong>Utilisez les hooks pour des tâches spécifiques</strong> : Évitez d’y mettre trop d’initialisations globales, privilégiez des modules dédiés.</li></ul><h3>Conclusion</h3><p>Le fichier __init__.py est un élément clé de l&#39;organisation des modules en Python. Bien qu&#39;il ne soit plus obligatoire, il reste très utile pour structurer les projets et contrôler l&#39;importation des modules. En l&#39;utilisant correctement, vous pouvez rendre vos paquets plus accessibles et mieux organisés.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=607be6629d78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️ Comprendre le Load Balancing : Principe, Fonctionnement et Mise en Place]]></title>
            <link>https://medium.com/@3l4un1ck/%EF%B8%8F-comprendre-le-load-balancing-principe-fonctionnement-et-mise-en-place-a0ca484c6ea1?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0ca484c6ea1</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 18:15:12 GMT</pubDate>
            <atom:updated>2025-03-26T10:08:40.658Z</atom:updated>
            <content:encoded><![CDATA[<h3>🏗️ Comprendre le Load Balancing : Principe, Fonctionnement et Mise en Place</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkmvPY239aGZp1Q_fRzUGg.jpeg" /></figure><p>Le <strong>Load Balancing</strong>, ou répartition de charge, est une technique essentielle permettant de distribuer efficacement le trafic réseau entre plusieurs serveurs. Cette stratégie garantit <strong>des performances optimales, une haute disponibilité et une résilience accrue</strong> des applications et sites web.</p><h3>🎯 Qu’est-ce que le Load Balancing ?</h3><p>Le Load Balancing consiste à répartir dynamiquement les charges de travail entre plusieurs ressources (serveurs, bases de données, containers, etc.). Son but est d’éviter qu’un seul serveur ne soit surchargé, ce qui pourrait entraîner une dégradation des performances ou une panne.</p><h3>✅ Pourquoi utiliser le Load Balancing ?</h3><p>🔹 <strong>Optimisation des performances</strong> : Chaque serveur fonctionne efficacement sans saturation.</p><p>🔹 <strong>Haute disponibilité</strong> : Si un serveur tombe en panne, la charge est redistribuée aux autres.</p><p>🔹 <strong>Scalabilité</strong> : Ajout ou retrait de serveurs selon la demande.</p><p>🔹 <strong>Sécurité accrue</strong> : Certaines solutions incluent des protections contre les attaques DDoS.</p><h3>⚙️ Comment fonctionne le Load Balancing ?</h3><p>Le Load Balancer agit comme un <strong>intermédiaire</strong> entre les clients et les serveurs backend. Il reçoit les requêtes entrantes, décide où les rediriger et assure une distribution équilibrée.</p><h3>📌 Types de Load Balancing</h3><p>🔸 <strong>Layer 3 (Réseau)</strong> : Répartition basée sur les adresses IP.</p><p>🔸 <strong>Layer 4 (Transport)</strong> : Distribution en fonction du protocole TCP/UDP.</p><p>🔸 <strong>Layer 7 (Application)</strong> : Répartition selon l’URL, les cookies ou les en-têtes HTTP.</p><h3>🔄 Algorithmes de répartition</h3><p>▶️ <strong>Round Robin</strong> : Distribution circulaire des requêtes.</p><p>▶️ <strong>Least Connections</strong> : Envoi des requêtes au serveur avec le moins de connexions actives.</p><p>▶️ <strong>IP Hash</strong> : Assignation d’un serveur en fonction de l’adresse IP du client.</p><p>▶️ <strong>Weighted Round Robin</strong> : Distribution basée sur un poids attribué à chaque serveur.</p><h3>🛠️ Outils et Technologies de Load Balancing</h3><h3>🏢 Load Balancers Matériels</h3><p>💻 <strong>F5 Networks</strong>, <strong>Citrix</strong>, <strong>A10 Networks</strong> : Solutions matérielles robustes pour des infrastructures critiques.</p><h3>🔧 Load Balancers Logiciels</h3><p>💡 <strong>NGINX</strong> : Serveur web et proxy performant.</p><p>💡 <strong>HAProxy</strong> : Répartition de charge avancée (Layer 4 et 7).</p><p>💡 <strong>Traefik</strong> : Idéal pour les microservices.</p><p>💡 <strong>Envoy</strong> : Load Balancer moderne conçu pour les architectures cloud-native.</p><h3>☁️ Load Balancing dans le Cloud</h3><p>🚀 <strong>AWS Elastic Load Balancer (ELB)</strong></p><p>🚀 <strong>Google Cloud Load Balancer</strong></p><p>🚀 <strong>Azure Load Balancer</strong></p><h3>🏗️ Mise en Place d’un Load Balancer</h3><h3>📌 Avec NGINX</h3><pre>sudo apt update &amp;&amp; sudo apt install nginx -y</pre><p>Ajoutez cette configuration à /etc/nginx/nginx.conf :</p><pre>http {<br>    upstream backend_servers {<br>        server 192.168.1.101;<br>        server 192.168.1.102;<br>    }<br>    server {<br>        listen 80;<br>        location / {<br>            proxy_pass http://backend_servers;<br>        }<br>    }<br>}</pre><p>Redémarrez NGINX :</p><pre>sudo systemctl restart nginx</pre><h3>📌 Avec Traefik</h3><p>Créez un fichier traefik.yml :</p><pre>entryPoints:<br>  web:<br>    address: &quot;:80&quot;<br>providers:<br>  file:<br>    filename: &quot;/etc/traefik/dynamic.yml&quot;</pre><p>Ajoutez dynamic.yml :</p><pre>http:<br>  routers:<br>    myrouter:<br>      rule: &quot;Host(`example.com`)&quot;<br>      service: &quot;myservice&quot;<br>  services:<br>    myservice:<br>      loadBalancer:<br>        servers:<br>          - url: &quot;http://192.168.1.101&quot;<br>          - url: &quot;http://192.168.1.102&quot;</pre><p>Démarrez Traefik :</p><pre>docker run -d -p 80:80 -v $PWD/traefik.yml:/traefik.yml traefik:v2.9</pre><h3>📌 Avec Envoy</h3><p>Ajoutez cette configuration envoy.yaml :</p><pre>static_resources:<br>  listeners:<br>  - name: listener_0<br>    address:<br>      socket_address: { address: 0.0.0.0, port_value: 80 }<br>    filter_chains:<br>    - filters:<br>      - name: envoy.filters.network.http_connection_manager<br>        typed_config:<br>          &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager<br>          stat_prefix: ingress_http<br>          codec_type: AUTO<br>          route_config:<br>            virtual_hosts:<br>            - name: backend<br>              domains: [&quot;*&quot;]<br>              routes:<br>              - match: { prefix: &quot;/&quot; }<br>                route:<br>                  cluster: backend_service<br>          http_filters:<br>          - name: envoy.filters.http.router<br>  clusters:<br>  - name: backend_service<br>    connect_timeout: 0.25s<br>    type: STRICT_DNS<br>    lb_policy: ROUND_ROBIN<br>    load_assignment:<br>      cluster_name: backend_service<br>      endpoints:<br>      - lb_endpoints:<br>        - endpoint:<br>            address:<br>              socket_address: { address: 192.168.1.101, port_value: 80 }<br>        - endpoint:<br>            address:<br>              socket_address: { address: 192.168.1.102, port_value: 80 }</pre><p>Démarrez Envoy :</p><pre>docker run -d -p 80:80 -v $PWD/envoy.yaml:/etc/envoy/envoy.yaml envoyproxy/envoy</pre><h3>🏗️ Load Balancing avec Kubernetes</h3><p>Kubernetes facilite la mise en place du Load Balancing grâce à ses fonctionnalités intégrées comme <strong>Services</strong>, <strong>Ingress</strong> et <strong>LoadBalancer</strong>. Voici comment vous pouvez configurer un Load Balancer sur Kubernetes.</p><h3>📌 Installation de Kubernetes</h3><p>Avant de configurer le Load Balancer, assurez-vous d’avoir un cluster Kubernetes fonctionnel. Vous pouvez installer Kubernetes avec <strong>minikube</strong> (pour des tests en local) ou déployer un cluster sur un cloud provider (AWS, Google Cloud, Azure).</p><h4>1️⃣ Installer Minikube (pour un test local)</h4><pre>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64<br>sudo install minikube-linux-amd64 /usr/local/bin/minikube<br>minikube start</pre><h4>2️⃣ Installer kubectl (outil de gestion Kubernetes)</h4><pre>curl -LO &quot;https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl&quot;<br>sudo install kubectl /usr/local/bin/</pre><h3>🚀 Mise en Place du Load Balancing avec Kubernetes</h3><h3>📌 1. Création d’un Service de type LoadBalancer</h3><p>Un <strong>Service</strong> expose une application exécutée sur un ensemble de pods. Kubernetes propose plusieurs types de Services :</p><ul><li><strong>ClusterIP</strong> (par défaut) : Accès interne au cluster.</li><li><strong>NodePort</strong> : Expose l’application sur un port d’un nœud Kubernetes.</li><li><strong>LoadBalancer</strong> : Fournit un point d’accès externe avec un équilibrage de charge automatique.</li></ul><p>Créez un fichier service-loadbalancer.yaml :</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: my-loadbalancer-service<br>spec:<br>  type: LoadBalancer<br>  selector:<br>    app: my-app<br>  ports:<br>    - protocol: TCP<br>      port: 80<br>      targetPort: 8080</pre><p>Déployez ce service avec la commande :</p><pre>kubectl apply -f service-loadbalancer.yaml</pre><p>Vérifiez son statut :</p><pre>kubectl get services</pre><p>Sur un cloud provider comme AWS ou Google Cloud, une IP externe sera attribuée pour gérer la répartition de charge.</p><h3>📌 2. Configuration d’un Ingress Controller</h3><p>Si vous souhaitez un Load Balancer plus avancé avec du routage HTTP, utilisez <strong>Ingress</strong>.</p><p>Créez un fichier ingress.yaml :</p><pre>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: my-ingress<br>spec:<br>  rules:<br>  - host: example.com<br>    http:<br>      paths:<br>      - path: /<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: my-loadbalancer-service<br>            port:<br>              number: 80</pre><p>Appliquez la configuration :</p><pre>kubectl apply -f ingress.yaml</pre><h3>📊 Monitoring du Load Balancing</h3><p>Surveillez vos serveurs avec <strong>Prometheus + Grafana</strong> :</p><pre>docker run -d -p 9090:9090 prom/prometheus</pre><p>Installez Grafana :</p><pre>docker run -d -p 3000:3000 grafana/grafana</pre><p>Ajoutez Prometheus comme source de données et visualisez les métriques !</p><h3>🎯 Conclusion</h3><p>Le Load Balancing est <strong>indispensable</strong> pour assurer <strong>scalabilité et résilience</strong>. Avec <strong>NGINX, Traefik, Envoy, Kubernetes</strong>, et des outils de monitoring, vous garantissez un système performant !</p><p>🔹 <strong>Quelle solution utilisez-vous ?</strong> Partagez en commentaire ! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0ca484c6ea1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Déployer une application Laravel sur un hébergement OVH]]></title>
            <link>https://medium.com/@3l4un1ck/d%C3%A9ployer-une-application-laravel-sur-un-h%C3%A9bergement-ovh-0fedbe882912?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fedbe882912</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Fri, 07 Mar 2025 06:06:35 GMT</pubDate>
            <atom:updated>2025-03-07T06:09:13.992Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n6t7W-iGlszdieCyZxWtLQ.jpeg" /></figure><p>Laravel est l’un des frameworks PHP les plus populaires pour le développement web. Si vous souhaitez déployer votre application Laravel sur un hébergement OVH, voici un guide pas à pas pour vous aider.</p><h3>🔧 Préparer l’application Laravel</h3><p>Avant le déploiement, il est essentiel d’optimiser votre application pour la production.</p><h3>1. Installer les dépendances</h3><p>Mettez à jour et installez uniquement les dépendances nécessaires pour la production :</p><pre>composer install --optimize-autoloader --no-dev</pre><h3>2. Générer la clé d’application</h3><pre>php artisan key:generate</pre><h3>3. Optimiser le cache</h3><pre>php artisan config:cache<br>php artisan route:cache<br>php artisan view:cache</pre><h3>4. Nettoyer le cache</h3><pre>php artisan cache:clear<br>php artisan view:clear</pre><p>Assurez-vous que votre fichier .gitignore exclut les fichiers inutiles comme vendor et .env.</p><h3>🛠️ Transférer les fichiers sur OVH</h3><p>Vous pouvez utiliser FTP ou SSH pour envoyer vos fichiers sur le serveur.</p><h3>1. Connexion au serveur</h3><p><strong>Via FTP :</strong> Utilisez un client comme FileZilla.</p><p><strong>Via SSH :</strong> Si vous avez un accès SSH, transférez les fichiers avec :</p><pre>scp -r /chemin/vers/votre/projet user@votre-domaine.com:/chemin/vers/destination</pre><h3>2. Déplacer les fichiers</h3><p>Placez tous les fichiers de votre application Laravel dans le répertoire www ou htdocs de votre hébergement OVH.</p><h3>📂 Configurer l’environnement</h3><h3>1. Créer le fichier .env</h3><pre>cp .env.example .env</pre><p>Mettez à jour les informations de base de données et les clés d’API dans .env.</p><h3>2. Configurer la base de données</h3><p>Créez une base de données dans l’espace client OVH ou via phpMyAdmin, puis mettez à jour les informations dans .env.</p><h3>🔧 Configurer le serveur web</h3><h3>1. Point d’entrée de l’application</h3><p>Vérifiez que votre serveur pointe vers public/index.php.</p><h3>2. Définir les permissions</h3><pre>chmod -R 755 storage<br>chmod -R 755 bootstrap/cache</pre><h3>💻 Tester l’application</h3><p>Visitez votre domaine pour vous assurer que l’application fonctionne correctement.</p><h3>✨ Automatiser le déploiement (Optionnel)</h3><p>Utilisez un outil comme Deployer pour simplifier les mises à jour.</p><h3>1. Installer Deployer</h3><pre>composer require deployer/deployer --dev</pre><h3>2. Configurer le fichier de déploiement</h3><p>Créez deploy.php à la racine du projet et configurez-le.</p><h3>3. Exécuter le déploiement</h3><pre>dep deploy</pre><h3>🎉 Conclusion</h3><p>Félicitations ! Votre application Laravel est désormais en ligne sur OVH. Pensez à surveiller ses performances et à effectuer des mises à jour régulières.</p><p>En cas de problème, consultez la documentation Laravel ou contactez le support OVH. Bon déployment ! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fedbe882912" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Converting VCF to JSON with Python]]></title>
            <link>https://medium.com/@3l4un1ck/converting-vcf-to-json-with-python-4c17f149d4b8?source=rss-edf9b23f42f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c17f149d4b8</guid>
            <dc:creator><![CDATA[elaurichenickson]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 20:00:54 GMT</pubDate>
            <atom:updated>2025-01-10T20:00:54.216Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_sLojoqnoyFWgy9SuHkG4Q.png" /></figure><p>The vCard format (VCF) is widely used to store contact information, but sometimes we need to convert this data into JSON for better compatibility with modern systems. In this article, we’ll explore how to perform this conversion using Python in a clear and detailed way.</p><h3>What You’ll Learn</h3><ol><li>What is a VCF file?</li><li>Why convert VCF to JSON?</li><li>How to use Python to convert VCF to JSON.</li></ol><h3>What Is a VCF File?</h3><p>A VCF (vCard File) is a text-based format for storing contact information such as names, phone numbers, email addresses, and more. Here’s an example:</p><pre>BEGIN:VCARD<br>VERSION:3.0<br>FN:John Doe<br>TEL;TYPE=CELL:+123456789<br>EMAIL:john.doe@example.com<br>END:VCARD</pre><h3>Why Convert VCF to JSON?</h3><p>JSON (JavaScript Object Notation) is a lightweight data-interchange format that’s easy to read and parse. Converting VCF to JSON makes it easier to integrate contact data into web applications, APIs, and databases.</p><h3>Python to the Rescue</h3><p>Python provides excellent libraries like vobject and json to handle VCF and JSON files. Here&#39;s a step-by-step guide to performing the conversion.</p><h4>Step 1: Install Required Libraries</h4><p>Install the vobject library to parse VCF files. If you don’t already have it, install it using pip:</p><pre>pip install vobject</pre><h4>Step 2: Parse the VCF File</h4><p>The vobject library makes parsing VCF files straightforward. Below is a function to extract contact details:</p><pre>import vobject<br>def parse_vcf(file_path):<br>    contacts = []<br>    with open(file_path, &#39;r&#39;) as file:<br>        vcard = []<br>        for line in file:<br>            line = line.strip()<br>            if line.startswith(&quot;BEGIN:VCARD&quot;):<br>                vcard = []<br>            vcard.append(line)<br>            if line.startswith(&quot;END:VCARD&quot;):<br>                vobject_vcard = vobject.readOne(&quot;\n&quot;.join(vcard))<br>                contact = {<br>                    &quot;full_name&quot;: vobject_vcard.fn.value,<br>                    &quot;phone&quot;: getattr(vobject_vcard.tel, &#39;value&#39;, None),<br>                    &quot;email&quot;: getattr(vobject_vcard.email, &#39;value&#39;, None),<br>                }<br>                contacts.append(contact)<br>    return contacts</pre><h4>Step 3: Convert to JSON</h4><p>Use the built-in json library to convert the parsed data into JSON:</p><pre>import json<br>def save_to_json(data, output_path):<br>    with open(output_path, &#39;w&#39;) as json_file:<br>        json.dump(data, json_file, indent=4)</pre><h4>Step 4: Bringing It All Together</h4><p>Here’s the complete script to convert a VCF file to JSON:</p><pre>import vobject<br>import json<br>def parse_vcf(file_path):<br>    contacts = []<br>    with open(file_path, &#39;r&#39;) as file:<br>        vcard = []<br>        for line in file:<br>            line = line.strip()<br>            if line.startswith(&quot;BEGIN:VCARD&quot;):<br>                vcard = []<br>            vcard.append(line)<br>            if line.startswith(&quot;END:VCARD&quot;):<br>                vobject_vcard = vobject.readOne(&quot;\n&quot;.join(vcard))<br>                contact = {<br>                    &quot;full_name&quot;: vobject_vcard.fn.value,<br>                    &quot;phone&quot;: getattr(vobject_vcard.tel, &#39;value&#39;, None),<br>                    &quot;email&quot;: getattr(vobject_vcard.email, &#39;value&#39;, None),<br>                }<br>                contacts.append(contact)<br>    return contacts<br><br>def save_to_json(data, output_path):<br>    with open(output_path, &#39;w&#39;) as json_file:<br>        json.dump(data, json_file, indent=4)<br><br>if __name__ == &quot;__main__&quot;:<br>    vcf_file = &quot;contacts.vcf&quot;<br>    json_file = &quot;contacts.json&quot;<br>    contacts = parse_vcf(vcf_file)<br>    save_to_json(contacts, json_file)<br>    print(f&quot;Converted {vcf_file} to {json_file}&quot;)</pre><h4>Step 5: Run the Script</h4><p>Save the script as vcf_to_json.py and run it:</p><pre>python vcf_to_json.py</pre><h3>Conclusion</h3><p>In this tutorial, you learned how to convert VCF files to JSON using Python. This approach can be extended for more complex vCards or to handle edge cases. Whether you’re building a contact management system or integrating with a CRM, this script serves as a solid starting point.</p><p>Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c17f149d4b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>