mirror of
https://github.com/penpot/penpot.git
synced 2025-06-08 04:21:38 +02:00
♻️ Integrate new storage subsystem.
This commit is contained in:
parent
3d88749976
commit
ab944fb9ae
48 changed files with 950 additions and 632 deletions
|
@ -16,7 +16,7 @@
|
|||
[integrant.core :as ig]))
|
||||
|
||||
;; Set value for all new threads bindings.
|
||||
(alter-var-root #'*assert* (constantly (:enable-asserts cfg/config)))
|
||||
(alter-var-root #'*assert* (constantly (:assets-enabled cfg/config)))
|
||||
|
||||
(derive :app.telemetry/server :app.http/server)
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
(defn build-system-config
|
||||
[config]
|
||||
(merge
|
||||
(d/deep-merge
|
||||
{:app.db/pool
|
||||
{:uri (:database-uri config)
|
||||
:username (:database-username config)
|
||||
|
@ -54,32 +54,13 @@
|
|||
:app.tokens/tokens
|
||||
{:secret-key (:secret-key config)}
|
||||
|
||||
:app.media-storage/storage
|
||||
{:media-directory (:media-directory config)
|
||||
:media-uri (:media-uri config)}
|
||||
|
||||
:app.storage/storage
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:backend (:storage-default-backend cfg/config :s3)
|
||||
:backends {:s3 (ig/ref :app.storage.s3/backend)
|
||||
:fs (ig/ref :app.storage.fs/backend)
|
||||
:db (ig/ref :app.storage.db/backend)}}
|
||||
|
||||
:app.storage/gc-task
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:storage (ig/ref :app.storage/storage)}
|
||||
|
||||
:app.storage.fs/backend
|
||||
{:directory (:storage-fs-directory cfg/config)
|
||||
:uri (:storage-fs-uri cfg/config)}
|
||||
|
||||
:app.storage.db/backend
|
||||
{:pool (ig/ref :app.db/pool)}
|
||||
|
||||
:app.storage.s3/backend
|
||||
{:region (:storage-s3-region cfg/config)
|
||||
:bucket (:storage-s3-bucket cfg/config)}
|
||||
|
||||
:app.storage/recheck-task
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:storage (ig/ref :app.storage/storage)}
|
||||
|
||||
:app.http.session/session
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
|
@ -106,7 +87,7 @@
|
|||
:session (ig/ref :app.http.session/session)
|
||||
:tokens (ig/ref :app.tokens/tokens)
|
||||
:metrics (ig/ref :app.metrics/metrics)
|
||||
:storage (ig/ref :app.media-storage/storage)
|
||||
:storage (ig/ref :app.storage/storage)
|
||||
:redis (ig/ref :app.redis/redis)}
|
||||
|
||||
:app.notifications/handler
|
||||
|
@ -157,10 +138,9 @@
|
|||
{:executor (ig/ref :app.worker/executor)
|
||||
:pool (ig/ref :app.db/pool)
|
||||
:schedule
|
||||
[;; TODO: pending to refactor
|
||||
;; {:id "file-media-gc"
|
||||
;; :cron #app/cron "0 0 0 */1 * ? *" ;; daily
|
||||
;; :fn (ig/ref :app.tasks.file-media-gc/handler)}
|
||||
[{:id "file-media-gc"
|
||||
:cron #app/cron "0 0 0 */1 * ? *" ;; daily
|
||||
:fn (ig/ref :app.tasks.file-media-gc/handler)}
|
||||
|
||||
{:id "file-xlog-gc"
|
||||
:cron #app/cron "0 0 0 */1 * ?" ;; daily
|
||||
|
@ -170,6 +150,10 @@
|
|||
:cron #app/cron "0 0 0 */1 * ?" ;; daily
|
||||
:fn (ig/ref :app.storage/gc-task)}
|
||||
|
||||
{:id "storage-recheck"
|
||||
:cron #app/cron "0 0 0 */1 * ?" ;; daily
|
||||
:fn (ig/ref :app.storage/recheck-task)}
|
||||
|
||||
{:id "tasks-gc"
|
||||
:cron #app/cron "0 0 0 */1 * ?" ;; daily
|
||||
:fn (ig/ref :app.tasks.tasks-gc/handler)}
|
||||
|
@ -185,14 +169,14 @@
|
|||
"delete-profile" (ig/ref :app.tasks.delete-profile/handler)}
|
||||
|
||||
:app.tasks.sendmail/handler
|
||||
{:host (:smtp-host config)
|
||||
:port (:smtp-port config)
|
||||
:ssl (:smtp-ssl config)
|
||||
:tls (:smtp-tls config)
|
||||
:enabled (:smtp-enabled config)
|
||||
:username (:smtp-username config)
|
||||
:password (:smtp-password config)
|
||||
:metrics (ig/ref :app.metrics/metrics)
|
||||
{:host (:smtp-host config)
|
||||
:port (:smtp-port config)
|
||||
:ssl (:smtp-ssl config)
|
||||
:tls (:smtp-tls config)
|
||||
:enabled (:smtp-enabled config)
|
||||
:username (:smtp-username config)
|
||||
:password (:smtp-password config)
|
||||
:metrics (ig/ref :app.metrics/metrics)
|
||||
:default-reply-to (:smtp-default-reply-to config)
|
||||
:default-from (:smtp-default-from config)}
|
||||
|
||||
|
@ -205,13 +189,20 @@
|
|||
{:pool (ig/ref :app.db/pool)
|
||||
:metrics (ig/ref :app.metrics/metrics)}
|
||||
|
||||
:app.tasks.delete-storage-object/handler
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:storage (ig/ref :app.storage/storage)
|
||||
:metrics (ig/ref :app.metrics/metrics)}
|
||||
|
||||
:app.tasks.delete-profile/handler
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:metrics (ig/ref :app.metrics/metrics)}
|
||||
|
||||
:app.tasks.file-media-gc/handler
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:metrics (ig/ref :app.metrics/metrics)}
|
||||
:metrics (ig/ref :app.metrics/metrics)
|
||||
:storage (ig/ref :app.storage/storage)
|
||||
:max-age (dt/duration {:hours 72})}
|
||||
|
||||
:app.tasks.file-xlog-gc/handler
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
|
@ -228,7 +219,28 @@
|
|||
|
||||
:app.error-reporter/instance
|
||||
{:uri (:error-report-webhook cfg/config)
|
||||
:executor (ig/ref :app.worker/executor)}}
|
||||
:executor (ig/ref :app.worker/executor)}
|
||||
|
||||
:app.storage/storage
|
||||
{:pool (ig/ref :app.db/pool)
|
||||
:executor (ig/ref :app.worker/executor)
|
||||
:backends {:s3 (ig/ref :app.storage.s3/backend)
|
||||
:fs (ig/ref :app.storage.fs/backend)
|
||||
:db (ig/ref :app.storage.db/backend)}}
|
||||
|
||||
:app.storage.s3/backend
|
||||
{:region (:storage-s3-region cfg/config)
|
||||
:bucket (:storage-s3-bucket cfg/config)}
|
||||
|
||||
:app.storage.fs/backend
|
||||
{:directory (:storage-fs-directory cfg/config)
|
||||
:uri (:storage-fs-uri cfg/config)}
|
||||
|
||||
:app.storage.db/backend
|
||||
{:pool (ig/ref :app.db/pool)}}
|
||||
|
||||
(let [backend (:storage-default-backend cfg/config :fs)]
|
||||
{:app.storage/storage {:backend backend}})
|
||||
|
||||
(when (:telemetry-server-enabled cfg/config)
|
||||
{:app.telemetry/handler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue