🟢 Proxmox vm105 Debian 13 + Jekyll Chirpy
Proxmox VM Debian
Site communautaire https://community-scripts.org/
Procédure installation debian13
1
2
sudo -s
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/vm/debian-13-vm.sh)"
A la fin de la création
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
____ __ _ ________
/ __ \___ / /_ (_)___ _____ < /__ /
/ / / / _ \/ __ \/ / __ `/ __ \ / / /_ <
/ /_/ / __/ /_/ / / /_/ / / / / / /___/ /
/_____/\___/_.___/_/\__,_/_/ /_/ /_//____/
(Trixie)
⚙️ Using Default Settings
🆔 Virtual Machine ID: 105
📦 Machine Type: i440fx
💾 Disk Size: 8G
💾 Disk Cache: None
🏠 Hostname: debian
🖥️ CPU Model: KVM64
🧠 CPU Cores: 2
🛠️ RAM Size: 2048
🌉 Bridge: vmbr0
🔗 MAC Address: 02:23:30:A9:80:CD
🏷️ VLAN: Default
⚙️ Interface MTU Size: Default
☁️ Cloud-Init: no
🌐 Start VM when completed: yes
🚀 Creating a Debian 13 VM using the above default settings
✔️ Using local-lvm for Storage Location.
✔️ Virtual Machine ID is 105.
✔️ Installed libguestfs-tools
✔️ https://cloud.debian.org/images/cloud/trixie/latest/debian-13-nocloud-amd64.qcow2
✔️ Downloaded debian-13-nocloud-amd64.qcow2
✔️ Customized image
✔️ Created a Debian 13 VM (debian)
✔️ Started Debian 13 VM
✔️ Completed successfully!
More Info at https://github.com/community-scripts/ProxmoxVE/discussions/836
Proxmox, ouvrir la console de la vm 105
Mise à jour debian
1
apt update && apt upgrade
Créer un utilisateur
1
adduser debjek # mp debjek49
Droits
1
2
# droits root
echo "debjek ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/10-userx
Les outils
1
apt install openssh-server fdisk cloud-guest-utils rsync tmux
Locales
Sur Debian, le fichier
/etc/locale.genpeut ne pas exister si les locales n’ont jamais été générées (ou si le paquet n’est pas installé).
On va donc d’abord vérifier/installer le nécessaire, puis générer.
1
dpkg -l | grep -E '^ii\s+locales\s'
Si rien ne ressort, installer locales
1
2
sudo apt update
sudo apt install -y locales
Après installation, créer/éditer le fichier :
1
sudo nano /etc/locale.gen
Supprimer en début de ligne #
1
fr_FR.UTF-8 UTF-8
Puis génèrer
1
sudo dpkg-reconfigure locales
Choisir la locale par défaut (ex: fr_FR.UTF-8), puis OK.
Vérifier/Définir LANG (optionnel mais souvent utile)
1
cat /etc/default/locale
Si le fichier n’existe pas
1
sudo nano /etc/default/locale
Ajouter
1
LANG=fr_FR.UTF-8
Vérification
1
2
locale
locale -a
On doit voir apparaître fr_FR.utf8
Europe/Paris
Activer le fuseau Europe/Paris
1
sudo timedatectl set-timezone Europe/Paris
Horloge système synchronisée : timedatectl
1
2
3
4
5
6
7
Local time: Sat 2026-07-25 17:21:50 CEST
Universal time: Sat 2026-07-25 15:21:50 UTC
RTC time: Sat 2026-07-25 15:21:50
Time zone: Europe/Paris (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Réseau
Quel réseau est installé
1
systemctl list-unit-files | grep -Ei 'networkmanager|systemd-networkd|ifupdown|networking'
systemd-network est installé
1
2
systemctl is-active systemd-networkd
systemctl status systemd-networkd --no-pager
Configuration statique pour systemd-networkd avec IP 192.168.0.220 et DNS 192.168.0.205
Trouver le nom de l’interface
1
networkctl # ens18
Ton interface ens18 est config via un fichier en runtime : /run/systemd/network/10-netplan-all-en.network (donc ton fichier /etc/systemd/network/20-lan.network n’est pas celui qui s’applique).
Ajouter une config statique dans netplan
1
ls -l /etc/netplan/
Puis édite le fichier YAML, par ex :
1
sudo nano /etc/netplan/*.yaml
Mets (remplace les noms si besoin) :
1
2
3
4
5
6
7
8
9
10
11
12
nnetwork:
version: 2
renderer: networkd
ethernets:
ens18:
dhcp4: no
addresses: [192.168.0.229/24]
nameservers:
addresses: [192.168.0.205]
routes:
- to: default
via: 192.168.0.254
Appliquer
1
2
sudo netplan apply
sudo systemctl restart systemd-networkd
Vérifier
1
2
3
ip addr show ens18
ip route | grep default
resolvectl status ens18
Historique commandes
Ajoutez la recherche d’historique de la ligne de commande au terminal
Se connecter en utilisateur debian
Tapez un début de commande précédent, puis utilisez shift + up (flèche haut) pour rechercher l’historique filtré avec le début de la commande.
1
2
3
# Global, tout utilisateur
echo '"\e[1;2A": history-search-backward' | sudo tee -a /etc/inputrc
echo '"\e[1;2B": history-search-forward' | sudo tee -a /etc/inputrc
Se déconnecter pour prise en compte
SSH + Clés
A-Sur le poste appelant
Générer un jeu de clé
1
ssh-keygen -t ed25519 -o -a 100 -f ~/.ssh/vm-105
Envoyer la clé publique sur le container lxc
1
ssh-copy-id -i ~/.ssh/vm-105.pub debjek@192.168.0.229
B-Sur le distant
1
2
echo 'Port = 55229
PasswordAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-user.conf
C-Sur le poste appelant
Lancer la connexion SSH avec clé
1
ssh -p 55229 -i ~/.ssh/vm-105 debjek@192.168.0.229
Motd
1
rm -f /etc/motd && nano /etc/motd
Contenu motd
1
2
3
4
5
6
7
8
9
10
11
12
13
___ _ __ ___
| _ \ _ _ ___ __ __ _ __ ___ __ __ __ __ _ __ / | / \ | __|
| _/| '_|/ _ \\ \ /| ' \ / _ \\ \ / \ V /| ' \ | || () ||__ \
|_| |_| \___//_\_\|_|_|_|\___//_\_\ \_/ |_|_|_||_| \__/ |___/
_ _ _ _ _ _ _
(_) ___ | |__ _ _ | || | ___| |_ __ _ | |_ (_) __
| |/ -_)| / /| || || || | (_-<| _|/ _` || _|| |/ _|
_/ |\___||_\_\ \_, ||_||_| /__/ \__|\__,_| \__||_|\__|
|__/ |__/
_ ___ ___ _ __ ___ __ ___ ___ ___
/ |/ _ \|_ ) / | / / ( _ ) / \ |_ )|_ )/ _ \
| |\_, / / / _ | |/ _ \/ _ \ _| () |_ / / / / \_, /
|_| /_/ /___|(_)|_|\___/\___/(_)\__/(_)/___|/___| /_/
NFS
Installer client NFS
1
sudo apt install nfs-common # debian
Créer le dossier
1
2
sudo mkdir -p /sharenfs
sudo chown $USER:$USER /sharenfs
Modifier le fichier /etc/fstab
1
192.168.0.205:/sharenfs /sharenfs nfs nofail,x-systemd.automount,x-systemd.device-timeout=10s 0 0
Recharger
1
2
sudo systemctl daemon-reload
sudo mount -a
node
1
2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.bashrc
Installer node LTS
1
nvm install --lts
Versions installée node -v && npm -v
1
2
v24.18.0
11.16.0
🧪 Jekyll
Installation jekyll sur debian
1
2
3
4
5
6
sudo apt install ruby-full build-essential zlib1g-dev -y
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler
jekyll-theme-chirpy
Générateur site statique (ruby+jekyll) Installer git et imagemagick
1
sudo apt install git imagemagick
Sur le home
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cd ~
git clone https://github.com/cotes2020/jekyll-theme-chirpy.git chirpy
# initialiser le dépôt
cd ~/chirpy
bash tools/init.sh
#
cd assets/img/favicons/
magick web-app-manifest-512x512.png -resize 16x16 favicon-16x16.png
magick web-app-manifest-512x512.png -resize 32x32 favicon-32x32.png
magick web-app-manifest-512x512.png -resize 150x150 mstile-150x150.png
magick web-app-manifest-512x512.png -resize 192x192 android-chrome-512x512.png
cp web-app-manifest-512x512.png android-chrome-512x512.png
# A partir d'un fichier svg
# mv -f xxxxxx.svg favicon.svg
# svg choisi est renommé favicon.svg
magick input.jpg -resize WIDTHxHEIGHT output.jpg
#
magick favicon.svg -resize 512x512 android-chrome-512x512.png
magick favicon.svg -resize 512x512 web-app-manifest-512x512.png
magick favicon.svg -resize 16x16 favicon-16x16.png
magick favicon.svg -resize 32x32 favicon-32x32.png
magick favicon.svg -resize 150x150 mstile-150x150.png
magick favicon.svg -resize 180x180 apple-touch-icon.png
magick favicon.svg -resize 192x192 android-chrome-512x512.png
magick favicon.svg favicon.ico
magick favicon.svg -resize 192x192 android-chrome-192x192.png
magick favicon.svg -resize 96x96 favicon-96x96.png
Retour racine
1
cd ~/chirpy
Modifier les sources
- Commenter
_includes/post-sharing.html - Modifier
"content":dans le fichierassets/js/data/search.jsonpour limiter la taille finale dusearch.json
Modifier configuration _config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# The Site Configuration
# Import the theme
theme: jekyll-theme-chirpy
# The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
# If it has the same name as one of the files in folder `_data/locales`, the layout language wi>
# otherwise, the layout language will use the default value of 'en'.
lang: fr-FR
# Change to your timezone › https://zones.arilyn.cc
timezone: Europe/Paris
# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# ↓ --------------------------
title: Chirpy DEV # the main title
social:
# Change to your full name.
# It will be displayed as the default author of the posts and the copyright owner in the Foot>
name: jek
email: jek@cinay.eu # change to your email address
theme_mode: dark # [light | dark]
Si Gemfile.lock existe, le supprimer et lancer
1
bundle
Info jekyll:
1
bundle info jekyll
1
2
3
4
5
6
7
8
9
10
11
12
13
* jekyll (4.4.1)
Summary: A simple, blog aware, static site generator.
Homepage: https://jekyllrb.com
Source Code: https://github.com/jekyll/jekyll
Changelog: https://github.com/jekyll/jekyll/releases
Bug Tracker: https://github.com/jekyll/jekyll/issues
Path: /home/debjek/gems/gems/jekyll-4.4.1
Reverse Dependencies:
jekyll-archives (2.3.0) depends on jekyll (>= 3.6, < 5.0)
jekyll-include-cache (0.2.1) depends on jekyll (>= 3.7, < 5.0)
jekyll-seo-tag (2.9.0) depends on jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0) depends on jekyll (>= 3.7, < 5.0)
jekyll-theme-chirpy (7.6.0) depends on jekyll (~> 4.3)
Jekyll build
Jekyll est installé sur la machine vm105 (192.168.0.229)
Les dossiers concernés par jekyll sont sur le serveur debian cwwk (192.168.0.205)
1
2
3
4
/sharenfs/media/statique/
├── files
├── images
└── _posts
Le serveur cwwk a accès à la machine vm105 (ssh debjek@192.168.0.229 -p 55229 -i /home/yick/.ssh/vm-105)
Créer un systemd.path qui surveille toute création,modification ou effacement de fichier sur les dossiers /sharenfs/media/statique/{files,images,_posts} Le service associé effectue une synchronistation via rsync des dossiers /sharenfs/media/statique/{files,images,_posts} vers /home/debjek/chirpy/{files,images,_posts}
Création des dossiers files, images et _posts pour le générateur de site
1
mkdir -p $HOME/chirpy/{files,images,_posts}
Synchronisation des dossiers avec le partage NFS /sharenfs: rsync_path.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
rsync -av --delete \
/sharenfs/media/statique/_posts/ \
/home/debjek/chirpy/_posts/
rsync -av \
/sharenfs/media/statique/files/ \
/home/debjek/chirpy/files/
rsync -av \
/sharenfs/media/statique/images/ \
/home/debjek/chirpy/images/
Exécution
1
2
chmod +x rsync_path.sh
./rsync_path.sh
Générer _site (défaut)
Par défaut jekyll build génère le dossier _site
A-Option build
Construction du dossier _site
1
2
cd ~/chirpy
jekyll build
B-Option serveur
1
2
cd ~/chirpy
jekyll serve
C-Option build sur /sharenfs
1
jekyll build --destination /sharenfs/rnmkcy/chirpy
On utilise pour cela la commande bundle pour que la version de jekyll utilisée ainsi que celle des dépendances soient bien celles décrites dans les fichiers Gemfile et Gemfile.lock et ne dépendent pas de l’environnement de la machine.
Le serveur est lancé
1
2
3
4
5
6
7
8
9
10
Configuration file: /home/jek/jekyll-theme-chirpy/_config.yml
Theme Config file: /home/jek/jekyll-theme-chirpy/_config.yml
Source: /home/jek/jekyll-theme-chirpy
Destination: /home/jek/jekyll-theme-chirpy/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 59.712 seconds.
Auto-regeneration: enabled for '/home/jek/jekyll-theme-chirpy'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
Accès redirection
Depuis un terminal du desktop PC ou Laptop
Accès à la page par une redirection, lancer la commande depuis un terminal du réseau
1
2
# avec fichier clé
ssh -L 9500:localhost:4000 debjek@192.168.0.229 -p 55229 -i /home/yann/.ssh/vm-105
Navigateur local: http://localhost:9500
Service Chirpy
Le service
chirpyavec la commandejekyll serve --incremental --watchqui lance un serveur local sur leport 4000avec Jekyll, en mode incrémental (reconstruit uniquement les fichiers modifiés) et avec un watcher pour détecter les changements de fichiers.
Créer le dossier systemd utilisateur
1
mkdir -p ~/.config/systemd/user
Création fichier ~/.config/systemd/user/chirpy.service :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[Unit]
Description=Jekyll site for Chirpy (static build)
After=network-online.target sharenfs.mount
Wants=network-online.target sharenfs.mount
[Service]
Type=simple
# Répertoire du site
WorkingDirectory=%h/chirpy
# Environnement Ruby / gems
Environment="PATH=/home/debjek/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="GEM_HOME=/home/debjek/gems"
Environment="GEM_PATH=/home/debjek/gems"
# Lancement de Jekyll
ExecStart=/home/debjek/gems/bin/jekyll serve --incremental --watch --host 0.0.0.0 --port 4000
# Demande à systemd d'envoyer SIGINT (comme Ctrl-C)
KillSignal=SIGINT
# Si jamais Jekyll sort avec un code non‑zéro sur SIGINT,
# on considère quand même que c'est un succès (adapter si besoin).
SuccessExitStatus=0 1 130
# Politique de redémarrage
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
Commentaires :
KillSignal=SIGINTfait quesystemctl --user stop chirpy.serviceenverra SIGINT plutôt que SIGTERM, ce qui est souvent mieux géré par les applis type serveur.SuccessExitStatus=0 1 130dit à systemd : “codes 0, 1, 130 ne sont pas des échecs”, ce qui couvre les cas courants (0 = ok, 130 = Ctrl‑C, 1 = exit aprèsSignalException).
Après modification :
1
2
3
systemctl --user daemon-reload
systemctl --user enable chirpy.service
systemctl --user restart chirpy.service
Vérifier :
1
2
systemctl --user status chirpy.service
journalctl --user -u chirpy.service -f
Activer le démarrage des services systemd user même après fermeture de session, pour l’utilisateur $USER.
1
sudo loginctl enable-linger $USER
Rebuild chirpy
Script qui recrée entièrement le site statique
jekyll build, puis synchronise_siteavec les sites distants puis redémarre le servicechirpy
Créer un script pour un rebuild complet: /usr/local/bin/rebuild-chirpy.sh
- arrêt propre du service (en réutilisant ta boucle d’attente)
jekyll buildvia le binaire du GEM (comme dans ton service)- un peu de robustesse sur
rsync.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -euo pipefail
SERVICE_NAME="chirpy.service"
PATH_NAME="chirpy-rsync.path"
SITE_DIR="$HOME/chirpy"
JEKYLL_BIN="/home/debjek/gems/bin/jekyll"
RSYNC_SRC="/home/debjek/chirpy/_site/"
RSYNC_DEST="yick@192.168.0.205:/sharenfs/rnmkcy/chirpy/"
SSH_OPTS="-p 55205 -i /home/debjek/.ssh/cwwk-ed25519 -o StrictHostKeyChecking=accept-new"
echo "[$(date '+%F %T')] Passage dans $SITE_DIR"
cd "$SITE_DIR"
export PATH="/home/debjek/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export GEM_HOME="/home/debjek/gems"
export GEM_PATH="/home/debjek/gems"
echo "[$(date '+%F %T')] Arrêt path utilisateur $PATH_NAME"
systemctl --user stop "$PATH_NAME" || true
echo "[$(date '+%F %T')] Arrêt service utilisateur $SERVICE_NAME"
systemctl --user stop "$SERVICE_NAME" || true
echo "[$(date '+%F %T')] Attente que $SERVICE_NAME soit vraiment stoppé"
for _ in {1..30}; do
if systemctl --user is-active --quiet "$SERVICE_NAME"; then
sleep 1
else
break
fi
done
echo "[$(date '+%F %T')] Supprimer dossier _site"
sudo rm -r /home/debjek/chirpy/_site
echo "[$(date '+%F %T')] Construction: jekyll build"
"$JEKYLL_BIN" build
echo "[$(date '+%F %T')] Démarrage path utilisateur $PATH_NAME"
systemctl --user start "$PATH_NAME" || true
echo "[$(date '+%F %T')] Démarrage service utilisateur $SERVICE_NAME"
systemctl --user start "$SERVICE_NAME" || true
echo "[$(date '+%F %T')] Fin $0"
exit 0
echo "[$(date '+%F %T')] rsync vers $RSYNC_DEST"
echo "rsync -a --delete -e \"ssh $SSH_OPTS\" \"$RSYNC_SRC\" \"$RSYNC_DEST\""
rsync -a --delete -e "ssh $SSH_OPTS" "$RSYNC_SRC" "$RSYNC_DEST"
Points importants
- J’utilise
"$JEKYLL_BIN" buildpour être sûr d’utiliser le même Jekyll que celui du service systemd (binaire dans le GEM_HOME). - La commande
rsyncest inchangée dans son comportement, juste légèrement factorisée dans des variables pour faciliter les futurs changements. - Les timestamps dans les
echoaident à voir où ça passe du temps si un jour le build ou le rsync devient long.
Rendre exécutable
1
2
sudo chmod +x /usr/local/bin/rebuild-chirpy.sh
rebuild-chirpy.sh
Synchro site - systemd path et rsync
Le but est de synchroniser le dossier local
~/chirpy/_site/avec le(s) serveur(s) web distant(s)
A chaque création, modification ou suppression d’un POST mardown le sous-dossier_site/est reconstruit (jekyll build)
Avec les unités de chemin, vous pouvez surveiller les fichiers et les répertoires pour certains événements. Si un événement spécifique se produit, une unité de service est exécutée, et elle porte généralement le même nom que l’unité de chemin
Nous allons surveiller dans le dossier local$HOME/chirpy/_site/toute modification du fichier sitemap.xml qui entrainera l’exécution d’un script
Clés SSH pour les sites distants
A-Infomaniak
- Utilisateur: yiak
- IP: 83.228.219.134
- Port: 55134
Générer un jeu de clé pour le poste distant infomaniak
1
ssh-keygen -t ed25519 -o -a 100 -f ~/.ssh/infomaniak
Ajouter le contenu de la clé publique infomaniak.pub au fichier ~/.ssh/authorized_keys du distant infomaniak
1
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhMRZfsByGlIAFiP9PkzqMPgzsK0yH+RdUjNEV6qtkS debjek@debian
Tester la connexion ssh
1
ssh yiak@83.228.219.134 -p 55134 -i .ssh/infomaniak
B-Refaire les mêmes opérations pour les autres sites distants
Générer un jeu de clé pour le poste distant contabo
1
ssh-keygen -t ed25519 -o -a 100 -f ~/.ssh/contabo
Ajouter le contenu de la clé publique contabo.pub au fichier ~/.ssh/authorized_keys du distant contabo
1
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICWCMgQIyXNeVIMYLMzmUPzNaMJRwbEU4Jin/BZ5HURZ debjek@debian
Tester la connexion ssh
1
ssh yair@144.91.89.149 -p 55149 -i .ssh/contabo
Systemd Path chirpy-rsync (user)
Dans le répertoire systemd utilisateur créer une unité de cheminement ~/.config/systemd/user/chirpy-rsync.path
1
2
3
4
5
6
7
8
9
[Unit]
Description=Surveiller sitemap.xml pour les changements
[Path]
PathChanged=/home/debjek/chirpy/_site/sitemap.xml
Unit=chirpy-rsync.service
[Install]
WantedBy=default.target
Dans la section [Path], PathChanged= indique le chemin absolu du fichier à surveiller, tandis que Unit= indique l’unité de service à exécuter si le fichier change. Cette unité (chirpy-rsync.path) doit être lancée lorsque le système est en mode multi-utilisateur.
Service systemd chirpy-rsync (user)
Créer l’unité de service correspondante, chirpy-rsync.service, dans le répertoire ~/.config/systemd/user/
Si le fichier sitemap.xml change (c’est-à-dire qu’il est à la fois écrit et fermé), l’unité de service suivante sera appelée pour exécuter le script spécifié :
Créer ~/.config/systemd/user/chirpy-rsync.service :
1
2
3
4
5
6
[Unit]
Description=Sync Jekyll _site to remote servers with rsync
[Service]
Type=oneshot
ExecStart=/usr/local/bin/chirpy-rsync-sync.sh
Script synchro chirpy-rsync-sync.sh
Créer /usr/local/bin/chirpy-rsync-sync.sh (via sudo)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
# Distant cwwk
echo 'rsync /home/debjek/chirpy/_site/ yick@192.168.0.205:/sharenfs/rnmkcy/chirpy/'
rsync -a --delete -e "ssh -p 55205 -i /home/debjek/.ssh/cwwk-ed25519 -o StrictHostKeyChecking=accept-new" /home/debjek/chirpy/_site/ yick@192.168.0.205:/sharenfs/rnmkcy/chirpy/
# Distant Infomaniak
#ssh yiak@83.228.219.134 -p 55134 -i .ssh/infomaniak
echo 'rsync /home/debjek/chirpy/_site/ yiak@83.228.219.134:/srv/media/chirpy/'
rsync -a --delete -e "ssh -p 55134 -i /home/debjek/.ssh/infomaniak -o StrictHostKeyChecking=accept-new" /home/debjek/chirpy/_site/ yiak@83.228.219.134:/srv/media/chirpy/
# Distant contabo
#ssh yair@144.91.89.149 -p 55149 -i .ssh/contabo
echo 'rsync /home/debjek/chirpy/_site/ yair@144.91.89.149:/srv/media/chirpy/'
rsync -a --delete -e "ssh -p 55149 -i /home/debjek/.ssh/contabo -o StrictHostKeyChecking=accept-new" /home/debjek/chirpy/_site/ yair@144.91.89.149:/srv/media/chirpy/
Puis :
1
sudo chmod +x /usr/local/bin/chirpy-rsync-sync.sh
Activation et démarrage
Activer/démarrer :
1
2
systemctl --user daemon-reload
systemctl --user enable --now chirpy-rsync.path
Vérifier
1
2
systemctl --user status chirpy-rsync.path
journalctl --user -u chirpy-rsync.service -f
CWWK Surveillance dossier /sharenfs/media/statique/
On surveille les dossiers /sharenfs/media/statique/_posts/, /sharenfs/media/statique/images/ et /sharenfs/media/statique/files/
- le serveur NFS cwwk (192.168.0.205),
- la machine vm105 (192.168.0.229) où Jekyll tourne.
Sur le serveur NFS (cwwk)
Script de push via SSH + rsync
Crée /usr/local/bin/chirpy-push.sh avec la clé vm-105 :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
export RSYNC_RSH="ssh -i /home/yick/.ssh/vm-105 -p 55229"
# Posts
/usr/bin/rsync -av --delete \
/sharenfs/media/statique/_posts/ \
debjek@192.168.0.229:/home/debjek/chirpy/_posts/
# Files
/usr/bin/rsync -av \
/sharenfs/media/statique/files/ \
debjek@192.168.0.229:/home/debjek/chirpy/files/
# Images
/usr/bin/rsync -av \
/sharenfs/media/statique/images/ \
debjek@192.168.0.229:/home/debjek/chirpy/images/
Rendre exécutable :
1
sudo chmod +x /usr/local/bin/chirpy-push.sh
Service systemd de push
Crée /etc/systemd/system/chirpy-push.service :
1
2
3
4
5
6
7
8
9
10
11
[Unit]
Description=Push _posts, files, images sur vm105
[Service]
Type=oneshot
ExecStart=/usr/local/bin/chirpy-push.sh
User=yick
Group=yick
[Install]
WantedBy=multi-user.target
Path systemd qui surveille les changements
Crée /etc/systemd/system/chirpy-push.path :
1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description=Surveiller les changements sur /sharenfs/media/statique pour vm105
[Path]
PathChanged=/sharenfs/media/statique/_posts
PathChanged=/sharenfs/media/statique/files
PathChanged=/sharenfs/media/statique/images
Unit=chirpy-push.service
MakeLink=true
[Install]
WantedBy=multi-user.target
Note : systemd ne supporte pas PathDeleted ; on utilise PathChanged sur le dossier, ce qui doit capter les effacements, mais si ça ne suffit pas, on peut passer à un timer périodique (voir partie 3).
Activation et démarrage
Sur le serveur cwwk :
1
2
3
sudo systemctl daemon-reload
sudo systemctl enable --now chirpy-push.service
sudo systemctl enable --now chirpy-push.path
Vérifier :
1
2
3
sudo systemctl start chirpy-push.service
sudo systemctl status chirpy-push.service
journalctl -u chirpy-push.service -u chirpy-push.path
Exemple de suivi:
1
sudo journalctl -u chirpy-push.service -f
1
2
3
4
5
6
7
8
9
juil. 03 21:20:47 alder chirpy-push.sh[3594782]: total size is 11.797.221 speedup is 705,66
juil. 03 21:20:48 alder chirpy-push.sh[3594784]: sending incremental file list
juil. 03 21:20:48 alder chirpy-push.sh[3594784]: sent 5.820 bytes received 14 bytes 3.889,33 bytes/sec
juil. 03 21:20:48 alder chirpy-push.sh[3594784]: total size is 657.320.100 speedup is 112.670,57
juil. 03 21:20:48 alder chirpy-push.sh[3594786]: sending incremental file list
juil. 03 21:20:48 alder chirpy-push.sh[3594786]: sent 233.701 bytes received 12 bytes 467.426,00 bytes/sec
juil. 03 21:20:48 alder chirpy-push.sh[3594786]: total size is 649.409.160 speedup is 2.778,66
juil. 03 21:20:48 alder systemd[1]: chirpy-push.service: Deactivated successfully.
juil. 03 21:20:48 alder systemd[1]: Finished chirpy-push.service - Push _posts, files, images sur vm105.
PC1 Linux Desktop
Créer un desktop
Argument ligne de commande: -rv -geometry 120x20+10+20 -T build_chirpy_site -e /home/yann/scripts/build_chirpy_site.sh
$HOME/.local/share/applications/Build\ Chirpy.desktop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Desktop Entry]
Comment=build_chirpy_site.sh
Exec=xterm -rv -geometry 200x20 -T build_chirpy_site -e /home/yann/scripts/build_chirpy_site.sh
Icon=project_rebuild-symbolic
Name=Build Chirpy
NoDisplay=false
Path=
PrefersNonDefaultGPU=false
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
Script build_chirpy_site.sh
Le script /home/yann/scripts/build_chirpy_site.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# COLUMNSxROWS+X+Y -> xterm -geometry 400x200+100+350
# xterm -rv -geometry 150x40+100+150 -T suivi_chirpy_site -e '/home/yann/scripts/suivi_chirpy_site.sh'
# On supprime la session "build_chirpy_site" si existante
if [[ `tmux list-sessions | grep 'build_chirpy_site' | wc -l` != 0 ]]
then
# On ferme la session active
tmux kill-session -t build_chirpy_site
fi
# Créer une bannière dans /etc/motd sur chaque serveur
# Nom du domaine en ascii voir lien http://patorjk.com/software/taag/#p=display&h=1&f=Small
echo "fin fi"
# Créer session + terminal
tmux new -d -s build_chirpy_site -n lxcTerm
# Séparation horizontale en 2 du terminal
tmux split-window -v -p 33
# | 0 |
# | |
# |-----------|
# | 1 |
# | |
# Sélection terminal HAUT
tmux selectp -t 0
tmux split-window -v -p 50
# | 0 |
# | |
# |-----------|
# | 1 |
# | |
# |-----------|
# | 2 |
# | |
tmux selectp -t 0
#
tmux send-keys -t build_chirpy_site "/home/yann/scripts/ssh-manager.sh vm105 exe 'journalctl --user -u chirpy -f'" C-m
#tmux send-keys -t build_chirpy_site "journalctl --user -f -u hugo_chirpy_site.service" C-m
# Sélection terminal BAS
tmux selectp -t 1
#
tmux send-keys -t build_chirpy_site "/home/yann/scripts/ssh-manager.sh cwwk exe 'sudo journalctl -u chirpy-push.service -f'" C-m
tmux selectp -t 2
#
tmux send-keys -t build_chirpy_site "/home/yann/scripts/ssh-manager.sh vm105 exe 'journalctl --user -u chirpy-rsync.service -f'" C-m
# "/home/yann/scripts/ssh-manager.sh vm105 exe 'journalctl --user -u chirpy-rsync.service -f'"
# Afficher la session
tmux a -t build_chirpy_site
#
# Tuer la session
# tmux kill-session -t build_chirpy_site
KDE - Configurer les paramètres spécifiques de la fenêtre
Alias chirpy
Pour reconstruire,alias chirpy
1
alias chirpy='/home/yann/scripts/ssh-manager.sh vm105 exe '\''/usr/local/bin/rebuild-chirpy.sh'\'''
CWWK nginx - chirpy.rnmkcy.eu
A-Static nginx (ACTIF)
Fichier de configuration /etc/nginx/conf.d/chirpy.rnmkcy.eu.conf sur le serveur cwwk debian 13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name chirpy.rnmkcy.eu;
include /etc/nginx/conf.d/ssl-modern.inc;
root /sharenfs/rnmkcy/chirpy;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(css|js|mjs|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|map)$ {
expires 30d;
add_header Cache-Control "public, immutable";
access_log off;
}
location ~ /\. {
deny all;
}
}
B-Proxy nginx
Fichier de configuration /etc/nginx/conf.d/chirpy.rnmkcy.eu.conf sur le serveur cwwk debian 13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name chirpy.rnmkcy.eu;
include /etc/nginx/conf.d/ssl-modern.inc;
# Headers de sécurité au niveau server
include /etc/nginx/snippets/security-headers.conf;
location / {
proxy_pass http://192.168.0.229:4000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}



