Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
Replace sqlite with psql
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Sokolov committed Mar 2, 2019
1 parent 49178cd commit 573b17f
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV PYTHONPATH=/app/postpost \
PYTHONFAULTHANDLER=1 \
PIP_NO_CACHE_DIR=off

RUN apk --no-cache add gcc build-base linux-headers jpeg-dev zlib-dev && \
RUN apk --no-cache add gcc build-base linux-headers jpeg-dev zlib-dev postgresql-dev musl-dev && \
pip install pipenv

WORKDIR /app
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pyuploadcare = "*"
django-filter = "*"
uwsgi = "*"
typing-extensions = "*"
psycopg2-binary = "*"

[requires]
python_version = "3.6"
176 changes: 105 additions & 71 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ services:
ports:
- 8000:8000
env_file: .env
volumes:
- /root/db.sqlite3:/app/postpost/db.sqlite3
depends_on:
- celery
- redis
- db

redis:
image: redis:alpine
Expand All @@ -25,6 +23,7 @@ services:
command: sh /app/wait-for.sh api:8000 -- pipenv run celery -A main worker -B
depends_on:
- redis
- db

frontend:
container_name: postpost_frontend
Expand All @@ -40,5 +39,11 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30

db:
image: postgres:alpine
volumes:
- postgres_data:/var/lib/postgresql/data/

volumes:
redis_data:
postgres_data:
7 changes: 5 additions & 2 deletions postpost/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
},
}

Expand Down

0 comments on commit 573b17f

Please sign in to comment.