Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] adding s3 local stack #1593

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"app:8000",
"elasticsearch:9200",
"postgres:5432",
"redis:6379"
"redis:6379",
"localstack:4566"
],

// Use 'postCreateCommand' to run commands after the container is created.
Expand Down
18 changes: 18 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ services:
ELASTICSEARCH_HOST: http://elasticsearch:9200
REDIS_HOST: redis
REDIS_PORT: 6379
AWS_S3_ENDPOINT_URL: http://localstack:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_STORAGE_BUCKET_NAME: local-researchhub-bucket
networks:
- researchhub

Expand Down Expand Up @@ -49,9 +53,23 @@ services:
networks:
- researchhub

localstack:
image: localstack/localstack:latest
environment:
- SERVICES=s3
- DEBUG=1
ports:
- "4566:4566"
- "4572:4572"
volumes:
- localstack-data:/var/lib/localstack
networks:
- researchhub

networks:
researchhub:
driver: bridge

volumes:
postgres-data:
localstack-data:
8 changes: 8 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ python manage.py migrate
python manage.py collectstatic --no-input
cd -

# Install AWS CLI
echo "Post create script adding aws cli."
pip install awscli

# Create S3 bucket in LocalStack
echo "Post create script creating local S3 bucket."
aws --endpoint-url=http://localstack:4566 s3 mb s3://local-researchhub-bucket

echo "Post create script complete."