mirror of https://github.com/snachodog/mybuddy.git
Merge pull request #142 from MaximilianKindshofer/rework-docker-example
Rework docker example
This commit is contained in:
commit
9944de9bee
|
@ -106,14 +106,6 @@ and set, at least, the `ALLOWED_HOSTS` and `SECRET_KEY` variables under
|
|||
|
||||
docker-compose up -d
|
||||
|
||||
1. Initialize the database *(first run/after migrations updates)*
|
||||
|
||||
docker-compose exec app python manage.py migrate
|
||||
|
||||
1. Initialize cache table *(first run/after cache configuration updates)*
|
||||
|
||||
docker-compose exec app python manage.py createcachetable
|
||||
|
||||
The app should now be locally available at
|
||||
[http://127.0.0.1:8000](http://127.0.0.1:8000). See
|
||||
[Docker's "Get Started" documentation](https://docs.docker.com/get-started/)
|
||||
|
|
|
@ -9,6 +9,7 @@ DATABASES = {
|
|||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
version: "3.7"
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
image: postgres:11 # pin postgres to a major version
|
||||
environment:
|
||||
- PGDATA=/db-data
|
||||
- POSTGRES_PASSWORD=postgres # has to correspond with POSTGRES_PASSWORD in APP
|
||||
volumes:
|
||||
- db:/db-data:rw
|
||||
app:
|
||||
|
@ -14,9 +15,12 @@ services:
|
|||
- DJANGO_SETTINGS_MODULE=babybuddy.settings.docker
|
||||
- SECRET_KEY=
|
||||
- TIME_ZONE=
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- DEBUG=False # Turn to False in production
|
||||
volumes:
|
||||
- media:/app/media:rw
|
||||
command: gunicorn -c /app/gunicorn.py babybuddy.wsgi
|
||||
# Sleep 5 seconds to allow the db to to come up;
|
||||
command: bash -c 'sleep 5 && python manage.py migrate --noinput && python manage.py createcachetable && gunicorn babybuddy.wsgi -b :8000 --log-level=info'
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
|
|
Loading…
Reference in New Issue