gilestrolab / ethoscope

a platform from monitoring animal behaviour in real time from a raspberry pi
http://lab.gilest.ro/ethoscope/
GNU General Public License v3.0
17 stars 25 forks source link

docker container not working #185

Closed angeliqueporciani closed 9 months ago

angeliqueporciani commented 9 months ago

Thank you for this wonderful tool. I wanted to try the latest docker version (version 3.8) but got the following issue:

docker run 35cdf6c16678 
ethoscope_backup.service: Traceback (most recent call last):
ethoscope_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 156, in save
ethoscope_backup.service:     with open(self._config_file, 'w') as json_data_file:
ethoscope_backup.service:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_backup.service: FileNotFoundError: [Errno 2] No such file or directory: '/etc/ethoscope/ethoscope.conf'
ethoscope_backup.service: 
ethoscope_backup.service: During handling of the above exception, another exception occurred:
ethoscope_backup.service: 
ethoscope_backup.service: Traceback (most recent call last):
ethoscope_backup.service:   File "/opt/ethoscope-node/node_src/scripts/backup_tool.py", line 19, in <module>
ethoscope_backup.service:     CFG = EthoscopeConfiguration()
ethoscope_backup.service:           ^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 63, in __init__
ethoscope_backup.service:     self.load()
ethoscope_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 170, in load
ethoscope_backup.service:     if not self.file_exists : self.save()
ethoscope_backup.service:                               ^^^^^^^^^^^
ethoscope_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 162, in save
ethoscope_backup.service:     raise ValueError ('Problem writing to file % s' % self._config_file)
ethoscope_backup.service: ValueError: Problem writing to file /etc/ethoscope/ethoscope.conf
ethoscope_backup.service: 
ethoscope_node.service: Traceback (most recent call last):
ethoscope_node.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 156, in save
ethoscope_node.service:     with open(self._config_file, 'w') as json_data_file:
ethoscope_node.service:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_node.service: FileNotFoundError: [Errno 2] No such file or directory: '/etc/ethoscope/ethoscope.conf'
ethoscope_node.service: 
ethoscope_node.service: During handling of the above exception, another exception occurred:
ethoscope_node.service: 
ethoscope_node.service: Traceback (most recent call last):
ethoscope_node.service:   File "/opt/ethoscope-node/node_src/scripts/server.py", line 655, in <module>
ethoscope_node.service:     CFG = EthoscopeConfiguration()
ethoscope_node.service:           ^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_node.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 63, in __init__
ethoscope_node.service:     self.load()
ethoscope_node.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 170, in load
ethoscope_node.service:     if not self.file_exists : self.save()
ethoscope_node.service:                               ^^^^^^^^^^^
ethoscope_node.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 162, in save
ethoscope_node.service:     raise ValueError ('Problem writing to file % s' % self._config_file)
ethoscope_node.service: ValueError: Problem writing to file /etc/ethoscope/ethoscope.conf
ethoscope_node.service: 
ethoscope_update_node.service: INFO:root:Using git repo at /srv/git/ethoscope.git
ethoscope_update_node.service: WARNING:root:Cherrypy version is bigger than 9, we have to change to cheroot server
ethoscope_update_node.service: Bottle v0.12.25 server starting up (using CherootServer())...
ethoscope_update_node.service: Listening on http://0.0.0.0:8888/
ethoscope_update_node.service: Hit Ctrl-C to quit.
ethoscope_update_node.service: 
ethoscope_update_node.service: 
ethoscope_video_backup.service: Traceback (most recent call last):
ethoscope_video_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 156, in save
ethoscope_video_backup.service:     with open(self._config_file, 'w') as json_data_file:
ethoscope_video_backup.service:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_video_backup.service: FileNotFoundError: [Errno 2] No such file or directory: '/etc/ethoscope/ethoscope.conf'
ethoscope_video_backup.service: 
ethoscope_video_backup.service: During handling of the above exception, another exception occurred:
ethoscope_video_backup.service: 
ethoscope_video_backup.service: Traceback (most recent call last):
ethoscope_video_backup.service:   File "/opt/ethoscope-node/node_src/scripts/video_backup_tool.py", line 104, in <module>
ethoscope_video_backup.service:     CFG = EthoscopeConfiguration()
ethoscope_video_backup.service:           ^^^^^^^^^^^^^^^^^^^^^^^^
ethoscope_video_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 63, in __init__
ethoscope_video_backup.service:     self.load()
ethoscope_video_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 170, in load
ethoscope_video_backup.service:     if not self.file_exists : self.save()
ethoscope_video_backup.service:                               ^^^^^^^^^^^
ethoscope_video_backup.service:   File "/opt/ethoscope-node/node_src/ethoscope_node/utils/configuration.py", line 162, in save
ethoscope_video_backup.service:     raise ValueError ('Problem writing to file % s' % self._config_file)
ethoscope_video_backup.service: ValueError: Problem writing to file /etc/ethoscope/ethoscope.conf
ethoscope_video_backup.service: 

