Installing Jeedom on Synology NAS with Docker

I'm giving a try to Jeedom to enable better interaction between my home automation (LeGrand/BTicino), Google Home & Philips Hue lamp.

The Documentation for Synology installation is a bit outdated :
https://jeedom.github.io/documentation/installation/fr_FR/index#tocAnchor-1-21


Here is what I found while installing Jeedom :

  • You can't use MySQL/MariaDB version 8.x. You must use MySQL (or MariaDB) version 5.7.24 (or later).
    With 8.x you'll first get the following error
    • ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory 

      This can be fixed by adding the following option to the docker start command (as last option)
      --default-authentication-plugin=mysql_native_password
    • But then, you'll get the following error :

      Error : [MySQL] Error code : 42000 (1064). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'function='persist'' at line 4[END CONSISTENCY]

      I don't think it's fixable from a MySQL/MariaDB side.
      I think the issue is in consistency.php at that line :  $cron->setFunction('persist');
  • You really shouldn't use root user for Jeedom installation. That's really a basic security flaw.
  • It's faster to use command line to instanciate docker images.


Installation steps :

Enable SSH access to your synology :

Follow this blog post :
http://krypted.com/synology/enable-ssh-access-synology/

Install Docker :


  • Open the packet center
  • Search for Docker
  • Click install



Install MySQL (or MariaDB)


  • Connect as root using SSH (root password is the same as the 'admin' password)
    • Use ssh root@IP_OF_YOUR_NAS on mac, or use putty on windows
  • Run the following commands
This will create a directory on your NAS where the MySQL data is written. 

mkdir -p /volume1/docker/JeeDomMySQL

Before running this command, change the password.
You can use KeepassXC to generate and securely store password.

This command will fetch the MySQL 5.7.24 docker image and run it with the following options : 
  • Redirect your NAS port 13306 to the 3306 port inside the docker image
  • Initialise mysql root password with the password provided
  • Create a database named "jeedom_db"
  • Create a mysql user jeedom_u with the password provided
  • Mount your NAS folder /volume1/docker/JeeDomMySQL to /var/lib/mysql inside the docker image
  • Name the image JeeDomMySQL

docker run  --name JeeDomMySQL\
            -p 13306:3306\
            -e MYSQL_ROOT_PASSWORD=your_mysql_root_password \
            -e MYSQL_DATABASE=jeedom_db \
            -e MYSQL_USER=jeedom_u \
            -e MYSQL_PASSWORD=your_jeedom_password \
            -v /volume1/docker/JeeDomMySQL:/var/lib/mysql\
            -d mysql:5.7.24



Install Jeedom

In the same way : 

mkdir -p /volume1/docker/JeeDom


This command will fetch and run the latest version of Jeedom Docker image

  • Redirect your NAS port 9080 to the 80 port inside the docker image (http)
  • Redirect your NAS port 9022 to the 22 port inside the docker image (ssh)
  • Mount your NAS folder /volume1/docker/JeeDom to /var/www/html inside the docker image
  • Run the image with higher privileges (as instructed in the documentation)
  • Name the image JeeDom


docker run  --name JeeDom \
            --privileged=true \
            -p 9080:80 \
            -p 8022:22 \
            -v /volume1/docker/JeeDom:/var/www/html\
            -d jeedom/jeedom:latest




Configure Jeedom

Open your browser and type the following URL : 

http://IP_OF_YOUR_NAS:9080

IP_OF_YOUR_NAS can be get from the ssh command line by typing ifconfig
The IP is what is highlighted in yellow after the line starting with "eth0"

eth0      Link encap:Ethernet  HWaddr 00:11:16:1A:D3:2A
          inet addr:192.168.5.200  Bcast:192.168.5.255  Mask:255.255.255.0



Fill the form as follow. Set the "Database password" to the "jeedom_u" password you set in the MySQL installation:





Click "Proceed" and you should get this :




Some useful commands : 


You can use the Synology Docker interface to stop/start docker images or run the following : 

stop:

docker container stop  JeeDomMySQL
docker container stop  JeeDom

start:

docker container start  JeeDomMySQL
docker container start  JeeDom

In case you need to remove everything (before retrying):

WARNING: this will delete everything, so DATA LOSS.

docker container kill  JeeDom
docker container rm    JeeDom
rm -rf /volume1/docker/JeeDom/*

docker container kill  JeeDomMySQL
docker container rm    JeeDomMySQL
rm -rf /volume1/docker/JeeDomMySQL/*

Following the Docker image logs : 


docker container logs -f JeeDomMySQL
docker container logs -f JeeDom

Console access to docker image : 

docker container exec -it JeeDom bash
docker container exec -it JeeDomMySQL bash

MySQL access with command line : 

docker exec -it JeeDomMySQL bash -c 'exec mysql -u root -p$MYSQL_ROOT_PASSWORD'

For a graphical tool, use MySQL Workbench

https://dev.mysql.com/downloads/workbench/
Click the "Download" button, then click the link:


Docker cheat sheet : 

Comments

rennais said…
Bonjour,
J'ai suivi les étapes pour installer jeedom sur mon nas qnap et ça bloque. Lorsque je vais sur l'ip nasip:9080 je n'ai pas la page d'accueil de jeedom qui s'affiche et je ne peux donc pas continuer. J'ai cherché et recommencé plusieurs fois.
Je me retrouve avec 2 Docker.
Le premier "JeeDom-temporary-1576575974" démarre bien mais le second JeeDomMySQL se lance et abort de suite.
Message d'erreur : Initializing database
2019-12-17T09:47:31.764186Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp serve
r option (see documentation for more details).
2019-12-17T09:47:31.769257Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2019-12-17T09:47:31.769339Z 0 [ERROR] Aborting

Voilà ou j'en suis et n'étant pas développeur je bloque. Auriez vous un peu de temps pour une réponse éclairante.
D'avance merci
Heddy
Manson Thomas said…
Hello Heddy,

> --initialize specified but the data directory has files in it.

Est ce que le répertoire ou tu map MySQL était bien vide ? (/volume1/docker/JeeDomMySQL)

Je suis passé sur OpenHab depuis (une seule image docker qui tourne), je ne pourrais pas t'aider plus que ca.

Popular posts from this blog

Upgrade Slimframework v3 to v4, how I did it

Reset Bacula database and files

Limit the upload bandwidth of your apache webserver with mod_bw