Catch up to 0.6.0 (#217)

A few tweaks to catch my deployment on Fly.io and/or AWS up to 0.6.0. Mostly quality-of-life fixes
This commit is contained in:
Corry Haines 2022-12-22 12:47:13 -08:00 committed by GitHub
parent 3ebbb79bb5
commit 4657a1eece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View file

@ -2,7 +2,11 @@
*.sqlite3
.env
.git
.mypy_cache
.pre-commit-config.yaml
.venv
fly.toml
media
notes.md
venv
virtualenv

2
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.psql
*.pyc
*.sqlite3
.DS_Store
.idea/*
.venv
.vscode
@ -14,5 +15,6 @@
/static-collected
__pycache__/
api-test.*
fly.toml
notes.md
notes.py

View file

@ -176,7 +176,7 @@ To use a local directory, specify the media URL as ``local://``.
You must then also specify:
* ``TAKAHE_MEDIA_ROOT``, the file path to the local media Directory
* ``TAKAHE_MEDIA_URL``, a fully-qualified URL prefix that serves that directory
* ``TAKAHE_MEDIA_URL``, a fully-qualified URL prefix that serves that directory (must end in a slash)
The media directory must be read-write accessible from every single container
of Takahē - webserver and workers alike.

View file

@ -102,6 +102,10 @@ class Settings(BaseSettings):
MEDIA_ROOT: str = str(BASE_DIR / "media")
MEDIA_BACKEND: MediaBackendUrl | None = None
#: S3 ACL to apply to all media objects when MEDIA_BACKEND is set to S3. If using a CDN
#: and/or have public access blocked to buckets this will likely need to be 'private'
MEDIA_BACKEND_S3_ACL: str = "public-read"
#: Maximum filesize when uploading images. Increasing this may increase memory utilization
#: because all images with a dimension greater than 2000px are resized to meet that limit, which
#: is necessary for compatibility with Mastodons image proxy.
@ -370,7 +374,7 @@ if SETUP.MEDIA_BACKEND:
DEFAULT_FILE_STORAGE = "core.uploads.TakaheS3Storage"
AWS_STORAGE_BUCKET_NAME = parsed.path.lstrip("/")
AWS_QUERYSTRING_AUTH = False
AWS_DEFAULT_ACL = "public-read"
AWS_DEFAULT_ACL = SETUP.MEDIA_BACKEND_S3_ACL
if parsed.username is not None:
AWS_ACCESS_KEY_ID = parsed.username
AWS_SECRET_ACCESS_KEY = urllib.parse.unquote(parsed.password)