Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sreevardhanreddi/django_docker_template
A docker config for Development and Production
https://github.com/sreevardhanreddi/django_docker_template
celery celerybeat containers django docker nginx postgresql redis template
Last synced: 20 days ago
JSON representation
A docker config for Development and Production
- Host: GitHub
- URL: https://github.com/sreevardhanreddi/django_docker_template
- Owner: sreevardhanreddi
- Created: 2020-07-27T05:28:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T06:34:48.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T23:22:16.952Z (about 1 month ago)
- Topics: celery, celerybeat, containers, django, docker, nginx, postgresql, redis, template
- Language: Python
- Homepage:
- Size: 166 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# django-docker-template
## docker setup for local development
- supports sqlite3 and postgres for db (db can be a docker service)
- supports static and media files serving## docker setup for production
- nginx for proxying requests to application server, and serving static and media files
- application server (a.k.a django project) is run by **gunicorn**
- application server is connected to a separate db service```yml
version: "3.7"services:
nginx:
build: ./nginx-proxy
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
ports:
- 81:80
depends_on:
- web
restart: on-failure:5
web:
build:
context: ./web-project
dockerfile: Dockerfile.prod
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
expose:
- 8000
env_file:
- .env.prod
depends_on:
- db
db:
build:
context: ./postgres-db
volumes:
- postgres_data:/var/lib/postgresql/data
env_file:
- .env.prodworker:
build:
context: ./web-project
dockerfile: Dockerfile.worker
command: celery worker --app=django_project --loglevel=info --logfile=celery.log
env_file:
- .env.prod
depends_on:
- web
- redisworker-celery-beat:
build:
context: ./web-project
dockerfile: Dockerfile.worker
command: celery worker --app=django_project -B --loglevel=info --logfile=celery.log
env_file:
- .env.prod
depends_on:
- web
- redisredis:
build: ./redisvolumes:
postgres_data:
static_volume:
media_volume:
```## Commands
```shell
# for development localhost:8000
docker-compose up --build -d# for production localhost:81
docker-compose -f docker-compose-prod.yml up --build -d```
## Architecture
## TODO
- [ ] figure out how to add SSL for nginx