Skip to content

Commit

Permalink
fix: back to minio for now
Browse files Browse the repository at this point in the history
  • Loading branch information
derkweijers committed Jul 31, 2023
1 parent fba77e5 commit 4153864
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
9 changes: 4 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
- POSTGRES_PASSWORD=${DB_PASSWORD}

app:
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi:${VERSION}
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi
restart: unless-stopped
command:
- /bin/sh
Expand All @@ -42,8 +42,6 @@ services:
networks:
- snapy
- nginx-proxy-manager_default
volumes:
- /srv/static/spaceflightnewsapi:/code/static
environment:
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=${DATABASE_URL}
Expand All @@ -52,12 +50,13 @@ services:
- LL_TOKEN=${LL_TOKEN}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- SENTRY_DSN=${SENTRY_DSN}
- USE_MINIO=${USE_MINIO}
depends_on:
database:
condition: service_healthy

beat:
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi:${VERSION}
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi
restart: unless-stopped
command: celery -A snapy beat -l INFO
networks:
Expand All @@ -74,7 +73,7 @@ services:


worker:
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi:${VERSION}
image: ghcr.io/spaceflightnewsapi/spaceflightnewsapi
restart: unless-stopped
command: celery -A snapy worker -l INFO
networks:
Expand Down
32 changes: 31 additions & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sentry-sdk = "^1.25.0"
psycopg2-binary = "^2.9.6"
dj-database-url = "^2.0.0"
whitenoise = "^6.5.0"
django-minio-backend = "^3.5.0"


[tool.poetry.group.dev.dependencies]
Expand Down
19 changes: 17 additions & 2 deletions snapy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,23 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
# STATIC_URL = "static/"
# STATIC_ROOT = BASE_DIR / "staticfiles"
USE_MINIO = os.getenv("USE_MINIO", False)
if USE_MINIO:
INSTALLED_APPS.append("django_minio_backend")
MINIO_ENDPOINT = os.getenv("MINIO_ENDPOINT", "http://localhost:9000")
MINIO_USE_HTTPS = True
MINIO_ACCESS_KEY = os.getenv("MINIO_ACCESS_KEY", "minioadmin")
MINIO_SECRET_KEY = os.getenv("MINIO_SECRET_KEY", "minioadmin")
MINIO_PUBLIC_BUCKETS = [os.getenv("MINIO_BUCKET_NAME", "static")]
MINIO_STATIC_FILES_BUCKET = os.getenv("MINIO_BUCKET_NAME", "static")
MINIO_BUCKET_CHECK_ON_SAVE = True

STATICFILES_STORAGE = "django_minio_backend.models.MinioBackendStatic"
STATIC_URL = "https://none/" # This is required but not used because we use STATICFILES_STORAGE.
else:
STATIC_URL = "static/"

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
Expand Down

0 comments on commit 4153864

Please sign in to comment.