Modifications

Sauter à la navigation Sauter à la recherche
2 887 octets ajoutés ,  2 avril 2017 à 14:37
Ligne 1 : Ligne 1 :  
{{Rasp-Node-Red-NAV}}
 
{{Rasp-Node-Red-NAV}}
   −
== Raspbian Whezzy et Service ==
+
== Raspbian Whezzy et SystemV ==
Node-Red is great out of the box but it can be a bit manual to start, stop and run on boot. The following section will describe a simple init script to do all of the hard work for us.
+
Node-Red est vraiment au top dès son installation mais il nécessite encore un opération manuelle pour le démarrer (''start''), l'arrêter (''stop'') et démarrer au boot.  
   −
Firstly we create a new init.d file, which is essentially a script for starting, stopping and restarting services under Linux.
+
La section suivante décrit comment mettre en oeuvre un "init script" qui effectue le travail pour vous. System V est une collection de script qui supervise le démarrage et l'arrêt des systèmes type Unix. Il était encore utilisé '''jusqu'à Raspbian Whezzy'''. Depuis Raspbian Jessie c'est SystemD qui est utilisé (cfr section suivante).
 +
 
 +
Pour commencer, nous allons créer un nouveau fichier {{fname|init.d}} qui est principalement un script qui démarre, arrête et redémarre les services sous Linux.
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 10 : Ligne 12 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Then copy and paste the following code in to the file. To do this within nano copy the text below and right click in the nano window you should see the text start to appear.
+
Ensuite, copiez/collez le code suivant dans le fichier. Pour faire cela avec Nano, copiez le texte suivant dans le presse papier puis faites un clique droit dans la fenêtre de Nano... vous verrez le texte apparaître.
   −
The only thing you may need to change before saving is the directory where node-red is installed on your Pi. If you have been following this guide all the way through you do not need to change anything.
+
La seule chose que vous pourriez avoir besoin de changer avant de sauver le fichier c'est le répertoire d'installation Node-Red sur votre ordinateur. Si vous avez attentivement suivit les instructions alors vous ne devriez pas avoir besoin de changer le contenu du fichier.
   −
For those that have installed Node-Red in a different location just change the following line “cd /home/pi/node-red” to reflect the folder location where Node-Red is installed.  
+
Pour ceux qui on installé Node-Red dans un emplacement différent changer simplement la ligne “cd /home/pi/node-red” pour refléter l'installation actuelle de votre Pi.  
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 63 : Ligne 65 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Once you have pasted and updated the above script hit CTRL+X and then Y to save changes. Next we will make the file executable so that it can be run.  
+
Une fois que vous avez collé (et mis à jour) le script ci-dessus PRESSEZ CTRL+X puis Y pour sauver les changements. Ensuite nous allons le rendre exécutable de sorte que nous pourrons l'exécuter.  
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 69 : Ligne 71 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Finally to ensure the script will start at boot and stop at shutdown we need to update the rc.d file.  
+
Pour finir, pour s'assurer que le script démarrera au démarrage du Pi (boot) et arrêté durant sa mise à l'arrêt, il faudra faire une mise-à-jour du fichier {{fname|rc.d}} .  
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 75 : Ligne 77 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Thats it! Nice and simple, as stated at the start the following commands will now work.  
+
Voilà! Simple et efficace. Les commandes suivantes permettent de vérifier le bon fonctionnement du service:
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 83 : Ligne 85 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
The final part to managing Node-Red is keeping it up to date. Since we cloned the Node-Red repository originaly from Git Hub we can easily pull down the latest versions whenever we want.
+
== Raspbian Jessie et SystemD ==
 +
Depuis Raspbian Jessie, System 5 (mode de démarrage du système) à été remplacé par SystemD. Vous trouverez ci-dessous des informations traduites depuis le lien [http://nodered.org/docs/hardware/raspberrypi "Adding Autostart capability using SystemD"] (''nodered.org, anglais'')
   −
To do this it is as simple as navigating to the home directory of your installation:  
+
Vous pouvez démarrer automatiquement Node-RED sur un Pi en utilisant SystemD. Il est possible de démarrer et arrêter le service en utilisant le fichier {{fname|nodered.service}} et les scripts de démarrage et arrêt (''start'' et ''stop''):
 +
 
 +
<syntaxhighlight lang="bash">
 +
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/nodered.service -O /lib/systemd/system/nodered.service
 +
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-start -O /usr/bin/node-red-start
 +
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-stop -O /usr/bin/node-red-stop
 +
sudo chmod +x /usr/bin/node-red-st*
 +
sudo systemctl daemon-reload
 +
</syntaxhighlight>
 +
 
 +
Info: ces commandes sont exécutées en "root" à l'aide de {{fname|sudo}} permettent de télécharger les 3 fichiers requis en les plaçant au bon endroit, rendre les scripts exécutables et recharger le deamon de systemd.
 +
 
 +
Node-RED peut alors être démarré et arrêté en utilisant les commandes {{fname|node-red-start}} et {{fname|node-red-stop}} (voyez le point précédent pour plus d'informations)
 +
 
 +
Ensuite, pour activer le démarrage automatique de Node-RED à chaque démarrage de votre Pi (ou crash)
 +
 
 +
<syntaxhighlight lang="bash">
 +
sudo systemctl enable nodered.service
 +
</syntaxhighlight>
 +
 
 +
Et vous pouvez désactiver la fonctionnalité en utilisant
 +
 
 +
<syntaxhighlight lang="bash">
 +
sudo systemctl disable nodered.service
 +
</syntaxhighlight>
 +
 
 +
Systemd utilise le fichier {{fname|/var/log/system.log}} pour logging. Vous pouvez utiliser la commande suivante '''pour filtrer les entrées''' du log:
 +
 
 +
<syntaxhighlight lang="bash">
 +
sudo journalctl -f -u nodered -o cat
 +
</syntaxhighlight>
 +
 
 +
Il est également possible de modifier l'environnement de SystemD et utiliser un proxy. Voyez ce [http://nodered.org/docs/hardware/raspberrypi lien dans la documentation de nodered.org].
 +
 
 +
== Mise-à-jour de Node-Red ==
 +
Un dernier point concernant la gestion de Node-Red: il faut le garder à jour. Etant donné que nous avons cloner le dépôt Node-Red original, nous pouvons rapatrier facilement la dernière version depuis le dépôt GitHub.
 +
 
 +
Pour faire cela, il suffit de vous rendre dans le répertoire d'installation de Node-Red:
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 91 : Ligne 131 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
And to then run git pull  
+
Et d'exécuter la commande {{fname|git pull}} :
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 97 : Ligne 137 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
If there are any changes you will see them being downloaded. You can then restart Node-Red using our service script and you are ready to go again.
+
S'il y a le moindre changement, il sera téléchargé et inclus dans les sources de votre clone. Vous pouvez alors redémarrer Node-Red en utilisant le script de service (écrit ci-avant) .
 
  −
== Raspbian Jessie et SystemD ==
  −
 
  −
Voir le point [http://nodered.org/docs/hardware/raspberrypi "Adding Autostart capability using SystemD" sur cette page]
      
{{Rasp-Node-Red-TRAILER}}
 
{{Rasp-Node-Red-TRAILER}}
29 917

modifications

Menu de navigation