askbot-devel icon indicating copy to clipboard operation
askbot-devel copied to clipboard

Proper container image?

Open sebastian-philipp opened this issue 5 years ago • 5 comments

I'm coming to the conclusion that deploying Askbot properly is actually quite hard. Turns out my existing deployment had svere problems. like missing the cron job, DEBUG=True etc. I woud not recomment any other kind of deployment.

I'm starting to thing of making a deployment based on containers the the recommended deployment kind for everyone.

This also makes the Dockerfile the single source of truth for other deployments.

I can think of three usabe deployment setups for Askbot:

Standard deployment

  • 1 Askbot container (ngnix + uwsgi)
  • database container
  • 2 volumes (DB + User uploads)

Extended deployment

  • 3 Askbot containers (ngnix + uwsgi)
  • database
  • 1 Email cron job
  • 1 memcached
  • 2 kubernetes volumes (DB + User uploads)
  • celery

Minimal deployment

  • Everthing in one container
  • one docker volume

Supporting all setups seems feasable with one contaier image.

Is there anything I'm missing?

sebastian-philipp avatar Jun 29 '19 21:06 sebastian-philipp

perhaps for the minimal container the option might be just the python app with a python server - uwsgi, gunicorn or something similar, mostly for the experts who like minimal per-service containers.

evgenyfadeev avatar Jun 29 '19 22:06 evgenyfadeev

perhaps for the minimal container the option might be just the python app with a python server - uwsgi, gunicorn or something similar, mostly for the experts who like minimal per-service containers.

yeah, I'd like to have one container image for all setups. If we're using manage.py runserver for just the minimal setup, it gets more complicated.

sebastian-philipp avatar Jun 29 '19 23:06 sebastian-philipp

With this PR https://github.com/ASKBOT/askbot-devel/pull/819, the image created with Dockerfile will work fairly well with sqlite and postgres. For a more versatile image we would have to extend askbot/container/prestart.py to accommodate more DB backends. Right now it only includes a postgres implementation.

martin-bts avatar Jul 09 '19 11:07 martin-bts

Well, it should work for other backends, but you will then have to set up everything by yourself, right?

sebastian-philipp avatar Jul 09 '19 11:07 sebastian-philipp

The current image contains all the management commands for setting up the admin user, granting rights and doing migrations. This did/may/will cause trouble if a container does not startup for the very first time or if it is not the first/only Askbot container.

For postgres I implemented a small startup check that will only do what it thinks is required. I am not using Django for this check which makes the code postgres specific. Sqlite, MySQL and Oracle would need their own versions of this startup check.

Further, sqlite and postgres are the only installed Python DB bindings. This is why MySQL and Oracle can't work at the moment.

martin-bts avatar Jul 09 '19 11:07 martin-bts