ASKBOT / askbot-devel

Askbot is a Django/Python Q&A forum. **Contributors README**: https://github.com/ASKBOT/askbot-devel#how-to-contribute. Commercial hosting of Askbot and support are available at https://askbot.com
Other
1.56k stars 628 forks source link

Proper container image? #801

Open sebastian-philipp opened 5 years ago

sebastian-philipp commented 5 years ago

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

Extended deployment

Minimal deployment

Supporting all setups seems feasable with one contaier image.

Is there anything I'm missing?

evgenyfadeev commented 5 years ago

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.

sebastian-philipp commented 5 years ago

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.

martin-bts commented 5 years ago

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.

sebastian-philipp commented 5 years ago

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

martin-bts commented 5 years ago

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.