I do not find any information in the documentation about the ethoscope.conf config file.

Any help would be very appreciated. Thank you.

Best regards

ggilestro commented 9 months ago

This looks like an issue with how the docker volumes are mounted. How did you start the docker volume? Which run command did you use? Or did you go with the default docker-compose.yml?

angeliqueporciani commented 9 months ago

Sorry, I did not use the docker-compose.yml, I just ran the docker. But now I try docker compose up from the git dev branch and I got the following error :

 docker % docker compose up                                         
[+] Running 1/1
 ! ethoscope-node Warning                                                                                                 1.4s 
[+] Building 0.0s (0/0)                                                                                   docker:desktop-linux
open /Users/angeliqueporciani/.docker/buildx/refs/desktop-linux/desktop-linux/.tmp-h8n62ndxh7z9ya01pur1gahzi243666103: permission denied
angeliqueporciani@MacBook-Pro-de-Angelique docker % sudo docker compose up                                   
2024/02/20 14:48:34 must use ASL logging (which requires CGO) if running as root
[+] Running 0/0
 ⠋ ethoscope-node Pulling                                                                                                 0.0s 
[+] Building 0.3s (2/3)                                                                                   docker:desktop-linux
[+] Building 0.4s (3/3) FINISHED                                                                          docker:desktop-linux
 => [ethoscope-node internal] load .dockerignore                                                                          0.0s
 => => transferring context: 2B                                                                                           0.0s
 => [ethoscope-node internal] load build definition from Dockerfile                                                       0.0s
 => => transferring dockerfile: 1.28kB                                                                                    0.0s
 => ERROR [ethoscope-node internal] load metadata for docker.io/library/archlinux:latest                                  0.3s
------
 > [ethoscope-node internal] load metadata for docker.io/library/archlinux:latest:
------
failed to solve: archlinux:latest: error getting credentials - err: exit status 1, out: ``

Thank you so much for your help. Best regards.

angeliqueporciani commented 9 months ago

This error is due to Docker and with Mac OS 10.13 version. I solved it by removing "credsStore": from ~/.docker/config.json.

angeliqueporciani commented 9 months ago

I change the mounted volume to docker-compose file to match my local setup and now, it seems to work

sudo docker compose up
[+] Building 0.0s (0/0)                                                                                                                        docker:desktop-linux
[+] Running 2/2
 ✔ Container ethoscope-node    Created                                                                                                                         0.0s 
 ✔ Container ethoscope-vsftpd  Created                                                                                                                         0.0s 
