OlafRadicke / booktype_with_docker

A booktype in a docker container
MIT License
2 stars 5 forks source link

Issue deploying booktype #2

Open sailendraw opened 6 years ago

sailendraw commented 6 years ago

Hi, I am trying to use booktype with docker and followed instruction, how ever i was getting error on this command su -c 'ansible-playbook booktype_with_docker' " and error is "ERROR! the playbook: booktype_with_docker could not be found ". Any help will be highly appreciated and thank you so much for your hard work.

OlafRadicke commented 6 years ago

It's a bug in the README.md. The play book is named "run_booktype.yml". I'm sorry. I'm behind a f**king firewall in the moment. So I can't fixed.

sailendraw commented 6 years ago

Hi, Thank you, it seems everything was ok when i issued that command and now i am stuck on "settings.DATABASES is improperly configured. Please supply the NAME value.". is this something expected or i am missing something ?.

OlafRadicke commented 6 years ago

I can't reproduce this issue. What commands do you do?

sailendraw commented 6 years ago

after i run ansible command to deploy su -c 'ansible-playbook run_booktype.yml', it gives no error but if you see at logs it is saying databses improperly configured. it happens right after you start the booktype container.

OlafRadicke commented 6 years ago

The playbook is full of bugs. I'm so sorry. For example in the file /etc/systemd/system/booktyperedis.service it's pulling the image of postgres and later it's starting the image of redis. The image of "olafradicke/booktype" was never running fine. See: https://forum.sourcefabric.org/discussion/17824/deploying-booktype-as-docker-container/p1 To night, I will ask my landlord if he can open the firewall for me.

danielhjames commented 6 years ago

Hi @OlafRadicke , please see https://github.com/booktype/booktype-docker for the latest work on this.

OlafRadicke commented 6 years ago

Hi @danielhjames, what do you want to say? The Readme of this repo is not relay helpful. And a supervisord in a container not a good idea. I think, that is not the right way. But okay. I will do a review of my own dirty code in the next time. May be, i can found a solution.

danielhjames commented 6 years ago

Hi @OlafRadicke, just thought I'd mention that @ride90 is also working on Docker support for Booktype installs.

OlafRadicke commented 6 years ago

Okay, I'll watch that.

OlafRadicke commented 6 years ago

Hi @danielhjames, I've check the code of https://github.com/booktype/booktype-docker . Oh, there's a lot of magic insert. thats is not really straight forward.

ride90 commented 6 years ago

Hi @OlafRadicke @danielhjames , the repo https://github.com/booktype/booktype-docker is not finished. The readme file is empty and the entire docker installation is not finished. I'm going to continue with this docker installation for "personal use" and for "development" starting from the next week. @OlafRadicke supervisor in container will be only for celery, nginx + uwsgi have their own process controllers. @OlafRadicke if you have information about why it's not good idea to use supervisor in a container, please share this information with me (link or mail), I will appreciate this 🍺

OlafRadicke commented 6 years ago

Hi, @ride90 I cloned your repo and started a factoring (https://github.com/OlafRadicke/booktype-docker/tree/remove_supervisord). My goal is a solution without supervisor. You can find the arguments in the readme. I see more things, what we can do better:

ride90 commented 6 years ago

Hi, @OlafRadicke thank you for the information regarding supervisor. I will continue with other pieces of booktype's installation and keep an eye on your cloned repo, also I will try to build a base image with alpine linux.

OlafRadicke commented 6 years ago

Hi, @ride90 I have some question for my refactoring work: 1.) Where is the script "scripts/manage_py.sh" used? 2.) Way need this project three queues (Rabbit, Redis and Celery)?

ride90 commented 6 years ago

Hi @OlafRadicke ,

1) Script "scripts/manage_py.sh" is used in main container's CMD. 2) The project does not have 3 queues. Redis is a fast key-value in-memory storage, we use it in the editor for long polling like calls (just period calls actually) and for storing sessions for some specific installations. RabbitMQ is a message broker and celery is an async task queue. Celery uses RabbitMQ as a backend to store internal data. Celery can also use redis as a backend (see http://docs.celeryproject.org/en/latest/getting-started/brokers/index.html#broker-overview), so if you don't want to install/use RabbitMQ, you can configure celery to use redis as a broker backend, but keep in mind that redis as a backend is less stable than rabbitMQ.

OlafRadicke commented 6 years ago

Hi @ride90, and can Celery talk over tcp/ip with RabbitMQ? And where is configuration of Celery?

OlafRadicke commented 6 years ago

Hi @ride90,

one more question: How can a configure uWSGI that uWSGI use stdout for longing and not /code/mybook/logs/api.log?

Background: would we want to use docker logging technologie, than the application have to write his logs to stdout (see: https://success.docker.com/article/Docker_Reference_Architecture-_Docker_Logging_Design_and_Best_Practices).

ride90 commented 6 years ago

Hi @OlafRadicke ,

1) If rabbitMQ is set as a backend for celery, in this case, I think, celery under the hood uses amqp protocol to communicate with rabbitMQ (publish/consume/..) 2) Django has specific settings for logging, you can define handlers and loggers in settings file. Booktype has list of handlers where you can define where application should write logs. For example apilogfile handler writes logs to BOOKTYPE_ROOT + "/logs/api.log" file, for development we have console (stdout) handler, so you can configure all loggers to write logs in stdout. More here: https://docs.djangoproject.com/en/1.8/topics/logging/

OlafRadicke commented 6 years ago

Hello @ ride90 Okay, I found it: ./prod/uwsgi/code/Booktype/lib/booktype/skeleton/base_settings.py.original:

And I see in ./prod/uwsgi/code/Booktype/lib/booktype/skeleton/ prod and stage. Is it an overlaienig mechanism for the configuration? Is that correct? Can we add a configuration overlaienig for the Docker environment with logging to stdout? Or alternatively: How can I activate this development environment configuration with this stdout logging?

ride90 commented 6 years ago

@OlafRadicke , yes, we use different config files for different installations and they are based on base.py setting file. You can create your own setting file or change existing files if you want to override logging rules or something else. For now, not all config vars are overridable through environment variables. In the future we'll move to another django settings pattern which will allow to override all config variables using env vars. Dev settings will be automatically used if you use wsgi_dev and manage_dev.py files. P.S. If it's really blocker for your installation I can add ability to override logging rules using env variables.