Modifications

Sauter à la navigation Sauter à la recherche
957 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 82 : Ligne 84 :  
sudo service node_red restart
 
sudo service node_red restart
 
</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.
  −
  −
To do this it is as simple as navigating to the home directory of your installation:
  −
  −
<syntaxhighlight lang="bash">
  −
cd ~/node-red/
  −
</syntaxhighlight>
  −
  −
And to then run git pull
  −
  −
<syntaxhighlight lang="bash">
  −
sudo git pull
  −
</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.
      
== Raspbian Jessie et SystemD ==
 
== 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'')
 
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'')
   −
The preferred way to autostart Node-RED on Pi is to use the built in systemd capability. The pre-installed version does this by using a {{fname|nodered.service}} file and start and stop scripts. You may install these by running the following commands
+
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">
 
<syntaxhighlight lang="bash">
Ligne 112 : Ligne 98 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Info: These commands are run as root (sudo) - They download the three required files to their correct locations, make the two scripts executable and then reload the systemd daemon.
+
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 can then be started and stopped by using the commands {{fname|node-red-start}} and {{fname|node-red-stop}} (voyez le point précédent pour plus d'informations)
+
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)
   −
To then enable Node-RED to run automatically at every boot and upon crashes
+
Ensuite, pour activer le démarrage automatique de Node-RED à chaque démarrage de votre Pi (ou crash)
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 122 : Ligne 108 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
It can be disabled by
+
Et vous pouvez désactiver la fonctionnalité en utilisant
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 128 : Ligne 114 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Systemd uses the {{fname|/var/log/system.log}} for logging. To filter the log use
+
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">
 
<syntaxhighlight lang="bash">
Ligne 134 : Ligne 120 :  
</syntaxhighlight>
 
</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].
+
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">
 +
cd ~/node-red/
 +
</syntaxhighlight>
 +
 +
Et d'exécuter la commande {{fname|git pull}} :
 +
 +
<syntaxhighlight lang="bash">
 +
sudo git pull
 +
</syntaxhighlight>
    +
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) .
    
{{Rasp-Node-Red-TRAILER}}
 
{{Rasp-Node-Red-TRAILER}}
29 917

modifications

Menu de navigation