Files
photoBooth/docs/BACKUP-RESTORE.md
T
admin 9a006f1457
🚀 Deploy — JH Photomaton / 🔍 Vérification (push) Has been cancelled
🚀 Deploy — JH Photomaton / 🍓 Deploy sur le Pi (push) Has been cancelled
all
2026-07-17 00:44:22 +02:00

4.6 KiB

Sauvegarde & Restauration — JH Photomaton

Sauvegarder

sudo bash /home/pi/jh-photomaton/scripts/backup-configs.sh
# → crée des archives dans ~/photomaton-backups/

Pour sauvegarder vers une clé USB :

sudo bash /home/pi/jh-photomaton/scripts/backup-configs.sh /media/pi/USB

Restauration RaspAP

# Réinstaller RaspAP sur un Pi frais
curl -sL https://install.raspap.com | bash

# Puis restaurer la config :
sudo tar -xzf raspap-YYYYMMDD-HHMMSS.tar.gz -C /
sudo systemctl restart hostapd dnsmasq dhcpcd lighttpd

Fichiers critiques restaurés :

  • /etc/hostapd/hostapd.conf — SSID, mot de passe WiFi, canal
  • /etc/dnsmasq.conf + /etc/dnsmasq.d/ — DHCP & DNS
  • /etc/dhcpcd.conf — IP statique 10.3.141.1 sur wlan0

Vérification :

sudo systemctl status hostapd dnsmasq
# Le réseau "Photomaton" doit apparaître dans les WiFi disponibles

Restauration Zoraxy

# Télécharger le binaire (même version qu'avant)
mkdir ~/zoraxy && cd ~/zoraxy
wget https://github.com/tobychui/zoraxy/releases/download/v3.3.2/zoraxy_linux_arm64 -O zoraxy
chmod +x zoraxy

# Restaurer la config (rules, settings)
tar -xzf zoraxy-YYYYMMDD-HHMMSS.tar.gz -C ~/zoraxy/

# Restaurer les certificats Let's Encrypt
sudo tar -xzf letsencrypt-YYYYMMDD-HHMMSS.tar.gz -C /

# Réinstaller le service systemd
sudo cp ~/jh-photomaton/systemd/zoraxy.service /etc/systemd/system/
# ou recréer le fichier (voir chapitre 6 du guide d'installation)
sudo systemctl daemon-reload
sudo systemctl enable zoraxy
sudo systemctl start zoraxy

Vérification :

sudo systemctl status zoraxy
curl -sk https://photomaton.lessapinsduweb.com/ | head -3

Note sur les certificats : Let's Encrypt expire tous les 90 jours. Pour renouveler (Pi connecté à internet via Ethernet) :

sudo certbot renew
# Puis ré-importer dans Zoraxy → TLS/SSL → Import Certificate

Restauration CUPS (Imprimantes)

Option A — Restaurer depuis l'archive (Pi de remplacement)

# Installer CUPS
sudo apt install -y cups printer-driver-gutenprint
sudo systemctl start cups

# Restaurer la config
sudo tar -xzf cups-YYYYMMDD-HHMMSS.tar.gz -C /
sudo systemctl restart cups

# Vérifier
lpstat -p
# Selphy_Blanche_WiFi et Selphy_Noire_WiFi doivent apparaître

Option B — Réajouter les imprimantes manuellement (plus fiable après un crash)

# Brancher les Canon Selphy en USB, puis :
sudo usermod -aG lpadmin pi
http://localhost:631  # Interface web CUPS → Administration → Add Printer
# Nom: Selphy_Blanche_WiFi  (EXACTEMENT ce nom — utilisé par le script d'impression)
# Driver: Canon SELPHY CP1300 - Gutenprint

Vérification après restauration :

# Test d'impression (adapter le chemin)
/home/pi/photobooth-data/script/script_print.sh \
  "/home/pi/photobooth-data/media/processed_full/test.jpg" \
  "image" "test" "1"
# Doit retourner : PRINTED:Selphy_Blanche_WiFi:1

Restauration JH Photomaton

cd /home/pi
git clone https://gitea.lespatas.ovh/admin/photoBooth.git jh-photomaton
cd jh-photomaton

# Restaurer la config locale (settings.yaml + base SQLite)
tar -xzf jh-photomaton-YYYYMMDD-HHMMSS.tar.gz -C /home/pi/jh-photomaton/

# Restaurer la config photobooth-app
tar -xzf photobooth-app-config-YYYYMMDD-HHMMSS.tar.gz -C /

# Installer
sudo bash scripts/install.sh

# Démarrer
sudo systemctl start jh-photomaton
sudo systemctl status jh-photomaton

Sauvegarde automatique (planifiée)

Pour sauvegarder chaque semaine automatiquement :

# Ajouter dans crontab root
sudo crontab -e

# Sauvegarde chaque dimanche à 3h du matin
0 3 * * 0 bash /home/pi/jh-photomaton/scripts/backup-configs.sh /home/pi/photomaton-backups >> /home/pi/photomaton-backups/backup.log 2>&1

# Nettoyer les backups de plus de 30 jours
0 4 * * 0 find /home/pi/photomaton-backups -name "*.tar.gz" -mtime +30 -delete

Ou via JH Photomaton (depuis le panel admin → Réglages, à implémenter) :

# Déclencher une sauvegarde manuelle depuis le dashboard
curl -X POST http://localhost:8090/api/system/backup

Sauvegarde de la carte SD entière

La méthode la plus sûre avant un event :

# Sur le PC (Linux/macOS) avec la carte SD insérée
# Identifier la carte : lsblk ou diskutil list (macOS)
sudo dd if=/dev/sdX bs=4M status=progress | gzip > photomaton-$(date +%Y%m%d).img.gz

# Restaurer
zcat photomaton-YYYYMMDD.img.gz | sudo dd of=/dev/sdX bs=4M status=progress

Remplacer /dev/sdX par le device de la carte SD (ex: /dev/sdb ou /dev/disk2). Une image complète 32 Go compressée fait ~4-8 Go selon l'occupation.