Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker init step #2150

Merged
merged 2 commits into from
Jan 24, 2023
Merged

Fix Docker init step #2150

merged 2 commits into from
Jan 24, 2023

Conversation

pifou25
Copy link
Contributor

@pifou25 pifou25 commented Jan 13, 2023

J'ai cette erreur au lancement du container jeedom "Désolé, Je ne peux sélectionner une 10mariadb étape pour vous !"

Proposed change

This error occurs when I launch the official Jeedom container with mouting paths for /var/www/html and db /var/lib/mysql

docker run -p 80:80 -v $PWD/jeedom:/var/www/html -v $PWD/mysql:/var/lib/mysql --hostname jeedom --name jeedom1 jeedom/jeedom

This command make the script install/OS_specific/Docker/init.sh goes to the second part (Start jeedom installation), whereas, without these volume being mouted, we just see "Jeedom is already install"

Type of change

  • 3rd party lib update
  • [ x] Bugfix (non breaking change)
  • Core new feature
  • UI new functionnality
  • Code quality improvements
  • Core documentation

Test check

I can't check with the official image until it is re-build again.

Documentation

beta-testing
contribute
community
plugins

J'ai cette erreur au lancement du container jeedom 
"Désolé, Je ne peux sélectionner une 10mariadb étape pour vous !"
@edgd1er
Copy link

edgd1er commented Jan 14, 2023

few thoughts:

  • why put the the database in the application ? not separating database and applications in docker is rather strange. in this image docker is used as a VM.It is because the Docker Model suggests that it is better to run a single service within a container. If you wanted to build an application that required an Apache service and a MariaDB database, you should generate two different containers.

  • mariadb is the default database server since debian 9 (2017). Reverting to mysql is a specific need that should addressed locally.

  • this image does not handle PID1 and therefore should not be used as a production image: see explanations for pid1 and systemd in docker. At best this image is just a POC. it should have at least pid1 handling, volumes, logs redirections. Other images exist trying to implement jeedom into docker in a more efficient way. Jeedom has always been thought as a system and not as an application, jeedom image are between 600 to 1Gb when mysql is 60Mb.

  • as for the jeedom already installed, the init process checks is jeedom is installed or not, preventing installing over an exisiting instance. I'm afraid you are using an existing container and not a plain one. According to the init script, if the database variables are set, ie this file exists, jeedom is installed otherwise run the install procedure. If your container jumps to the already installed, then the /var/www/html/core/config/common.config.php exists, ie install procedure has been ran previously. you may remove that file in the container and restart the container to rerun the install process or run docker stop <container_name>, docker rm <container_name>, docker run ..... A big warning though, the official container has now volumes, meaning removing the container will also remove the data and you will loose all your settings.

    if [ -f /var/www/html/core/config/common.config.php ]; then
    echo 'Jeedom is already install'
    JEEDOM_INSTALL=1
    else
    echo 'Start jeedom installation'
    JEEDOM_INSTALL=0
    rm -rf /root/install.sh

@pifou25
Copy link
Contributor Author

pifou25 commented Jan 14, 2023

Hello thanks for your comment, I'll be happy to discuss and help to improve the Docker image :) But this was just a bugfix for the current image.

  • I fully agree with you, but this image is just the easiest way for end users, especially those using NAS or box with Docker, and they don't care about the Docker phylosophy... Not sure if these kind of devices provide a simple way to import several containers with some shared parameters (something like a docker-compose sheet). Anyway, almost all well-known home automation software provide this "all-in-one" container (domoticz... home-assistant... homebridge...) and it is a requirement for beginners.
  • MariaDB is the database. mysql is just an alias
  • We should add Supervisor for the "PID1" issue.
  • As long as I run the container with mounts (for var/www/html and lib/mysql with the command above) I can drop and recreate the container without loosing my datas.

@edgd1er
Copy link

edgd1er commented Jan 14, 2023

Building a proper image for jeedom is quite an adventure. It was one of the first project I build an image for. I learned a lot about what to do and what to avoid. I hope you'll envoy the journey.

@zoic21 zoic21 merged commit 0e9dc63 into jeedom:alpha Jan 24, 2023
@pifou25 pifou25 deleted the patch-1 branch January 25, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants