cortictechnology / cep

CEP is a software platform designed for users that want to learn or rapidly prototype using standard A.I. components.
MIT License
166 stars 21 forks source link

Building and extending docker modules #23

Closed kaalen closed 2 years ago

kaalen commented 2 years ago

Are you able to provide guidance on how I should approach extending docker module functionality?

I want to add some additional custom blocks to CAIT for vision processing. My understanding is that I should implement this functionality in vision module. I'm a little out of my depth with Docker but I'm guessing that I need to build a local docker image using the dockerfile and then look into extending the code under /src/curt/modules/vision.

I tried to build the docker image for vision but I ran into a couple of issues:

  1. There were dependencies to packages libqtgui4, libqtwebkit4 and libqt4-test which could not be found. They were possibly deprecated. I commented those out to see if I can get it to work without those.
  2. Building the vision image failed with the following message:
    ERROR: Failed building wheel for depthai
    ERROR: Could not build wheels for depthai which use PEP 517 and cannot be installed directly
    WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
    You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
    The command '/bin/sh -c pip3 install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai' returned a non-zero code: 1
kaalen commented 2 years ago

Well, the best kinds of problems are the ones where you can find a solution yourself. I figured out I can take a different approach after completing a general getting started tutorial on docker. So for the benefit of others who may be interested in extending the functionality or simply looking closer at the inner workings to troubleshoot any issues, here's my approach:

Start the CURT containers in console:

cd ~/cep/src/curt
docker-compose up --force-recreate

After doing this I noticed CAIT web app stopped responding so that seems to need a restart as well: sudo systemctl restart cait_webapp.service

For now, this is enough to get me going and I was able to use the console output to troubleshoot why my script wasn't working (forgot to add something to the intialisation pipeline) and get a better idea of where I can modify the code to extend the functionality.

michaelhwn commented 2 years ago

HI @kaalen, sorry for the late reply. I am glad that you found a solution. The --force-recreate flag is indeed needed to make sure no caches from previous docker containers with the same name are used. And the reason that the CAIT web app is needed to restart is that it needs to re-establish a connection to the local MQTT broker (which was shut down by docker-compose on every restart). I will put in a task to allow auto re-discovery and auto-reconnection of the web app so that in the future, no restart of the CAIT web app is needed.

michaelhwn commented 2 years ago

Closing due to inactivity.