Attaching to ethoscope-node, ethoscope-vsftpd
ethoscope-vsftpd  | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
ethoscope-vsftpd  | *** Running /etc/my_init.d/10_syslog-ng.init...
ethoscope-vsftpd  | Feb 20 15:13:26 docker-desktop syslog-ng[14]: syslog-ng starting up; version='3.35.1'
ethoscope-vsftpd  | *** Booting runit daemon...
ethoscope-vsftpd  | *** Runit started as PID 24
ethoscope-vsftpd  | Feb 20 15:13:27 docker-desktop cron[28]: (CRON) INFO (pidfile fd = 3)
ethoscope-vsftpd  | Feb 20 15:13:27 docker-desktop cron[28]: (CRON) INFO (Running @reboot jobs)
ethoscope-node    | ethoscope_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_backup.service: Bottle v0.12.25 server starting up (using WSGIRefServer())...
ethoscope-node    | ethoscope_backup.service: Listening on http://0.0.0.0:82/
ethoscope-node    | ethoscope_backup.service: Hit Ctrl-C to quit.
ethoscope-node    | ethoscope_backup.service: 
ethoscope-node    | ethoscope_backup.service: ERROR:root:The node ethoscope server localhost is not running or cannot be reached. A list of available ethoscopes could not be found.
ethoscope-node    | ethoscope_backup.service: INFO:root:Using Ethoscope Scanner to look for devices
ethoscope-node    | ethoscope_backup.service: 
ethoscope-node    | ethoscope_node.service: Bottle v0.12.25 server starting up (using PasteServer())...
ethoscope-node    | ethoscope_node.service: Listening on http://0.0.0.0:80/
ethoscope-node    | ethoscope_node.service: Hit Ctrl-C to quit.
ethoscope-node    | ethoscope_node.service: 
ethoscope-node    | ethoscope_node.service: WARNING:root:Cherrypy version is bigger than 9, we have to change to cheroot server
ethoscope-node    | ethoscope_node.service: Bottle v0.12.25 server starting up (using CherootServer())...
ethoscope-node    | ethoscope_node.service: Listening on http://0.0.0.0:80/
ethoscope-node    | ethoscope_node.service: Hit Ctrl-C to quit.
ethoscope-node    | ethoscope_node.service: 
ethoscope-node    | ethoscope_node.service: 
ethoscope-node    | ethoscope_update_node.service: INFO:root:Using git repo at /srv/git/ethoscope.git
ethoscope-node    | ethoscope_update_node.service: WARNING:root:Cherrypy version is bigger than 9, we have to change to cheroot server
ethoscope-node    | ethoscope_update_node.service: Bottle v0.12.25 server starting up (using CherootServer())...
ethoscope-node    | ethoscope_update_node.service: Listening on http://0.0.0.0:8888/
ethoscope-node    | ethoscope_update_node.service: Hit Ctrl-C to quit.
ethoscope-node    | ethoscope_update_node.service: 
ethoscope-node    | ethoscope_update_node.service: 
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Backup finished at t=1708442012
ethoscope-node    | ethoscope_video_backup.service: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Backup finished at t=1708442020
ethoscope-node    | ethoscope_backup.service: 
ethoscope-vsftpd  | Feb 20 15:17:01 docker-desktop CRON[36]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Backup finished at t=1708442313
ethoscope-node    | ethoscope_video_backup.service: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Backup finished at t=1708442321
ethoscope-node    | ethoscope_backup.service: 
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_video_backup.service: INFO:root:Backup finished at t=1708442614
ethoscope-node    | ethoscope_video_backup.service: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Starting backup round
ethoscope-node    | ethoscope_backup.service: INFO:root:Found 0 devices online: 
ethoscope-node    | ethoscope_backup.service: INFO:root:Backup finished at t=1708442622
ethoscope-node    | ethoscope_backup.service: 

But infortunately, I cannot access to the interface via localhost or http://0.0.0.0:8888/ or http://0.0.0.0:80/ or http://0.0.0.0:82/. Is there something that I have not well understood ?

Thank you, Best regards.

ggilestro commented 9 months ago

Port 82 is for the backup server and port 8888 is for the update server. By the look of it, you should be able to access the node on http://localhost/ (default port 80). It's possible that the mac is forbidding you from using port 80 though and you may have to change port to something else.

ggilestro commented 9 months ago

I found out what the problem is and is now fixed. The node now requires a folder called /etc/ethoscope/ inside which the conf file will be created.

I have not time to create a new docker image right now so please work around this by creating that folder manually.