Add WOL auto-start scripts and documentation

- check-services.sh: Verify all services after WOL
- start-all-services.sh: Start all containers after boot
- WOL-ET-DEMARRAGE-AUTO.md: Complete guide for auto-start
- Ensure ComfyUI starts automatically with Docker
This commit is contained in:
Folzo
2026-04-06 08:08:58 +02:00
parent dee796f63a
commit a22afa2258
22 changed files with 661 additions and 0 deletions
Submodule comfyui/custom_nodes/ComfyUI-Advanced-ControlNet added at b03791e456
Submodule comfyui/custom_nodes/ComfyUI-AnimateDiff-Evolved added at d8d163cd90
Submodule comfyui/custom_nodes/ComfyUI-Custom-Scripts added at 609f3afaa7
Submodule comfyui/custom_nodes/ComfyUI-GGUF added at 6ea2651e7d
Submodule comfyui/custom_nodes/ComfyUI-Impact-Pack added at 6a517ebe06
Submodule comfyui/custom_nodes/ComfyUI-Impact-Subpack added at 50c7b71a6a
Submodule comfyui/custom_nodes/ComfyUI-Inspire-Pack added at d23db9aa54
Submodule comfyui/custom_nodes/ComfyUI-Manager added at 3615af1560
Submodule comfyui/custom_nodes/ComfyUI-VideoHelperSuite added at 449839959f
Submodule comfyui/custom_nodes/ComfyUI_FaceAnalysis added at 8846653446
Submodule comfyui/custom_nodes/ComfyUI_IPAdapter_plus added at a0f451a511
Submodule comfyui/custom_nodes/ComfyUI_InstantID added at 72495e806b
Submodule comfyui/custom_nodes/ComfyUI_essentials added at 9d9f4bedfc
Submodule comfyui/custom_nodes/PuLID_ComfyUI added at 93e0c4c226
Submodule comfyui/custom_nodes/cg-use-everywhere added at a3952a4480
Submodule comfyui/custom_nodes/comfyui_controlnet_aux added at 95a13e2e5d
@@ -0,0 +1,130 @@
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
class Example(io.ComfyNode):
"""
An example node
Class methods
-------------
define_schema (io.Schema):
Tell the main program the metadata, input, output parameters of nodes.
fingerprint_inputs:
optional method to control when the node is re executed.
check_lazy_status:
optional method to control list of input names that need to be evaluated.
"""
@classmethod
def define_schema(cls) -> io.Schema:
"""
Return a schema which contains all information about the node.
Some types: "Model", "Vae", "Clip", "Conditioning", "Latent", "Image", "Int", "String", "Float", "Combo".
For outputs the "io.Model.Output" should be used, for inputs the "io.Model.Input" can be used.
The type can be a "Combo" - this will be a list for selection.
"""
return io.Schema(
node_id="Example",
display_name="Example Node",
category="Example",
inputs=[
io.Image.Input("image"),
io.Int.Input(
"int_field",
min=0,
max=4096,
step=64, # Slider's step
display_mode=io.NumberDisplay.number, # Cosmetic only: display as "number" or "slider"
lazy=True, # Will only be evaluated if check_lazy_status requires it
),
io.Float.Input(
"float_field",
default=1.0,
min=0.0,
max=10.0,
step=0.01,
round=0.001, #The value representing the precision to round to, will be set to the step value by default. Can be set to False to disable rounding.
display_mode=io.NumberDisplay.number,
lazy=True,
),
io.Combo.Input("print_to_screen", options=["enable", "disable"]),
io.String.Input(
"string_field",
multiline=False, # True if you want the field to look like the one on the ClipTextEncode node
default="Hello world!",
lazy=True,
)
],
outputs=[
io.Image.Output(),
],
)
@classmethod
def check_lazy_status(cls, image, string_field, int_field, float_field, print_to_screen):
"""
Return a list of input names that need to be evaluated.
This function will be called if there are any lazy inputs which have not yet been
evaluated. As long as you return at least one field which has not yet been evaluated
(and more exist), this function will be called again once the value of the requested
field is available.
Any evaluated inputs will be passed as arguments to this function. Any unevaluated
inputs will have the value None.
"""
if print_to_screen == "enable":
return ["int_field", "float_field", "string_field"]
else:
return []
@classmethod
def execute(cls, image, string_field, int_field, float_field, print_to_screen) -> io.NodeOutput:
if print_to_screen == "enable":
print(f"""Your input contains:
string_field aka input text: {string_field}
int_field: {int_field}
float_field: {float_field}
""")
#do some processing on the image, in this example I just invert it
image = 1.0 - image
return io.NodeOutput(image)
"""
The node will always be re executed if any of the inputs change but
this method can be used to force the node to execute again even when the inputs don't change.
You can make this node return a number or a string. This value will be compared to the one returned the last time the node was
executed, if it is different the node will be executed again.
This method is used in the core repo for the LoadImage node where they return the image hash as a string, if the image hash
changes between executions the LoadImage node is executed again.
"""
#@classmethod
#def fingerprint_inputs(s, image, string_field, int_field, float_field, print_to_screen):
# return ""
# Set the web directory, any .js file in that directory will be loaded by the frontend as a frontend extension
# WEB_DIRECTORY = "./somejs"
# Add custom API routes, using router
from aiohttp import web
from server import PromptServer
@PromptServer.instance.routes.get("/hello")
async def get_hello(request):
return web.json_response("hello")
class ExampleExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
Example,
]
async def comfy_entrypoint() -> ExampleExtension: # ComfyUI calls this to load your extension and its nodes.
return ExampleExtension()
Submodule comfyui/custom_nodes/was-node-suite-comfyui added at afeee09ba4
@@ -0,0 +1,44 @@
from PIL import Image
import numpy as np
import comfy.utils
import time
#You can use this node to save full size images through the websocket, the
#images will be sent in exactly the same format as the image previews: as
#binary images on the websocket with a 8 byte header indicating the type
#of binary message (first 4 bytes) and the image format (next 4 bytes).
#Note that no metadata will be put in the images saved with this node.
class SaveImageWebsocket:
@classmethod
def INPUT_TYPES(s):
return {"required":
{"images": ("IMAGE", ),}
}
RETURN_TYPES = ()
FUNCTION = "save_images"
OUTPUT_NODE = True
CATEGORY = "api/image"
def save_images(self, images):
pbar = comfy.utils.ProgressBar(images.shape[0])
step = 0
for image in images:
i = 255. * image.cpu().numpy()
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
pbar.update_absolute(step, images.shape[0], ("PNG", img, None))
step += 1
return {}
@classmethod
def IS_CHANGED(s, images):
return time.time()
NODE_CLASS_MAPPINGS = {
"SaveImageWebsocket": SaveImageWebsocket,
}
+286
View File
@@ -0,0 +1,286 @@
# 🔌 Wake On LAN (WOL) et Démarrage Automatique
Guide pour s'assurer que tous les services Effi démarrent automatiquement après un WOL.
---
## 📋 Architecture des services sur folzo-Corp
| Service | Port | Docker | Dépendance WOL |
|---------|------|--------|----------------|
| **Ollama** | 11434 | ✅ | Oui |
| **Effi-STT** | 8200 | ✅ | Oui |
| **openedai-speech** | 8100 | ✅ | Oui |
| **ComfyUI** | 8188 | ✅ | Oui |
---
## 🚀 Configuration du démarrage automatique
### 1. Activer Docker au boot
Sur **folzo-Corp**, exécutez une fois :
```bash
sudo systemctl enable docker
```
Cela garantit que Docker démarre automatiquement à chaque boot.
### 2. Vérifier la politique de redémarrage des conteneurs
Tous les services Docker doivent avoir `restart: unless-stopped` dans leur `docker-compose.yml`.
**Vérification :**
```bash
# Vérifier les politiques de redémarrage
sudo docker inspect -f '{{.Name}} - {{.HostConfig.RestartPolicy.Name}}' $(sudo docker ps -aq)
```
**Résultat attendu :**
```
/ollama - unless-stopped
/comfyui - unless-stopped
/effi-stt - unless-stopped
/openedai-speech - unless-stopped
```
Si un conteneur n'a pas `unless-stopped`, modifiez son `docker-compose.yml` et redémarrez-le.
---
## ⚡ Procédure après un WOL
### Méthode 1 : Script automatique (recommandé)
Après que folzo-Corp soit réveillé par WOL, exécutez sur le PC :
```bash
~/Documents/OpenCode/Projets/Effi/scripts/start-all-services.sh
```
Ce script va :
1. Démarrer Docker si nécessaire
2. Démarrer tous les conteneurs
3. Vérifier que tout répond correctement
### Méthode 2 : Vérification rapide
Pour vérifier que tout fonctionne :
```bash
~/Documents/OpenCode/Projets/Effi/scripts/check-services.sh
```
### Méthode 3 : Démarrage manuel
Si vous préférez démarrer un service spécifique :
```bash
# Ollama
cd ~ && sudo docker compose up -d
# ComfyUI
cd ~/Documents/OpenCode/Projets/Effi/comfyui && sudo docker compose up -d
# Effi-STT
cd ~/Documents/OpenCode/Projets/Effi/effi-stt && sudo docker compose up -d
# openedai-speech
cd ~/openedai-speech && sudo docker compose up -d
```
---
## 🔄 Créer un démarrage automatique complet
### Option A : Script au boot (systemd)
Créer un service systemd qui démarre tous les conteneurs :
```bash
# Créer le fichier de service
sudo tee /etc/systemd/system/effi-services.service > /dev/null <<EOF
[Unit]
Description=Effi Services (Ollama, ComfyUI, STT, TTS)
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
User=folzo
Group=folzo
ExecStart=/home/folzo/Documents/OpenCode/Projets/Effi/scripts/start-all-services.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
# Activer le service
sudo systemctl daemon-reload
sudo systemctl enable effi-services.service
```
**Avantage** : Tout démarre automatiquement au boot, sans intervention.
### Option B : Script de vérification périodique
Pour s'assurer que les services restent en ligne :
```bash
# Ajouter au crontab
crontab -e
# Ajouter cette ligne pour vérifier toutes les 5 minutes
*/5 * * * * /home/folzo/Documents/OpenCode/Projets/Effi/scripts/check-services.sh > /dev/null 2>&1
```
---
## 🧪 Test du WOL complet
### Procédure de test
1. **Éteindre folzo-Corp** normalement
2. **Attendre 10 secondes**
3. **Envoyer le paquet WOL** depuis effi-server :
```bash
wakeonlan XX:XX:XX:XX:XX:XX # MAC de folzo-Corp
```
4. **Attendre le boot** (~30-60 secondes)
5. **Vérifier les services** :
```bash
ssh folzo@192.168.1.11 "~/Documents/OpenCode/Projets/Effi/scripts/check-services.sh"
```
6. **Tester une génération d'image** via OpenWebUI
### Si un service ne démarre pas
```bash
# Voir les logs d'un service
sudo docker logs comfyui
# Redémarrer un service spécifique
sudo docker restart comfyui
# Vérifier l'état de tous les conteneurs
sudo docker ps -a
```
---
## 📊 Monitoring
### Vérifier l'état des services
```bash
# Tous les services
sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# Utilisation GPU
rocm-smi
# Espace disque
df -h
```
### Alertes
Si un service est down, vous pouvez créer une alerte simple :
```bash
# Dans le crontab
crontab -e
# Vérifier toutes les minutes et envoyer notification si KO
* * * * * /home/folzo/Documents/OpenCode/Projets/Effi/scripts/check-services.sh || echo "Services Effi down" | mail -s "Alerte Effi" votre@email.com
```
---
## 🐛 Dépannage
### Problème : Docker ne démarre pas au boot
```bash
# Vérifier l'état
sudo systemctl status docker
# Activer au boot
sudo systemctl enable docker
# Démarrer manuellement
sudo systemctl start docker
```
### Problème : Les conteneurs ne démarrent pas
```bash
# Vérifier la politique de redémarrage
sudo docker inspect -f '{{.Name}} - {{.HostConfig.RestartPolicy.Name}}' comfyui
# Si ce n'est pas "unless-stopped", le corriger
cd ~/Documents/OpenCode/Projets/Effi/comfyui
sudo docker compose up -d
```
### Problème : ComfyUI ne répond pas après WOL
Cela arrive si ROCm n'est pas prêt. Solution :
```bash
# Attendre que le GPU soit prêt
sleep 10
# Redémarrer ComfyUI
sudo docker restart comfyui
# Vérifier les logs
sudo docker logs comfyui | tail -20
```
### Problème : Timeout après WOL
Si les services mettent trop de temps à répondre après un WOL :
1. **Augmenter le délai d'attente** dans le script
2. **Vérifier les performances du disque** (peut-être en veille)
3. **Désactiver la veille du disque** :
```bash
sudo hdparm -S 0 /dev/sda # Désactiver la veille
```
---
## ✅ Checklist post-WOL
Après chaque WOL, vérifiez :
- [ ] Docker est démarré : `sudo systemctl is-active docker`
- [ ] Ollama répond : `curl http://localhost:11434`
- [ ] ComfyUI répond : `curl http://localhost:8188`
- [ ] Effi-STT répond : `curl http://localhost:8200/health`
- [ ] openedai-speech répond : `curl http://localhost:8100/health`
- [ ] GPU disponible : `rocm-smi`
- [ ] Test de génération d'image via OpenWebUI
---
## 📝 Résumé des commandes utiles
| Action | Commande |
|--------|----------|
| Tout démarrer | `~/Documents/OpenCode/Projets/Effi/scripts/start-all-services.sh` |
| Vérifier les services | `~/Documents/OpenCode/Projets/Effi/scripts/check-services.sh` |
| Activer démarrage auto | `sudo systemctl enable docker` |
| Voir les logs | `sudo docker logs <nom>` |
| Redémarrer un service | `sudo docker restart <nom>` |
| Voir tous les conteneurs | `sudo docker ps -a` |
| État du GPU | `rocm-smi` |
---
**Note** : Pour une expérience optimale, configurez le service systemd (Option A) pour un démarrage 100% automatique sans intervention.
*Document créé le 6 avril 2026*
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# Script de vérification des services Effi après WOL
# À exécuter sur folzo-Corp après réveil du PC
echo "================================"
echo "Vérification des services Effi"
echo "================================"
echo ""
# Fonction de vérification
check_service() {
local name=$1
local url=$2
echo -n "Vérification $name... "
if curl -s "$url" > /dev/null 2>&1; then
echo "✅ OK"
return 0
else
echo "❌ KO"
return 1
fi
}
# Vérifier les services
check_service "Ollama" "http://localhost:11434"
check_service "ComfyUI" "http://localhost:8188"
check_service "Effi-STT" "http://localhost:8200/health"
check_service "openedai-speech" "http://localhost:8100/health"
echo ""
echo "================================"
echo "Vérification Docker"
echo "================================"
echo ""
# Vérifier Docker
if ! systemctl is-active --quiet docker; then
echo "Docker n'est pas démarré ! Démarrage..."
sudo systemctl start docker
sleep 5
fi
# Vérifier les conteneurs
echo "Conteneurs Docker :"
sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
echo ""
echo "================================"
# Redémarrer les services si nécessaire
if ! check_service "ComfyUI" "http://localhost:8188"; then
echo ""
echo "Redémarrage de ComfyUI..."
cd ~/Documents/OpenCode/Projets/Effi/comfyui
sudo docker compose up -d
echo "ComfyUI redémarré !"
fi
echo ""
echo "================================"
echo "Résumé"
echo "================================"
echo ""
echo "Si un service est KO :"
echo " - Ollama: sudo docker start ollama"
echo " - ComfyUI: cd ~/Documents/OpenCode/Projets/Effi/comfyui && sudo docker compose up -d"
echo " - Effi-STT: cd ~/Documents/OpenCode/Projets/Effi/effi-stt && sudo docker compose up -d"
echo " - openedai-speech: cd ~/openedai-speech && sudo docker compose up -d"
echo ""
echo "Pour tout redémarrer:"
echo " ~/Documents/OpenCode/Projets/Effi/scripts/start-all-services.sh"
+112
View File
@@ -0,0 +1,112 @@
#!/bin/bash
# Script de démarrage de tous les services Effi
# À exécuter sur folzo-Corp après un boot ou WOL
echo "================================"
echo "Démarrage des services Effi"
echo "================================"
echo ""
# Couleurs
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
# Fonction de démarrage
start_service() {
local name=$1
local dir=$2
local compose_file=${3:-docker-compose.yml}
echo -n "Démarrage $name... "
cd "$dir" || { echo -e "${RED}✗${NC} Répertoire non trouvé"; return 1; }
if sudo docker compose -f "$compose_file" up -d 2>/dev/null; then
echo -e "${GREEN}✓${NC} OK"
return 0
else
echo -e "${RED}✗${NC} Erreur"
return 1
fi
}
# 1. Vérifier Docker
if ! systemctl is-active --quiet docker; then
echo "Démarrage de Docker..."
sudo systemctl start docker
sleep 3
fi
# 2. Démarrer les services
echo "Démarrage des conteneurs :"
echo ""
start_service "Ollama" "$HOME" "docker-compose.yml"
start_service "ComfyUI" "$HOME/Documents/OpenCode/Projets/Effi/comfyui"
start_service "Effi-STT" "$HOME/Documents/OpenCode/Projets/Effi/effi-stt"
start_service "openedai-speech" "$HOME/openedai-speech"
echo ""
echo "================================"
echo "Vérification des services"
echo "================================"
echo ""
sleep 5
# Vérifier que tout répond
services_ok=0
services_total=4
echo -n "Ollama (11434)... "
if curl -s http://localhost:11434 > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC}"
((services_ok++))
else
echo -e "${RED}✗${NC}"
fi
echo -n "ComfyUI (8188)... "
if curl -s http://localhost:8188 > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC}"
((services_ok++))
else
echo -e "${RED}✗${NC}"
fi
echo -n "Effi-STT (8200)... "
if curl -s http://localhost:8200/health > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC}"
((services_ok++))
else
echo -e "${RED}✗${NC}"
fi
echo -n "openedai-speech (8100)... "
if curl -s http://localhost:8100/health > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC}"
((services_ok++))
else
echo -e "${RED}✗${NC}"
fi
echo ""
echo "================================"
echo "Résultat : $services_ok/$services_total services OK"
echo "================================"
if [ $services_ok -eq $services_total ]; then
echo -e "${GREEN}Tous les services sont démarrés !${NC}"
echo ""
echo "Vous pouvez utiliser Effi normalement."
exit 0
else
echo -e "${RED}Certains services n'ont pas démarré.${NC}"
echo ""
echo "Pour voir les logs :"
echo " sudo docker logs ollama"
echo " sudo docker logs comfyui"
echo " sudo docker logs effi-stt"
echo " sudo docker logs openedai-speech"
exit 1
fi