Skip to content

Commit

Permalink
Merge pull request #3 from digorgonzola/s3_backend
Browse files Browse the repository at this point in the history
S3 backend
  • Loading branch information
digorgonzola authored Nov 17, 2023
2 parents c063ed7 + bc31321 commit 5507646
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,12 @@
STATIC_ROOT = '/vol/web/static'

AUTH_USER_MODEL = 'core.User'

S3_STORAGE_BACKEND = bool(int(os.environ.get('S3_STORAGE_BACKEND', 1)))
if S3_STORAGE_BACKEND:
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

AWS_DEFAULT_ACL = 'public-read'
AWS_STORAGE_BUCKET_NAME = os.environ.get('S3_STORAGE_BUCKET_NAME')
AWS_S3_REGION_NAME = os.environ.get('S3_STORAGE_BUCKET_REGION', 'us-east-1')
AWS_QUERYSTRING_AUTH = False
12 changes: 11 additions & 1 deletion docker-compose-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ services:
- DB_PASS=supersecretpassword
- ALLOWED_HOSTS=*
- ALLOWED_CIDR_NETS=127.0.0.0/8
- S3_STORAGE_BACKEND=0
depends_on:
- db
db:
condition: service_healthy

proxy:
image: proxy:latest
depends_on:
- app
healthcheck:
test: ["CMD-SHELL", "curl -so /dev/null http://localhost:8000/ || exit 1"]
timeout: 10s
ports:
- "8000:8000"
volumes:
Expand All @@ -32,6 +37,11 @@ services:
- POSTGRES_DB=app
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=supersecretpassword
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

volumes:
static_data:
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ services:
- DB_USER=postgres
- DB_PASS=supersecretpassword
- DEBUG=1
- S3_STORAGE_BACKEND=0
depends_on:
- db
db:
condition: service_healthy

db:
image: postgres:10-alpine
environment:
- POSTGRES_DB=app
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=supersecretpassword
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
boto3>=1.12.0,<1.13.0
Django>=2.1.3,<2.2.0
djangorestframework>=3.9.0,<3.10.0
django-allow-cidr>=0.3.1,<0.4.0
django-storages>=1.9.1,<1.10.0
psycopg2>=2.7.5,<2.8.0
Pillow>=5.3.0,<5.4.0
uwsgi>=2.0.18,<2.1.0
Expand Down

0 comments on commit 5507646

Please sign in to comment.