Post

🟢 Proxmox vm105 Debian 13 + Jekyll Chirpy

🟢 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

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

Installer NodeJs via nvm

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 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

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
[Unit]
Description=Jekyll site for Chirpy (static build)
After=network-online.target sharenfs.mount
Wants=network-online.target sharenfs.mount

[Service]
Type=simple
WorkingDirectory=%h/chirpy
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"
ExecStart=/home/debjek/gems/bin/jekyll serve --incremental --watch --host 0.0.0.0 --port 4000

Restart=always
RestartSec=5

[Install]
WantedBy=default.target

Active et démarre le service (pour le user courant) :

1
2
systemctl --user daemon-reload
systemctl --user enable --now chirpy.service

Vérifie :

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 le site statique, puis synchronisation et redémarrage service Créer un script pour un rebuild complet: /usr/local/bin/rebuild-chirpy.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
#!/usr/bin/env bash
set -euo pipefail

cd "$HOME/chirpy"

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 "Arrêt service chirpy"
systemctl --user stop chirpy.service || true

echo "Attente chirpy.service soit vraiment stoppé"
for _ in {1..30}; do
  systemctl --user is-active --quiet chirpy.service && sleep 1 || break
done

echo "Construction: jekyll build"
jekyll build

echo "rsync -av --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/"
rsync -av --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/

echo "Démarrage service chirpy"
systemctl --user start chirpy.service || true

echo "Fin $0"

Rendre exécutable

1
sudo chmod +x r/usr/local/bin/rebuild-chirpy.sh

Synchro site - systemd path et rsync

Clé SSH pour les sites distants

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

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)

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

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
#!/usr/bin/env bash
# Distant cwwk
rsync -av --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
rsync -av --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
rsync -av --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 nginx - chirpy.rnmkcy.eu

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";
 }

}

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'\'''
Cet article est sous licence CC BY 4.0 par l'auteur.