home page mod and git article added

This commit is contained in:
ed barz 2023-01-09 14:49:06 +01:00
parent 7cdbb982ca
commit 2e5b0d75f5
2 changed files with 115 additions and 13 deletions

View File

@ -8,27 +8,19 @@
<span class="byl-icon-home"></span>
</a>
</section>
<!--
<section id="right-nav">
<a href="/" class="islang">FR</a> /
<a href="/">ENG</a>
</section>
-->
</nav>
<main id="root">
<main id="root" class="homepage">
<h3>Lorem Ipsum</h3>
<a href="/proj">
<h3>Projets</h3>
</a>
<p>I'm baby live-edge chia portland, crucifix fingerstache vice hoodie waistcoat. Af sartorial bushwick keytar activated charcoal asymmetrical jianbing pinterest shabby chic locavore you probably haven't heard of them cornhole. Shoreditch pitchfork meggings activated charcoal hashtag artisan stumptown poutine. Banjo green juice activated charcoal lyft meh af, keffiyeh gastropub raw denim master cleanse chia jianbing polaroid. Hashtag fashion axe fingerstache wayfarers salvia tilde plaid, small batch echo park ennui typewriter you probably haven't heard of them messenger bag migas affogato. Twee blue bottle echo park tbh yuccie, pok pok freegan.</p>
<p>I'm baby live-edge chia portland, crucifix fingerstache vice hoodie waistcoat. Af sartorial bushwick keytar activated charcoal asymmetrical jianbing pinterest shabby chic locavore you probably haven't heard of them cornhole. Shoreditch pitchfork meggings activated charcoal hashtag artisan stumptown poutine. Banjo green juice activated charcoal lyft meh af, keffiyeh gastropub raw denim master cleanse chia jianbing polaroid. Hashtag fashion axe fingerstache wayfarers salvia tilde plaid, small batch echo park ennui typewriter you probably haven't heard of them messenger bag migas affogato. Twee blue bottle echo park tbh yuccie, pok pok freegan.</p>
<p>I'm baby live-edge chia portland, crucifix fingerstache vice hoodie waistcoat. Af sartorial bushwick keytar activated charcoal asymmetrical jianbing pinterest shabby chic locavore you probably haven't heard of them cornhole. Shoreditch pitchfork meggings activated charcoal hashtag artisan stumptown poutine. Banjo green juice activated charcoal lyft meh af, keffiyeh gastropub raw denim master cleanse chia jianbing polaroid. Hashtag fashion axe fingerstache wayfarers salvia tilde plaid, small batch echo park ennui typewriter you probably haven't heard of them messenger bag migas affogato. Twee blue bottle echo park tbh yuccie, pok pok freegan.</p>
<p>Bienvenu sur mon site.</p>
</main>

View File

@ -0,0 +1,110 @@
<?php $page_title = "edbrz9 - Créer et maintenir à jour un site avec git"; ?>
<?php include($_SERVER['DOCUMENT_ROOT']."/assets/php/header.php"); ?>
<main>
<h1>Créer et maintenir à jour un site avec git</h1>
<p>Dans ce billet, je vais présenter une manière de gérer un site web statique via un dépôt git. Je ferais certaines références à Yunohost mais il va sans dire que cette approche peut se décliner sur n'importe quel serveur.</p>
<h4>La racine</h4>
<p>Si vous avez déjà votre propre serveur (sous nginx, apache, lighttpd...) vous pouvez passer cette étape.</p>
<p>Sur Yunohost, si on ne veut pas mettre les mains dans les configs nginx, il va falloir installer un "bac à sable", une application vide qui sera la racine de notre site.</p>
<p>Lors de ma première installation de Yunohost, cette appli était disponible depuis l'interface mais il semblerait que ce ne soit plus le cas. Il faudra donc copier-coller ce lien dans le formulaire "Install custom app" en bas de la page d'installation.</p>
<a href="https://github.com/YunoHost-Apps/multi_webapp_ynh" target="_blank">https://github.com/YunoHost-Apps/multi_webapp_ynh</a>
### Gitea
Si ce n'est pas déjà fait, on va commencer par installer un serveur Gitea.
Pour pouvoir créer des hook côté serveur, il va d'abord falloir rajouter une ligne au fichier /opt/gitea/custom/conf/app.ini :
``[security]``
``DISABLE_GIT_HOOKS = false``
[(liste complète des options)](https://docs.gitea.io/en-us/config-cheat-sheet/)
Penser ensuite à redémarrer gitea
`$ yunohost service restart gitea`
Vous pourrez maintenant créer des hooks sur vos dépots.
git check-out
yunohost simple site
```
#!/bin/sh
TARGET=/var/www/webapp_user/domain.tld_/
git --work-tree=$TARGET clean -fd
git --work-tree=$TARGET checkout --force
```
Enfin, n'oubliez pas de donner l'accès à gitea sur le serveur:
`$ chown gitea:gitea /var/www/webapp_user/domain.tld_/`
Dès que vous ferez un git push depuis votre client vers le dépot, git se chargera de mettre à jour à votre site.
#### Problème de taille
Si vous avez besoin de gros fichiers pour votre site (audio/vidéo) ou si vous rajoutez beaucoup de fichiers d'un coup, vous risquez d'être bloqué par la limite d'envoi.
Vous pouvez contourner ce problème en augmentant la limite de git sur votre machine avec la commande:
`$ git config --global http.postBuffer 400000000`
Ce qui vous donnera une taille maximale de 50 Mo par push (1 Mo par défaut)
[(documentation)](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httppostBuffer)
Si vous voyez l'erreur suivante:
`error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413`
Vous pouvez remonter la limite en éditant le fichier /etc/nginx/conf.d/git.domain.tld.d/gitea.conf (sur le serveur)
`client_max_body_size 50M;`
Puis redémarrer nginx avec la commande:
`$ yunohost service restart nginx`
[(documentation)](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size)
#### Autoindex / serveur de fichier basique
Si vous voulez pouvoir vous consulter l'arborescence de votre serveur depuis n'importe quel navigateur, vous pouvez activer l'autoindex en modifiant le fichier /etc/nginx/conf.d/domain.tld.d/webapp_domain.tld_.conf
```
location / {
autoindex on;
alias /path/to/root/ ;
}
```
Attention cependant, tout le monde pourra voir ce que vous avez sur votre serveur. En ce qui concerne les fichiers statiques (CSS, JS, police d'écriture...) utilisés sur les pages publiées, tout le monde peut déjà les voir, d'une manière contournée.
Le seul cas qui me vienne à l'esprit dans lequel cette visibilité pourrait poser problème est si vous avez des mots de passe écrit "en dur" dans un fichier mais c'est une très mauvaise pratique à éviter dans tous les cas.
Sur un domaine j'utilise l'autoindex pour facilement retrouver des fichiers de police (.woff, .ttf) ou quelques librairies javascript.
</main>
<?php include($_SERVER['DOCUMENT_ROOT']."/assets/php/footer.php"); ?>