1
0

install-simple.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # WaouW v2.0 - Installation Simple et Directe
  3. # Corriger les fins de ligne Windows si nécessaire
  4. if [ "$(head -c 1 "$0" | od -c | head -1 | cut -d' ' -f2)" = "\r" ]; then
  5. sed -i 's/\r$//' "$0"
  6. exec "$0" "$@"
  7. fi
  8. echo "=== WaouW v2.0 - Installation Simple ==="
  9. # 1. Installer Docker
  10. echo "Installation de Docker..."
  11. curl -fsSL https://get.docker.com | sh
  12. sudo systemctl enable docker
  13. sudo systemctl start docker
  14. # 2. Créer utilisateur waouw
  15. echo "Configuration utilisateur..."
  16. sudo useradd -m -s /bin/bash waouw 2>/dev/null || true
  17. echo "waouw:waouw" | sudo chpasswd
  18. sudo usermod -aG docker waouw
  19. sudo usermod -aG docker pi # Ajouter pi au groupe docker aussi
  20. # 3. Préparer répertoires
  21. echo "Préparation répertoires..."
  22. sudo mkdir -p /opt/waouw/data/postgres
  23. sudo mkdir -p /opt/waouw/data/redis
  24. sudo mkdir -p /opt/waouw/logs
  25. sudo chown -R waouw:waouw /opt/waouw
  26. # 4. Extraire archive
  27. echo "Extraction archive..."
  28. sudo unzip -q /boot/firmware/waouw-deploy.zip -d /opt/waouw/
  29. # 5. Configuration .env
  30. echo "Configuration .env..."
  31. sudo tee /opt/waouw/.env > /dev/null << 'EOF'
  32. WAOUW_DOMAIN=waouw.local
  33. ACME_EMAIL=ssl-agent@waouw.tech
  34. POSTGRES_PASSWORD=waouw123
  35. DATABASE_URL=postgresql://waouw:waouw123@postgres:5432/waouw
  36. JWT_SECRET_KEY=auto-secret-key-2024
  37. DEVICE_HMAC_SECRET=auto-device-secret-2024
  38. REDIS_URL=redis://redis:6379/0
  39. TZ=Europe/Paris
  40. EOF
  41. sudo chown waouw:waouw /opt/waouw/.env
  42. # 6. Configurer autologin automatique (pour futurs redémarrages)
  43. echo "Configuration autologin automatique..."
  44. sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
  45. sudo tee /etc/systemd/system/getty@tty1.service.d/autologin.conf > /dev/null << 'EOF'
  46. [Service]
  47. ExecStart=
  48. ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
  49. EOF
  50. sudo systemctl daemon-reload
  51. # Nettoyer .bashrc des anciens scripts
  52. echo "Nettoyage configuration automatique..."
  53. sed -i '/waouw-start.sh/d' /home/pi/.bashrc 2>/dev/null || true
  54. # 7. Lancer les services
  55. echo "Démarrage services..."
  56. cd /opt/waouw/DEPLOY
  57. # PostgreSQL
  58. sudo docker compose up -d postgres
  59. sleep 15
  60. # Redis
  61. sudo docker compose up -d redis
  62. sleep 10
  63. # Services principaux
  64. sudo docker compose up -d traefik backend frontend
  65. echo ""
  66. echo "=== INSTALLATION TERMINÉE ==="
  67. echo "🌐 Interface: http://waouw-pi.local"
  68. echo "👤 Login: admin / admin"
  69. echo ""
  70. echo "Services actifs:"
  71. sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"