mardi, avril 26, 2016

Installation de docker pour jeedom

Installation de docker pour jeedom

Utilisation des images de https://github.com/Cquad/jeedom

Utilisation de Ansible pour lancer puppet

Suite à l'article sur config de experience, rajout de jeedom dans /etc/ansible/hosts

Particularités de la machine jeedom

Cette machine dispo de 2 clés USB : une pour faire du ZWave et une huawei pour envoyer des SMS.

root@jeedom:/home/pi# lsusb
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 001 Device 006: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)



Elle dispose aussi d'une horloge sur pile

Utiliser raspi-config pour 'enabler' le i2c, puis

root@jeedom:~# apt-get install -y i2c-tools
root@jeedom:~#  i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --               

root@jeedom:~# modprobe rtc-ds1307
root@jeedom:~# echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
root@jeedom:~# hwclock -r
Sat 01 Jan 2000 01:00:16 CET  -0.099972 seconds


éditer /etc/modules.conf et y mettre

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

snd-bcm2835
i2c-dev
rtc-ds1307



editer /etc/rc.local et y mettre

root@jeedom:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
sudo hwclock -s

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0



Dans un shell,

root@jeedom:~# update-rc.d -f fake-hwclock remove
root@jeedom:~# apt-get purge fake-hwclock



 root@jeedom:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+195-154-10-106. 175.91.96.111    3 u  116  128  377   31.244   -1.890   0.542
*soliphium.rilyn 193.190.230.66   2 u   18  128  377   31.792   -1.956   1.080
-ntp1.warwicknet 195.66.241.3     2 u  102  128  377   39.599   -0.377   0.806
+spacys.de       131.188.3.222    2 u   22  128  377   45.889   -1.351   0.336


On voit que le plus haut stratum est 3, on va mettre la locale en 5.

Éditer /etc/ntp.conf, et ajouter, après les lignes 'server ...'


server 127.127.1.0
fudge  127.127.1.0 stratum 5
 
rebooter et vérifier


root@jeedom:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-ns2.akl.telesma 202.46.178.18    2 u   25   64    1  307.642  -483.80   0.531
+usins.0x00.lv   194.29.130.252   2 u   24   64    1   81.394  -489.74   1.196
*2001:bc8:3e85:1 145.238.203.14   2 u   27   64    1   32.373  -489.97   0.943
+ntp-3.arkena.ne 138.96.64.10     2 u   26   64    1   37.703  -487.85   1.124
 LOCAL(0)        .LOCL.           5 l   36   64    1    0.000    0.000   0.001
root@jeedom:~# hwclock -r
Tue 26 Apr 2016 14:32:34 CEST  -0.631582 seconds


To be continued with 'Installation de Docker', 'Initialisation des images' et 'Puppetisation de tout ça' ...

PS(17/05/2016) : La mise en place du cluster swarm dans http://redondants-ppprod-parc.blogspot.com. Je me familiarise avec le tout, puis je retourne sous jeedom pour faire une install 'clean'. Pourquoi je veux d'abord comprendre la distribution (swarm), parce que le container docker pour mysql doit (ou plutôt peut) etre partagé par les différentes applis du parc. Aujourd'hui, la question se pose : sur experience (DWG), qui est déjà au taquet, sur OMV (OdroidC2 64b sur Armbian) qui est fraichement (donc non 'stabilisé') sur Docker, ... encore des questions d'organisation/répartition