Skip to content

Commit

Permalink
minio local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
BryonLewis committed Jan 4, 2024
1 parent c6d377e commit 1e106de
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ env:
DJANGO_CONFIGURATION: DevelopmentConfiguration
DJANGO_DATABASE_URL: postgres://postgres:postgres@postgres:5432/django
DJANGO_CELERY_BROKER_URL: amqp://rabbitmq:5672/
DJANGO_MINIO_STORAGE_ENDPOINT: minio:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey
DJANGO_STORAGE_BUCKET_NAME: django-storage
DJANGO_MINIO_STORAGE_MEDIA_URL: http://minio:9000/django-storage
jobs:
lint-python:
name: Lint Python
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ To do so, before running any `docker compose` commands, set any of the environme

The Django server must be informed about the changes:
* When running the "Develop with Docker" configuration, override the environment variables:
* `DJANGO_MINIO_STORAGE_MEDIA_URL`, using the port from `DOCKER_MINIO_PORT`.
* `DJANGO_MINIO_STORAGE_ENDPOINT`, using the port from `DOCKER_MINIO_PORT`.
* When running the "Develop Natively" configuration, override the environment variables:
* `DJANGO_DATABASE_URL`, using the port from `DOCKER_POSTGRES_PORT`
* `DJANGO_CELERY_BROKER_URL`, using the port from `DOCKER_RABBITMQ_PORT`
Expand Down
18 changes: 17 additions & 1 deletion bats_ai/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,23 @@ def DATABASES(self): # noqa


class DevelopmentConfiguration(BatsAiMixin, DevelopmentBaseConfiguration):
pass
SECRET_KEY = 'secretkey' # Dummy value for local development configuration

DEFAULT_FILE_STORAGE = 'minio_storage.storage.MinioMediaStorage'
MINIO_STORAGE_ENDPOINT = values.Value(
'localhost:9000',
)
MINIO_STORAGE_USE_HTTPS = values.BooleanValue(False)
MINIO_STORAGE_ACCESS_KEY = values.SecretValue()
MINIO_STORAGE_SECRET_KEY = values.SecretValue()
MINIO_STORAGE_MEDIA_BUCKET_NAME = values.Value(
environ_name='STORAGE_BUCKET_NAME',
environ_required=True,
)
MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True
MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY = 'READ_WRITE'
MINIO_STORAGE_MEDIA_USE_PRESIGNED = True
MINIO_STORAGE_MEDIA_URL = 'http://127.0.0.1:9000/rdwatch'


class TestingConfiguration(BatsAiMixin, TestingBaseConfiguration):
Expand Down
2 changes: 1 addition & 1 deletion dev/.env.docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY=minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY=minioSecretKey
DJANGO_STORAGE_BUCKET_NAME=django-storage
DJANGO_MINIO_STORAGE_MEDIA_URL=http://minio:9000/django-storage
DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000
DJANGO_CORS_ORIGIN_WHITELIST=http://localhost:3000
2 changes: 1 addition & 1 deletion dev/.env.docker-compose-native
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DJANGO_CONFIGURATION=DevelopmentConfiguration
DJANGO_DATABASE_URL=postgres://postgres:postgres@localhost:5432/django
DJANGO_CELERY_BROKER_URL=amqp://localhost:5672/
DJANGO_MINIO_STORAGE_ENDPOINT=localhost:9000
DJANGO_MINIO_STORAGE_ENDPOINT=minio:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY=minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY=minioSecretKey
DJANGO_STORAGE_BUCKET_NAME=django-storage
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'django-debug-toolbar',
'django-s3-file-field[minio]',
'django-click',
'django-minio-storage>=0.5.2',
'ipython',
'tox',
]
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ commands =

[testenv:check-migrations]
setenv =
DJANGO_CONFIGURATION = TestingConfiguration
DJANGO_CONFIGURATION = DevelopmentConfiguration
passenv =
DJANGO_CELERY_BROKER_URL
DJANGO_DATABASE_URL
DJANGO_MINIO_STORAGE_ACCESS_KEY
DJANGO_MINIO_STORAGE_ENDPOINT
DJANGO_MINIO_STORAGE_SECRET_KEY
DJANGO_STORAGE_BUCKET_NAME
extras =
dev
commands =
Expand Down

0 comments on commit 1e106de

Please sign in to comment.