Django Docker Compose
A production oriented dockerized django app. explained in more details on my blog
This app is using what one could call a standard django app. Including the followings :
- Django running on gunicorn
- Celery worker
- Postgres database
- Nginx frontend server
This required docker, docker-machine and docker-compose installed on your local machine. More informations on Docker's website
# creates a local host for docker containers, only do once docker-machine create -d virtualbox local # create your config secrets cp secrets.env.sample secrets.env # load the docker env eval "$(docker-machine env local)" # build web image docker-compose build docker-compose up -d # run commands inside the containers docker-compose run app python manage.py migrate
How can make sure it works ?
- first you need to know your
localdocker machine ip, using
- Visit http://LOCAL_IP
- Check celery's worker logs
docker-compose logs worker
docker compose is not deemed production ready. There are some limitations, mainly related to scalability. But I think it is fine for small applications. It is obviously much better to understand how docker compose works. more info on docker's website.
The big news is tutum has been acquired by Docker. Tutum is a could service to manage and deploy Docker applications. It uses a stack descriptor, which is compatible with docker-compose yaml format. So you can use my example project to deploy and mange your app with tutum.