Skip to content

Commit 1814ec2

Browse files
Upgrade README.md
1 parent e8bdcb7 commit 1814ec2

File tree

7 files changed

+33
-7
lines changed

7 files changed

+33
-7
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Few important things:
2020
* It comes with GitHub Actions support, [based on that article](https://hacksoft.io/github-actions-in-action-setting-up-django-and-postgres/)
2121
* It comes with examples for writing tests with fakes & factories, based on the following articles - <https://www.hacksoft.io/blog/improve-your-tests-django-fakes-and-factories>, <https://www.hacksoft.io/blog/improve-your-tests-django-fakes-and-factories-advanced-usage>
2222
* It comes with [`whitenoise`](http://whitenoise.evans.io/en/stable/) setup.
23-
* It can be easily deployed to Heroku.
23+
* It can be easily deployed to Heroku or AWS ECS.
24+
* Dockerized for local development with docker-compose.
2425
* It comes with an example list API, that uses [`django-filter`](https://django-filter.readthedocs.io/en/stable/) for filtering & pagination from DRF.
2526
* It comes with [`mypy`](https://mypy.readthedocs.io/en/stable/) configured, using both <https://github.com/typeddjango/django-stubs> and <https://github.com/typeddjango/djangorestframework-stubs/>
2627
* Basic `mypy` configuration is located in [`setup.cfg`](setup.cfg)
@@ -201,7 +202,7 @@ Example data structure:
201202
}
202203
```
203204

204-
## Helpful commands
205+
## Helpful commands for local development without docker-compose
205206

206207
To create Postgres database:
207208

@@ -227,6 +228,25 @@ To start Celery Beat:
227228
celery -A styleguide_example.tasks beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
228229
```
229230

231+
## Helpful commands for local development with docker-compose
232+
To build and run everything
233+
234+
```
235+
docker-compose up
236+
```
237+
238+
To run migrations
239+
240+
```
241+
docker-compose run django python manage.py migrate
242+
```
243+
244+
To shell
245+
246+
```
247+
docker-compose run django python manage.py shell
248+
```
249+
230250
## Heroku
231251

232-
The project is ready to be deployed on Heroku. There's a current deployment that can be found - <https://hacksoft-styleguide-example.herokuapp.com/>
252+
The project is ready to be deployed on Heroku. There's a current deployment that can be found - <https://hacksoft-styleguide-example.herokuapp.com/>

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
build:
3030
context: .
3131
dockerfile: docker/local.Dockerfile
32-
command: celery --app=styleguide_example.tasks.celery worker --without-gossip --without-heartbeat --without-mingle --loglevel=info
32+
command: celery -A styleguide_example.tasks worker -l info --without-gossip --without-mingle --without-heartbeat
3333
environment:
3434
- DATABASE_URL=postgres://postgres:postgres@db:5432/styleguide_example_db
3535
- CELERY_BROKER_URL=redis://redis
@@ -44,7 +44,7 @@ services:
4444
build:
4545
context: .
4646
dockerfile: docker/local.Dockerfile
47-
command: celery --app=styleguide_example.tasks.celery beat --loglevel=info
47+
command: celery -A styleguide_example.tasks beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
4848
environment:
4949
- DATABASE_URL=postgres://postgres:postgres@db:5432/styleguide_example_db
5050
- CELERY_BROKER_URL=redis://redis

docker/beats_entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo "--> Starting beats process"
2+
celery -A styleguide_example.tasks worker -l info --without-gossip --without-mingle --without-heartbeat

docker/celery_entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo "--> Starting celery process"
2+
celery -A styleguide_example.tasks beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler

docker/local.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This docker file is used for local development via docker-compose
12
# Creating image based on official python3 image
23
FROM python:3.9.4
34

docker/production.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This docker file is used for production
12
# Creating image based on official python3 image
23
FROM python:3.9.4
34

docker/web_entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
echo "--> Starting web app"
2-
gunicorn config.wsgi:application -b 0.0.0.0:80
1+
echo "--> Starting web process"
2+
gunicorn config.wsgi:application -b 0.0.0.0:80

0 commit comments

Comments
 (0)