alfg / guildbit

:sound: Mumble Hosting Platform
https://guildbit.com
56 stars 8 forks source link

docker-compose is failing #57

Closed ftsiadimos closed 2 years ago

ftsiadimos commented 3 years ago

Hi,

I tried to install it using docker-compose and it is failing with the below error: I followed the below steps:

 - git clone https://github.com/alfg/guildbit.git
 -  docker-compose build
  -  docker-compose up

[root@test guildbit]# docker --version
Docker version 20.10.6, build 370c289

I am trying to run it locally Please let me know if I need to configure a file or if I missing something else.

reating guildbit_redis_1   ... done
Creating guildbit_murmurd_1 ... done
Creating guildbit_db_1      ... done
Creating guildbit_flower_1      ... error
Creating guildbit_murmur-rest_1 ... 

ERROR: for guildbit_flower_1  Cannot start service flower: b'OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "--app guildbit-tasks": executable fiCreating guildbit_murmur-rest_1 ... done
Creating guildbit_guildbit_1    ... done
Creating guildbit_celery_1      ... done
Creating guildbit_nginx_1       ... done

ERROR: for flower  Cannot start service flower: b'OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "--app guildbit-tasks": executable file not found in $PATH: unknown'
ERROR: Encountered errors while bringing up the project.

Thank you for sharing your project! Please let me know if you need more debugs from me.

alfg commented 3 years ago

Hey @ftsiadimos,

Thanks for reporting this. Not sure why flower isn't starting up, but I'll check into this soon. You can try commenting out flower in the compose file in the meantime since it's just a UI for celery.

ftsiadimos commented 3 years ago

Thank you for checking on this issue. I comment out the flower from the compose file then I had to edit the nginx

# vi etc/nginx/conf.d/guildbit.com 

that helps to start the container but without luck.

I tried also "docker-compose run --service-ports guildbit bash" then installed the packages inside of the container with

. venv/bin/activate 
pip install -r requirements.txt"

then flask run but again it failed with this error:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "host" does not exist
LINE 2: FROM host ORDER BY host.type DESC, host.name ASC"

If you have free time please run your project in a local test VM server with docker and provide all the steps you followed to configure and start the containers. Thank you a lot for sharing your project!

alfg commented 3 years ago

Hi @ftsiadimos,

I found the flower issue is due to the latest docker image updated a few days ago. I updated the docker-compose to use the mher/flower:0.9.7 to fix the issue. It must be a problem with the latest flower release.

https://github.com/alfg/guildbit/commit/441eaab73ed01cfc8dbd3df770df766572b4a2ef

I did a full docker system prune -a to clear my docker images/volumes/container and did a full rebuild and was able to get it up and running:

docker-compose build
docker-compose up

Creating guildbit_murmurd_1 ... done
Creating guildbit_db_1      ... done
Creating guildbit_redis_1   ... done
Creating guildbit_flower_1      ... done
Creating guildbit_murmur-rest_1 ... done
Creating guildbit_guildbit-tasks_1 ... done
Creating guildbit_guildbit_1       ... done
Creating guildbit_nginx_1          ... done
Attaching to guildbit_redis_1, guildbit_db_1, guildbit_murmurd_1, guildbit_flower_1, guildbit_murmur-rest_1, guildbit_guildbit_1, guildbit_guildbit-tasks_1, guildbit_nginx_1

http://localhost:8081 loads the app and I was able to create an instance.

alfg commented 3 years ago

Ok, I just found the database issue you posted too. I believe it's a race condition where the app tries to startup and makes a get_all_hosts call before the db scripts have finished the initialization process.

A workaround in the meantime before I can fix this. In forms.py, just update the following line: https://github.com/alfg/guildbit/blob/master/app/forms.py#L11

Update to:

    # hosts = Host.get_all_hosts()
    hosts = []

Startup the app again to let it finish building the database, then you can change it back.

Let me know if that works. Thanks.

ftsiadimos commented 3 years ago

Thank you for your help! That fixed the flower service but it seems there is a problem with the versions of the images, please provide the versions of the images you are using. Guildbit and celery failed to start.

Please let me know if you have changed the configuration for the "etc/nginx/nginx.conf "

233e4df25cb1   nginx                     "/docker-entrypoint.…"   12 minutes ago   Up 12 minutes               0.0.0.0:8082->80/tcp, :::8082->80/tcp                                                                                              guildbit_nginx_1
285cce0ebcfd   guildbit_guildbit         "/opt/guildbit/venv/…"   12 minutes ago   Exited (1) 12 minutes ago                                                                                                                                      guildbit_guildbit_1
4182f6150e54   guildbit_celery           "/opt/guildbit/venv/…"   12 minutes ago   Exited (1) 12 minutes ago                                                                                                                                      guildbit_celery_1
398ae9dff40b   alfg/murmur-rest:latest   "/opt/murmur-rest/ve…"   12 minutes ago   Up 12 minutes               0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                                                                                          guildbit_murmur-rest_1
22c596eb8c2b   mher/flower:0.9.7         "flower '--app guild…"   12 minutes ago   Up 12 minutes               0.0.0.0:5555->5555/tcp, :::5555->5555/tcp                                                                                          guildbit_flower_1
42780358bea2   redis                     "docker-entrypoint.s…"   12 minutes ago   Up 12 minutes               0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                                                          guildbit_redis_1
dfecf36ddf89   alfg/murmur               "/bin/sh -c '/usr/bi…"   12 minutes ago   Up 12 minutes               50051/tcp, 127.0.0.1:6502->6502/tcp, 0.0.0.0:50000-50050->50000-50050/tcp, :::50000-50050->50000-50050/tcp, 64738/tcp, 64738/udp   guildbit_murmurd_1
1c0f3468cdac   postgres                  "docker-entrypoint.s…"   12 minutes ago   Up 12 minutes               0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                                                                          guildbit_db_1

