✨ Added documentation about new storage and how to use it
This commit is contained in:
+1
-4
@@ -53,10 +53,7 @@ class Settings(BaseSettings):
|
|||||||
free_storage_limit: int = 1074000000
|
free_storage_limit: int = 1074000000
|
||||||
|
|
||||||
# storage_backend
|
# storage_backend
|
||||||
storage_backend: str | None = "deta"
|
storage_backend: str | None = "local"
|
||||||
# if storage_backend == "deta":
|
|
||||||
deta_project_key: str | None
|
|
||||||
deta_project_id: str | None
|
|
||||||
|
|
||||||
# if storage_backend == "local":
|
# if storage_backend == "local":
|
||||||
storage_path: str | None
|
storage_path: str | None
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,7 @@ services:
|
|||||||
build: &build_cfg
|
build: &build_cfg
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: always
|
restart: &restart always
|
||||||
depends_on: &depends
|
depends_on: &depends
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
@@ -74,6 +74,7 @@ services:
|
|||||||
build: *build_cfg
|
build: *build_cfg
|
||||||
environment: *env_vars
|
environment: *env_vars
|
||||||
depends_on: *depends
|
depends_on: *depends
|
||||||
|
restart: *restart
|
||||||
command: arq classquiz.worker.WorkerSettings
|
command: arq classquiz.worker.WorkerSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,10 @@
|
|||||||
Start Caddy:
|
Start Caddy:
|
||||||
<pre><code>caddy run</code></pre>
|
<pre><code>caddy run</code></pre>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
Start the background-worker:
|
||||||
|
<pre><code>arq classquiz.worker.WorkerSettings</code></pre>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>If you're done developing: <code>./run_tests.sh -</code></p>
|
<p>If you're done developing: <code>./run_tests.sh -</code></p>
|
||||||
<p>If you want to run all the tests: <code>./run_tests.sh a</code></p>
|
<p>If you want to run all the tests: <code>./run_tests.sh a</code></p>
|
||||||
|
|||||||
@@ -96,18 +96,20 @@
|
|||||||
<h3>Storage Provider</h3>
|
<h3>Storage Provider</h3>
|
||||||
<p>
|
<p>
|
||||||
You'll have to set up a storage provider for some pictures (these getting imported from
|
You'll have to set up a storage provider for some pictures (these getting imported from
|
||||||
KAHOOT!). For now, you can use <a href="https://deta.sh">Deta</a> or the local filesystem.
|
Kahoot!). For now, you can use <a href="https://min.io/" target="_blank">Minio (S3)</a> or
|
||||||
Please note that I would <b>NOT</b> use the local file system because of
|
the local filesystem. Please not that I'd recommend Minio for larger instances, since it can
|
||||||
<a href="https://wiki.owasp.org/index.php/Path_Traversal">Path Traversals</a>. I tried to
|
be scaled and the media doesn't have to streamed through the (comparatively) slow ClassQuiz
|
||||||
prevent these attacks, but I really wouldn't trust it, because it's a regex! You'll have to
|
server. Now, that you've decided on a storage backend, you can set the
|
||||||
set the
|
<code>STORAGE_BACKEND</code>-environment-variable to either <code>s3</code> or
|
||||||
<code>STORAGE_BACKEND</code>-environment-variable to either <code>deta</code> or
|
<code>local</code>. If you ask yourself what happened with deta, I've decided to remove it,
|
||||||
<code>local</code>.
|
since the went all-in with their spaces and I think that hardly anyone used it anyway.
|
||||||
</p>
|
</p>
|
||||||
<h4>If you chose Deta...</h4>
|
<h4>If you chose Minio (S3)...</h4>
|
||||||
<p>
|
<p>
|
||||||
...you'll also have to set the <code>DETA_PROJECT_KEY</code> and the
|
...you'll also have to set the <code>S3_ACCESS_KEY</code>, <code>S3_SECRET_KEY</code> and
|
||||||
<code>DETA_PROJECT_ID</code>.
|
the
|
||||||
|
<code>S3_BASE_URL</code>. The <code>S3_BUCKET_NAME</code> can also be set, but defaults to
|
||||||
|
<code>classquiz</code>.
|
||||||
</p>
|
</p>
|
||||||
<h4>If you chose the local filesystem...</h4>
|
<h4>If you chose the local filesystem...</h4>
|
||||||
<p>
|
<p>
|
||||||
@@ -165,15 +167,15 @@ services:
|
|||||||
REDIS_URL: redis://redis:6379/0?decode_responses=True # don't change
|
REDIS_URL: redis://redis:6379/0?decode_responses=True # don't change
|
||||||
API_URL: http://api:80 # don't change
|
API_URL: http://api:80 # don't change
|
||||||
api:
|
api:
|
||||||
build:
|
build: &build_cfg
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: always
|
restart: &restart always
|
||||||
depends_on:
|
depends_on: &depends
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
environment:
|
environment: &env_vars
|
||||||
ROOT_ADDRESS: "https://classquiz.de" # Base-URL (change it)
|
ROOT_ADDRESS: "https://classquiz.de" # Base-URL (change it)
|
||||||
DB_URL: "postgresql://postgres:classquiz@db:5432/classquiz" # don't change
|
DB_URL: "postgresql://postgres:classquiz@db:5432/classquiz" # don't change
|
||||||
MAIL_ADDRESS: "classquiz@mawoka.eu" # Email-Address (change it)
|
MAIL_ADDRESS: "classquiz@mawoka.eu" # Email-Address (change it)
|
||||||
@@ -188,11 +190,13 @@ services:
|
|||||||
MEILISEARCH_URL: "http://meilisearch:7700" # don't change
|
MEILISEARCH_URL: "http://meilisearch:7700" # don't change
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES: 30 # don't change
|
ACCESS_TOKEN_EXPIRE_MINUTES: 30 # don't change
|
||||||
HCAPTCHA_KEY: "" # Private hCaptcha key for verification (change it)
|
HCAPTCHA_KEY: "" # Private hCaptcha key for verification (change it)
|
||||||
STORAGE_BACKEND: "deta" # MUST BE EITHER "deta" OR "local"
|
STORAGE_BACKEND: "local" # MUST BE EITHER "s3" OR "local"
|
||||||
|
FREE_STORAGE_LIMIT: "1074000000" # Free storage limit in bytes (default: 1GB)
|
||||||
|
|
||||||
# If STORAGE_BACKEND is "deta"
|
# If STORAGE_BACKEND is "s3"
|
||||||
DETA_PROJECT_KEY: "YOUR_DETA_PROJECT_KEY"
|
S3_ACCESS_KEY=YOUR_ACCESS_KEY
|
||||||
DETA_PROJECT_ID: "YOUR_DETA_PROJECT_ID"
|
S3_SECRET_KEY=YOUR_SECRET_KEY
|
||||||
|
S3_BASE_URL=YOUR_S3_BASE_URL
|
||||||
|
|
||||||
# If STORAGE_BACKEND is "local"
|
# If STORAGE_BACKEND is "local"
|
||||||
STORAGE_PATH: "/var/storage"
|
STORAGE_PATH: "/var/storage"
|
||||||
@@ -205,6 +209,8 @@ services:
|
|||||||
GITHUB_CLIENT_ID: # Your GitHub-Client ID, or leave it unset if you don't want it.
|
GITHUB_CLIENT_ID: # Your GitHub-Client ID, or leave it unset if you don't want it.
|
||||||
GITHUB_CLIENT_SECRET: # Your GitHub-Client Secret, or leave it unset if you don't want it.
|
GITHUB_CLIENT_SECRET: # Your GitHub-Client Secret, or leave it unset if you don't want it.
|
||||||
|
|
||||||
|
volumes: # Only needed if you chose the "local" storage-backend
|
||||||
|
- ./uploads:/var/storage
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
@@ -241,6 +247,14 @@ services:
|
|||||||
MEILI_NO_ANALYTICS: true
|
MEILI_NO_ANALYTICS: true
|
||||||
volumes:
|
volumes:
|
||||||
- meilisearch-data:/data.ms
|
- meilisearch-data:/data.ms
|
||||||
|
worker:
|
||||||
|
build: *build_cfg
|
||||||
|
environment: *env_vars
|
||||||
|
restart: *restart
|
||||||
|
depends_on: *depends
|
||||||
|
command: arq classquiz.worker.WorkerSettings
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
meilisearch-data:
|
meilisearch-data:
|
||||||
|
|||||||
Reference in New Issue
Block a user