first commit
🚀 Deploy — JH Photomaton / 🔍 Vérification (push) Has been cancelled
🚀 Deploy — JH Photomaton / 🍓 Deploy sur le Pi (push) Has been cancelled

This commit is contained in:
2026-07-16 00:55:29 +02:00
commit 209f81aa3d
100 changed files with 17682 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
# =============================================================================
# JH Photomaton — Script d'installation
# Raspberry Pi 4 / Raspberry Pi OS (Debian Trixie)
# =============================================================================
set -euo pipefail
INSTALL_DIR="/home/pi/jh-photomaton"
SERVICE_USER="root" # rpi_ws281x nécessite /dev/mem (root)
VENV_DIR="$INSTALL_DIR/.venv"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " JH Photomaton — Installation"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# ── Vérifications ─────────────────────────────────────────────────────────────
if [[ $EUID -ne 0 ]]; then
echo "❌ Ce script doit être exécuté en root : sudo bash install.sh"
exit 1
fi
# ── Dépendances système ───────────────────────────────────────────────────────
echo ""
echo "▶ Installation des dépendances système..."
apt-get update -qq
apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv python3-dev \
python3-gpiozero python3-pigpio \
imagemagick \
cups cups-client \
git curl
# ── rpi_ws281x : dépendances build ───────────────────────────────────────────
echo ""
echo "▶ Installation de rpi_ws281x (LEDs WS2812)..."
apt-get install -y --no-install-recommends \
gcc make build-essential \
scons swig
# ── Désactiver audio si conflit GPIO18 ───────────────────────────────────────
# WS2812 sur GPIO18 (PWM) entre en conflit avec le son
if ! grep -q "dtparam=audio=off" /boot/firmware/config.txt 2>/dev/null; then
echo "dtparam=audio=off" >> /boot/firmware/config.txt
echo "️ Audio désactivé dans /boot/firmware/config.txt (conflit GPIO18)"
fi
# ── Copie des fichiers ────────────────────────────────────────────────────────
echo ""
echo "▶ Copie des fichiers vers $INSTALL_DIR..."
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
mkdir -p "$INSTALL_DIR"
rsync -a --exclude='.venv' --exclude='__pycache__' --exclude='*.pyc' \
--exclude='data/*.db' \
"$PROJECT_DIR/" "$INSTALL_DIR/"
mkdir -p "$INSTALL_DIR/data"
# ── Environnement virtuel Python ──────────────────────────────────────────────
echo ""
echo "▶ Création de l'environnement virtuel Python..."
python3 -m venv "$VENV_DIR" --system-site-packages
"$VENV_DIR/bin/pip" install --upgrade pip -q
"$VENV_DIR/bin/pip" install -r "$INSTALL_DIR/requirements.txt" -q
# rpi_ws281x (nécessite les headers, installé depuis PyPI)
"$VENV_DIR/bin/pip" install rpi-ws281x -q || echo "⚠️ rpi_ws281x non installé (mode mock actif)"
echo ""
echo "▶ Dépendances Python installées."
# ── Permissions /dev/mem pour rpi_ws281x ─────────────────────────────────────
# Option : ajouter une règle udev pour éviter de tourner en root
# Ici on tourne en root via systemd pour simplifier
# ── Service systemd ───────────────────────────────────────────────────────────
echo ""
echo "▶ Installation du service systemd..."
cp "$INSTALL_DIR/systemd/jh-photomaton.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable jh-photomaton.service
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " ✅ Installation terminée !"
echo ""
echo " Fichiers : $INSTALL_DIR"
echo " Config : $INSTALL_DIR/config/settings.yaml"
echo ""
echo " ▶ Démarrer le service :"
echo " sudo systemctl start jh-photomaton"
echo ""
echo " ▶ Voir les logs :"
echo " sudo journalctl -u jh-photomaton -f"
echo ""
echo " ▶ Interface admin :"
echo " http://<ip-du-pi>:8090/admin"
echo " Mot de passe : PhotoBooth2026!"
echo ""
echo " ⚠️ Penser à mettre à jour plugin_commander.json"
echo " dans photobooth-app pour pointer vers notre webhook !"
echo " Voir : config/plugin_commander_jh.json"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"