docker run guildbit_guildbit

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/guildbit/venv/lib/python3.8/site-packages/gunicorn/workers/geventlet.py", line 26
    from gunicorn.workers.async import AsyncWorker
                          ^
SyntaxError: invalid syntax
]

docker run guildbit_celery

021-07-22 16:26:35,076 INFO exited: guildbit_0 (exit status 1; not expected)
2021-07-22 16:26:35,076 DEBG received SIGCHLD indicating a child quit
You are using `--app` as an option of the worker sub-command:
celery worker --app celeryapp <...>

The support for this usage was removed in Celery 5.0. Instead you should use `--app` as a global option:
celery --app celeryapp worker <...>
Usage: celery worker [OPTIONS]
Try 'celery worker --help' for help.

Error: no such option: --app

Thank you again for your help.

vidurous commented 3 years ago

Thanks for opening this issue @ftsiadimos. @alfg, I'm having the same issue can you please investigate.

Commands:

# git clone https://github.com/alfg/guildbit.git
# docker-compose build   
# docker-compose up

Failure Result:

Starting guildbit_db_1        ... done
Recreating guildbit_murmurd_1 ... done
Starting guildbit_redis_1     ... done
Starting guildbit_flower_1    ... done
Recreating guildbit_murmur-rest_1 ... done
Recreating guildbit_guildbit_1    ... 
Creating guildbit_guildbit-tasks_1 ... error
Recreating guildbit_guildbit_1     ... error

in/celery": stat /opt/guildbit/venv/bin/celery: no such file or directory: unknown'

ERROR: for guildbit_guildbit_1  Cannot start service guildbit: b'OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "/opt/guildbit/venv/bin/gunicorn": stat /opt/guildbit/venv/bin/gunicorn: no such file or directory: unknown'

ERROR: for guildbit-tasks  Cannot start service guildbit-tasks: b'OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "/opt/guildbit/venv/bin/celery": stat /opt/guildbit/venv/bin/celery: no such file or directory: unknown'

ERROR: for guildbit  Cannot start service guildbit: b'OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "/opt/guildbit/venv/bin/gunicorn": stat /opt/guildbit/venv/bin/gunicorn: no such file or directory: unknown'

ERROR: Encountered errors while bringing up the project.
alfg commented 3 years ago

@ftsiadimos are you using the image from Docker Hub? Or clone and building via Docker? For the workaround you'll need to clone and build via Docker for it to work. I don't have the latest image published until I can fix the issue.

alfg commented 3 years ago

@vidurous That may be a separate issue. Try removing the - ".:/opt/guildbit" mount from docker-compose. It's probably mounting your local to the container and therefore missing the venv directory.

ftsiadimos commented 3 years ago

@alfg I am not sure what do you mean "clone and building via Docker" I installed the docker service then I just started it. I cloned your repo and used docker-compse that pulls from the official repo "docker.io/library/..."

I am pasting the list with the images below:

guildbit_guildbit-tasks latest 152b3c94fb50 19 hours ago 495MB guildbit_guildbit latest 152b3c94fb50 19 hours ago 495MB guildbit_celery latest 79efb200ae63 31 hours ago 495MB postgres latest b2fcd079c1d4 33 hours ago 315MB nginx latest 08b152afcfae 37 hours ago 133MB ubuntu 20.04 c29284518f49 10 days ago 72.8MB redis latest 08502081bff6 4 weeks ago 105MB alfg/murmur-rest latest 64a0996f5219 3 months ago 609MB alfg/murmur latest 5fa2e0663e37 6 months ago 188MB mher/flower 0.9.7 b0081d434fcd 7 months ago 62.5MB

alfg commented 3 years ago

@ftsiadimos Yeah, sounds like you're pulling from the latest image on Docker Hub. However, the fix I recommended can only be done if you are locally cloning the project and building. For example:

git clone https://github.com/alfg/guildbit.git
cd guildbit
docker-compose build

At least as a workaround until I can provide a fix and update the latest Docker Hub image.

ftsiadimos commented 3 years ago

I provided the steps on the first comment, I am building the containers from your docker compose file.

alfg commented 3 years ago

@ftsiadimos Right, including the workaround fix I posted above for the database initialization issue.