MycroftAI/mimic-recording-studio

Kathy's experience building `mimic-recording-studio`

KathyReid opened this issue · 11 comments

g'day @LearnedVector - I gave mimic-recording-studio a go, and wanted to provide feedback on my experience and suggestions that might help improve the README - wanting to help reduce support queries when this is made publicly available.


  • I had to run sudo docker-compose build to get it to run on Ubuntu 18.04 LTS
  • It would be helpful to note in the README not to run docker-compose up after running docker-compose build - otherwise an error is thrown
  • It would be helpful to include a hyperlink to http://localhost:3000 - I had to go digging to find where to find the URL ;-)

kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ ls
backend   docker-compose.yml  LICENSE.md  start-windows.bat
demo.gif  frontend            README.md
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ docker-compose build
Building frontend
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ dockerd
chmod /var/lib/docker: operation not permitted
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ sudo dockerd
Error starting daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ sudo docker-compose buildBuilding frontend
Step 1/4 : FROM node:latest
 ---> a2b9536415c2
Step 2/4 : RUN npm install -g yarn
 ---> Using cache
 ---> 9c482d57e48b
Step 3/4 : WORKDIR /src/
 ---> Using cache
 ---> 3db7be01d0bd
Step 4/4 : CMD ["bash", "start.sh"]
 ---> Using cache
 ---> 2f6b9e809c24
Successfully built 2f6b9e809c24
Successfully tagged mimicrecordingstudio_frontend:latest
Building backend
Step 1/7 : FROM python:3.6-alpine3.6
 ---> 0985afc55bfa
Step 2/7 : COPY requirements.txt /src/
 ---> Using cache
 ---> 325b68ac0488
Step 3/7 : WORKDIR /src
 ---> Using cache
 ---> 28377870d8f0
Step 4/7 : RUN apk update
 ---> Using cache
 ---> f3c9632fbe02
Step 5/7 : RUN apk add ffmpeg make automake gcc g++ subversion python3-dev
 ---> Using cache
 ---> f792e293da0a
Step 6/7 : RUN pip install -r requirements.txt
 ---> Using cache
 ---> 6bdf923c8740
Step 7/7 : CMD ["sh", "start_prod.sh"]
 ---> Using cache
 ---> ca62a045f2d6
Successfully built ca62a045f2d6
Successfully tagged mimicrecordingstudio_backend:latest
kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ sudo docker-compose up
Starting mrs-frontend ... 
Starting mrs-backend ... 
Starting mrs-frontend
Starting mrs-backend ... error

ERROR: for mrs-backend  Cannot start service backend: driver failed programming external connectivity on endpoint mrs-backend (cd350877681d9efcd2a8b4976390002659350bf672fe037f0253c4db4d987722): Error starting userland proxy: listen tcp 0.0.Starting mrs-frontend ... done

ERROR: for backend  Cannot start service backend: driver failed programming external connectivity on endpoint mrs-backend (cd350877681d9efcd2a8b4976390002659350bf672fe037f0253c4db4d987722): Error starting userland proxy: listen tcp 0.0.0.0:5000: bind: address already in use
ERROR: Encountered errors while bringing up the project.

Also, it didn't seem to find the English Corpus .csv file.

screenshot from 2018-11-21 00-31-14

Here is the console output - could this be a CORS error?

screenshot from 2018-11-21 00-33-55

@KathyReid It seems that the backend may not be up. If you look at the docker error logs it fails to bind the backend to port 5000 because there is already something using that port on your computer

Can you do docker ps to see the running applications.

kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ sudo docker ps
CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                    NAMES
f733def8df9d        mimicrecordingstudio_frontend   "bash start.sh"     3 weeks ago         Up 5 hours          0.0.0.0:3000->3000/tcp   mrs-frontend

^^^ these are the running docker containers - so there isn't one running on port 5000

Using netstat to see what's running on port 5000

kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ netstat -tulpn | grep 5000
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::5000                 :::*                    LISTEN      -    

So something is listening on this port, but I don't know what it is ...

I will keep digging.

Thanks @LearnedVector - the weird thing is that this is a brand new installation of docker-ce and docker-compose - so there shouldn't be anything running on those ports. I'll keep digging because it might be indicative of some sort of permissions issue / other setup or config issue with mimic-recording-studio

What's running on port 5000?

Thanks @LearnedVector - the weird thing is that this is a brand new installation of docker-ce and docker-compose - so there shouldn't be anything running on those ports. I'll keep digging because it might be indicative of some sort of permissions issue / other setup or config issue with mimic-recording-studio.

I did a bit more digging;

kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ sudo netstat -pna | grep 5000
tcp6       0      0 :::5000                 :::*                    LISTEN      993/docker-registry 

By default, docker-registry listens on port 5000. I don't even remember configuring docker-registry on this machine, but it's likely that other docker users will run docker-registry, which by default runs on port 5000.

Does it make sense for us to change the default port of the backend to not conflict with the docker-registry default port?

What happens if I change the port that the backend runs on?

I configured the .yml file so that the backend runs on port 5001 instead of port 5000.

kathyreid@kathyreid-Oryx-Pro:~/mimic-recording-studio$ cat docker-compose.yml 
version: '3'
services:
  backend:
    container_name: mrs-backend
    build:
      context: ./backend/
    ports:
     - "5001:5001"
    volumes: 
     - ./backend/:/src
    environment:
    - CORPUS=english_corpus.csv
    - APIPORT=5001
    - WEBWORKERS=1
  frontend:
    container_name: mrs-frontend
    build:
      context: ./frontend/
    ports:
     - "3000:3000"
    volumes:
     - ./frontend/:/src

This appeared to start up correctly - terminal output below - but I am still getting a Javascript console error about CORS on port 5000, and the 'failed to load prompt' error.
I was accessing the studio from the URL - http://localhost:3000
I tried the network address http://172.19.0.2:3000 instead but got the same error.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/api/user/?uuid=7b61d815-f978-6164-691a-47139367e316. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Because I had changed the ports to 5001, I figured this must be because of docker-registry running on port 5000. I ran sudo apt-get remove docker-registry and this fixed the problem.

I then changed the ports back to 5000 in the *.yml file, and ran docker-compose up to make sure that removing docker-registry solved the issue - and it did.

TL;DR this was a conflict with docker-registry, removing docker-registry resolved the issue

Before we put this to bed, is is worth switching to a different port instead of 5000? Looking at well-known ports list (like https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers) the 5000 port range is crowded. Any reason not to use a less common/private port instead?

I don't feel like I have enough experience with docker or docker-compose to provide solid advice here. From the reading I did to debug this, a lot of gunicorn / flask - flavored Docker stacks default to port 5000.

The type of people who are going to spin up a docker-compose stack though are likely to be running other Docker containers, so from a "first principles" way of thinking it makes sense to set a different backend port. That said, if we're going to do that, should we set a different frontend port too?

The frontend and backend ports were the default ports for those applications. We can certainly change it, i don't think that'll hurt.

ports:
- "5001:5001"

Actually I believe this should have been 5001:5000 otherwise the internal docker container would have had to be changed as well. 5001 is the host port, 5000 is the docker port as far as I know. That is what has worked for me in the past, however despite now starting up correctly, it's still presenting my with error loading prompt... is the backend running?

I'm on mac though - works on linux but that machines too noisy.

Just an update the fix was ultimately to change in three places:

In docker compose.yml
ports:
- "5001:5001"
- APIPORT=5001
Plus as per this thread: #95
edit frontend/src/App/api/index.js
and change const apiRoot = "http://localhost:5000/"; to const apiRoot = "http://localhost:5001/";

Then finally it works. This works well on a Mac.