2016-11-20 20:04:52 +01:00
|
|
|
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
;;
|
2021-03-30 14:55:19 +02:00
|
|
|
;; Copyright (c) UXBOX Labs SL
|
2016-11-20 20:04:52 +01:00
|
|
|
|
2020-08-18 19:26:37 +02:00
|
|
|
(ns app.main
|
2020-01-23 17:53:26 +01:00
|
|
|
(:require
|
2022-06-30 15:11:41 +02:00
|
|
|
[app.auth.oidc]
|
2021-09-29 16:39:25 +02:00
|
|
|
[app.common.logging :as l]
|
2021-03-30 14:55:19 +02:00
|
|
|
[app.config :as cf]
|
2020-12-24 14:32:19 +01:00
|
|
|
[app.util.time :as dt]
|
2022-01-11 16:30:22 +01:00
|
|
|
[integrant.core :as ig])
|
|
|
|
(:gen-class))
|
2020-01-31 19:12:58 +01:00
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
(def system-config
|
|
|
|
{:app.db/pool
|
|
|
|
{:uri (cf/get :database-uri)
|
|
|
|
:username (cf/get :database-username)
|
|
|
|
:password (cf/get :database-password)
|
2022-01-27 14:02:37 +01:00
|
|
|
:read-only (cf/get :database-readonly false)
|
2021-03-30 14:55:19 +02:00
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:migrations (ig/ref :app.migrations/all)
|
2022-04-01 15:55:28 +02:00
|
|
|
:name :main
|
|
|
|
:min-size (cf/get :database-min-pool-size 0)
|
|
|
|
:max-size (cf/get :database-max-pool-size 30)}
|
2022-02-18 18:01:21 +01:00
|
|
|
|
|
|
|
;; Default thread pool for IO operations
|
|
|
|
[::default :app.worker/executor]
|
2022-02-28 12:07:21 +01:00
|
|
|
{:parallelism (cf/get :default-executor-parallelism 60)
|
2022-02-18 18:01:21 +01:00
|
|
|
:prefix :default}
|
|
|
|
|
2022-02-28 17:15:58 +01:00
|
|
|
;; Constrained thread pool. Should only be used from high resources
|
|
|
|
;; demanding operations.
|
2022-02-18 18:01:21 +01:00
|
|
|
[::blocking :app.worker/executor]
|
2022-02-28 17:15:58 +01:00
|
|
|
{:parallelism (cf/get :blocking-executor-parallelism 10)
|
2022-02-18 18:01:21 +01:00
|
|
|
:prefix :blocking}
|
|
|
|
|
|
|
|
;; Dedicated thread pool for backround tasks execution.
|
|
|
|
[::worker :app.worker/executor]
|
|
|
|
{:parallelism (cf/get :worker-executor-parallelism 10)
|
|
|
|
:prefix :worker}
|
|
|
|
|
2022-02-28 17:15:58 +01:00
|
|
|
:app.worker/scheduler
|
|
|
|
{:parallelism 1
|
|
|
|
:prefix :scheduler}
|
|
|
|
|
2022-02-28 15:25:17 +01:00
|
|
|
:app.worker/executors
|
|
|
|
{:default (ig/ref [::default :app.worker/executor])
|
|
|
|
:worker (ig/ref [::worker :app.worker/executor])
|
|
|
|
:blocking (ig/ref [::blocking :app.worker/executor])}
|
2022-02-18 18:01:21 +01:00
|
|
|
|
2022-02-28 15:25:17 +01:00
|
|
|
:app.worker/executors-monitor
|
|
|
|
{:metrics (ig/ref :app.metrics/metrics)
|
2022-02-28 17:15:58 +01:00
|
|
|
:scheduler (ig/ref :app.worker/scheduler)
|
2022-02-28 15:25:17 +01:00
|
|
|
:executors (ig/ref :app.worker/executors)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-12-28 00:04:58 +01:00
|
|
|
:app.migrations/migrations
|
|
|
|
{}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.metrics/metrics
|
2021-12-28 00:04:58 +01:00
|
|
|
{}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.migrations/all
|
|
|
|
{:main (ig/ref :app.migrations/migrations)}
|
|
|
|
|
|
|
|
:app.msgbus/msgbus
|
|
|
|
{:backend (cf/get :msgbus-backend :redis)
|
2022-03-18 12:36:42 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])
|
2021-03-30 14:55:19 +02:00
|
|
|
:redis-uri (cf/get :redis-uri)}
|
|
|
|
|
|
|
|
:app.tokens/tokens
|
2021-07-06 10:42:24 +02:00
|
|
|
{:keys (ig/ref :app.setup/keys)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2022-06-22 11:34:36 +02:00
|
|
|
:app.storage.tmp/cleaner
|
|
|
|
{:executor (ig/ref [::worker :app.worker/executor])
|
|
|
|
:scheduler (ig/ref :app.worker/scheduler)}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.storage/gc-deleted-task
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
2022-02-28 17:15:58 +01:00
|
|
|
:executor (ig/ref [::worker :app.worker/executor])
|
2021-03-30 14:55:19 +02:00
|
|
|
:min-age (dt/duration {:hours 2})}
|
|
|
|
|
|
|
|
:app.storage/gc-touched-task
|
2022-02-28 17:15:58 +01:00
|
|
|
{:pool (ig/ref :app.db/pool)}
|
|
|
|
|
|
|
|
:app.http/client
|
|
|
|
{:executor (ig/ref [::default :app.worker/executor])}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2022-02-28 17:15:58 +01:00
|
|
|
:app.http/session
|
2022-03-04 18:00:16 +01:00
|
|
|
{:store (ig/ref :app.http.session/store)}
|
|
|
|
|
|
|
|
:app.http.session/store
|
2022-02-18 18:01:21 +01:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
2022-02-28 17:15:58 +01:00
|
|
|
:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.http.session/gc-task
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:max-age (cf/get :http-session-idle-max-age)}
|
|
|
|
|
|
|
|
:app.http.session/updater
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
2022-02-18 18:01:21 +01:00
|
|
|
:executor (ig/ref [::worker :app.worker/executor])
|
2022-02-28 17:15:58 +01:00
|
|
|
:session (ig/ref :app.http/session)
|
2021-03-30 14:55:19 +02:00
|
|
|
:max-batch-age (cf/get :http-session-updater-batch-max-age)
|
|
|
|
:max-batch-size (cf/get :http-session-updater-batch-max-size)}
|
|
|
|
|
|
|
|
:app.http.awsns/handler
|
2022-02-28 17:15:58 +01:00
|
|
|
{:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:pool (ig/ref :app.db/pool)
|
|
|
|
:http-client (ig/ref :app.http/client)
|
|
|
|
:executor (ig/ref [::worker :app.worker/executor])}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.http/server
|
2022-02-18 18:01:21 +01:00
|
|
|
{:port (cf/get :http-server-port)
|
|
|
|
:host (cf/get :http-server-host)
|
|
|
|
:router (ig/ref :app.http/router)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
2022-03-11 09:50:49 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])
|
2022-04-01 13:33:56 +02:00
|
|
|
:io-threads (cf/get :http-server-io-threads)
|
|
|
|
:max-body-size (cf/get :http-server-max-body-size)
|
|
|
|
:max-multipart-body-size (cf/get :http-server-max-multipart-body-size)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2022-06-30 15:11:41 +02:00
|
|
|
:app.auth.ldap/provider
|
|
|
|
{:host (cf/get :ldap-host)
|
|
|
|
:port (cf/get :ldap-port)
|
|
|
|
:ssl (cf/get :ldap-ssl)
|
|
|
|
:tls (cf/get :ldap-starttls)
|
|
|
|
:query (cf/get :ldap-user-query)
|
|
|
|
:attrs-email (cf/get :ldap-attrs-email)
|
|
|
|
:attrs-fullname (cf/get :ldap-attrs-fullname)
|
|
|
|
:attrs-username (cf/get :ldap-attrs-username)
|
|
|
|
:base-dn (cf/get :ldap-base-dn)
|
|
|
|
:bind-dn (cf/get :ldap-bind-dn)
|
|
|
|
:bind-password (cf/get :ldap-bind-password)
|
|
|
|
:enabled? (contains? cf/flags :login-with-ldap)}
|
|
|
|
|
|
|
|
:app.auth.oidc/google-provider
|
|
|
|
{:enabled? (contains? cf/flags :login-with-google)
|
|
|
|
:client-id (cf/get :google-client-id)
|
|
|
|
:client-secret (cf/get :google-client-secret)}
|
|
|
|
|
|
|
|
:app.auth.oidc/github-provider
|
|
|
|
{:enabled? (contains? cf/flags :login-with-github)
|
|
|
|
:http-client (ig/ref :app.http/client)
|
|
|
|
:client-id (cf/get :github-client-id)
|
|
|
|
:client-secret (cf/get :github-client-secret)}
|
|
|
|
|
|
|
|
:app.auth.oidc/gitlab-provider
|
|
|
|
{:enabled? (contains? cf/flags :login-with-gitlab)
|
|
|
|
:base-uri (cf/get :gitlab-base-uri "https://gitlab.com")
|
|
|
|
:client-id (cf/get :gitlab-client-id)
|
|
|
|
:client-secret (cf/get :gitlab-client-secret)}
|
|
|
|
|
|
|
|
:app.auth.oidc/generic-provider
|
|
|
|
{:enabled? (contains? cf/flags :login-with-oidc)
|
|
|
|
:http-client (ig/ref :app.http/client)
|
|
|
|
|
|
|
|
:client-id (cf/get :oidc-client-id)
|
|
|
|
:client-secret (cf/get :oidc-client-secret)
|
|
|
|
|
|
|
|
:base-uri (cf/get :oidc-base-uri)
|
|
|
|
|
|
|
|
:token-uri (cf/get :oidc-token-uri)
|
|
|
|
:auth-uri (cf/get :oidc-auth-uri)
|
|
|
|
:user-uri (cf/get :oidc-user-uri)
|
|
|
|
|
|
|
|
:scopes (cf/get :oidc-scopes)
|
|
|
|
:roles-attr (cf/get :oidc-roles-attr)
|
|
|
|
:roles (cf/get :oidc-roles)}
|
|
|
|
|
|
|
|
:app.auth.oidc/routes
|
|
|
|
{:providers {:google (ig/ref :app.auth.oidc/google-provider)
|
|
|
|
:github (ig/ref :app.auth.oidc/github-provider)
|
|
|
|
:gitlab (ig/ref :app.auth.oidc/gitlab-provider)
|
|
|
|
:oidc (ig/ref :app.auth.oidc/generic-provider)}
|
|
|
|
:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:http-client (ig/ref :app.http/client)
|
|
|
|
:pool (ig/ref :app.db/pool)
|
|
|
|
:session (ig/ref :app.http/session)
|
|
|
|
:public-uri (cf/get :public-uri)
|
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.http/router
|
2022-02-28 17:15:58 +01:00
|
|
|
{:assets (ig/ref :app.http.assets/handlers)
|
|
|
|
:feedback (ig/ref :app.http.feedback/handler)
|
2022-03-04 18:00:16 +01:00
|
|
|
:session (ig/ref :app.http/session)
|
2022-02-28 17:15:58 +01:00
|
|
|
:awsns-handler (ig/ref :app.http.awsns/handler)
|
2022-06-22 11:42:23 +02:00
|
|
|
:debug-routes (ig/ref :app.http.debug/routes)
|
2022-06-30 15:11:41 +02:00
|
|
|
:oidc-routes (ig/ref :app.auth.oidc/routes)
|
2022-02-28 17:15:58 +01:00
|
|
|
:ws (ig/ref :app.http.websocket/handler)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:public-uri (cf/get :public-uri)
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
|
|
|
:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:audit-handler (ig/ref :app.loggers.audit/http-handler)
|
2022-06-30 15:11:41 +02:00
|
|
|
:rpc-routes (ig/ref :app.rpc/routes)
|
2022-07-13 14:29:34 +02:00
|
|
|
:doc-routes (ig/ref :app.rpc.doc/routes)
|
2022-02-28 17:15:58 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
2021-12-28 00:04:58 +01:00
|
|
|
|
2022-06-22 11:42:23 +02:00
|
|
|
:app.http.debug/routes
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:executor (ig/ref [::worker :app.worker/executor])
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
|
|
|
:session (ig/ref :app.http/session)}
|
2021-12-30 11:36:48 +01:00
|
|
|
|
2021-12-28 00:04:58 +01:00
|
|
|
:app.http.websocket/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:msgbus (ig/ref :app.msgbus/msgbus)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.http.assets/handlers
|
|
|
|
{:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:assets-path (cf/get :assets-path)
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
2022-02-18 18:01:21 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])
|
2021-03-30 14:55:19 +02:00
|
|
|
:cache-max-age (dt/duration {:hours 24})
|
|
|
|
:signature-max-age (dt/duration {:hours 24 :minutes 5})}
|
|
|
|
|
|
|
|
:app.http.feedback/handler
|
2022-02-23 11:49:25 +01:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2022-06-30 15:11:41 +02:00
|
|
|
:app.rpc/methods
|
2022-02-28 17:15:58 +01:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:session (ig/ref :app.http/session)
|
|
|
|
:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
|
|
|
:msgbus (ig/ref :app.msgbus/msgbus)
|
|
|
|
:public-uri (cf/get :public-uri)
|
|
|
|
:audit (ig/ref :app.loggers.audit/collector)
|
2022-06-30 15:11:41 +02:00
|
|
|
:ldap (ig/ref :app.auth.ldap/provider)
|
2022-02-28 17:15:58 +01:00
|
|
|
:http-client (ig/ref :app.http/client)
|
|
|
|
:executors (ig/ref :app.worker/executors)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2022-07-13 14:29:34 +02:00
|
|
|
:app.rpc.doc/routes
|
|
|
|
{:methods (ig/ref :app.rpc/methods)}
|
|
|
|
|
2022-06-30 15:11:41 +02:00
|
|
|
:app.rpc/routes
|
|
|
|
{:methods (ig/ref :app.rpc/methods)}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.worker/worker
|
2022-02-18 18:01:21 +01:00
|
|
|
{:executor (ig/ref [::worker :app.worker/executor])
|
2021-03-30 14:55:19 +02:00
|
|
|
:tasks (ig/ref :app.worker/registry)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:pool (ig/ref :app.db/pool)}
|
|
|
|
|
2022-02-28 17:15:58 +01:00
|
|
|
:app.worker/cron
|
2022-02-18 18:01:21 +01:00
|
|
|
{:executor (ig/ref [::worker :app.worker/executor])
|
2022-02-28 17:15:58 +01:00
|
|
|
:scheduler (ig/ref :app.worker/scheduler)
|
2021-03-30 14:55:19 +02:00
|
|
|
:tasks (ig/ref :app.worker/registry)
|
|
|
|
:pool (ig/ref :app.db/pool)
|
2022-02-28 17:15:58 +01:00
|
|
|
:entries
|
2021-06-14 11:50:26 +02:00
|
|
|
[{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2022-03-23 10:59:20 +01:00
|
|
|
:task :file-gc}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-06-02 13:13:25 +02:00
|
|
|
{:cron #app/cron "0 0 * * * ?" ;; hourly
|
2021-03-30 14:55:19 +02:00
|
|
|
:task :file-xlog-gc}
|
|
|
|
|
2021-06-07 16:51:09 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2021-03-30 14:55:19 +02:00
|
|
|
:task :storage-deleted-gc}
|
|
|
|
|
2021-06-07 16:51:09 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2021-03-30 14:55:19 +02:00
|
|
|
:task :storage-touched-gc}
|
|
|
|
|
2021-06-07 16:51:09 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2021-03-30 14:55:19 +02:00
|
|
|
:task :session-gc}
|
|
|
|
|
2021-06-07 16:51:09 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
|
|
|
:task :objects-gc}
|
|
|
|
|
2021-06-02 13:13:25 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2021-03-30 14:55:19 +02:00
|
|
|
:task :tasks-gc}
|
|
|
|
|
2022-04-04 17:09:58 +02:00
|
|
|
{:cron #app/cron "0 30 */3,23 * * ?"
|
|
|
|
:task :telemetry}
|
|
|
|
|
2021-06-14 11:50:26 +02:00
|
|
|
(when (cf/get :fdata-storage-backed)
|
|
|
|
{:cron #app/cron "0 0 * * * ?" ;; hourly
|
|
|
|
:task :file-offload})
|
|
|
|
|
2021-09-16 14:40:50 +02:00
|
|
|
(when (contains? cf/flags :audit-log-archive)
|
2022-02-15 11:06:13 +01:00
|
|
|
{:cron #app/cron "0 */5 * * * ?" ;; every 5m
|
2021-09-16 14:40:50 +02:00
|
|
|
:task :audit-log-archive})
|
2021-05-14 12:38:28 +02:00
|
|
|
|
2021-09-16 14:40:50 +02:00
|
|
|
(when (contains? cf/flags :audit-log-gc)
|
2021-09-29 11:06:50 +02:00
|
|
|
{:cron #app/cron "0 0 0 * * ?" ;; daily
|
2022-04-04 17:09:58 +02:00
|
|
|
:task :audit-log-gc})]}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.worker/registry
|
|
|
|
{:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:tasks
|
|
|
|
{:sendmail (ig/ref :app.emails/sendmail-handler)
|
2021-06-07 16:51:09 +02:00
|
|
|
:objects-gc (ig/ref :app.tasks.objects-gc/handler)
|
2022-03-23 10:59:20 +01:00
|
|
|
:file-gc (ig/ref :app.tasks.file-gc/handler)
|
2021-03-30 14:55:19 +02:00
|
|
|
:file-xlog-gc (ig/ref :app.tasks.file-xlog-gc/handler)
|
|
|
|
:storage-deleted-gc (ig/ref :app.storage/gc-deleted-task)
|
|
|
|
:storage-touched-gc (ig/ref :app.storage/gc-touched-task)
|
|
|
|
:tasks-gc (ig/ref :app.tasks.tasks-gc/handler)
|
|
|
|
:telemetry (ig/ref :app.tasks.telemetry/handler)
|
2021-05-14 12:38:28 +02:00
|
|
|
:session-gc (ig/ref :app.http.session/gc-task)
|
2021-06-14 11:50:26 +02:00
|
|
|
:file-offload (ig/ref :app.tasks.file-offload/handler)
|
2021-09-16 14:40:50 +02:00
|
|
|
:audit-log-archive (ig/ref :app.loggers.audit/archive-task)
|
|
|
|
:audit-log-gc (ig/ref :app.loggers.audit/gc-task)}}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.emails/sendmail-handler
|
|
|
|
{:host (cf/get :smtp-host)
|
|
|
|
:port (cf/get :smtp-port)
|
|
|
|
:ssl (cf/get :smtp-ssl)
|
|
|
|
:tls (cf/get :smtp-tls)
|
|
|
|
:username (cf/get :smtp-username)
|
|
|
|
:password (cf/get :smtp-password)
|
|
|
|
:metrics (ig/ref :app.metrics/metrics)
|
|
|
|
:default-reply-to (cf/get :smtp-default-reply-to)
|
|
|
|
:default-from (cf/get :smtp-default-from)}
|
|
|
|
|
|
|
|
:app.tasks.tasks-gc/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
2021-06-03 12:55:31 +02:00
|
|
|
:max-age cf/deletion-delay}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-06-07 16:51:09 +02:00
|
|
|
:app.tasks.objects-gc/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
|
|
|
:max-age cf/deletion-delay}
|
|
|
|
|
2022-03-23 10:59:20 +01:00
|
|
|
:app.tasks.file-gc/handler
|
2021-03-30 14:55:19 +02:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
2021-05-14 12:34:55 +02:00
|
|
|
:max-age cf/deletion-delay}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.tasks.file-xlog-gc/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
2021-06-10 15:41:19 +02:00
|
|
|
:max-age (dt/duration {:hours 72})}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-06-14 11:50:26 +02:00
|
|
|
:app.tasks.file-offload/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:max-age (dt/duration {:seconds 5})
|
|
|
|
:storage (ig/ref :app.storage/storage)
|
|
|
|
:backend (cf/get :fdata-storage-backed :fdata-s3)}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.tasks.telemetry/handler
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:version (:full cf/version)
|
|
|
|
:uri (cf/get :telemetry-uri)
|
2022-02-28 17:15:58 +01:00
|
|
|
:sprops (ig/ref :app.setup/props)
|
|
|
|
:http-client (ig/ref :app.http/client)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.srepl/server
|
|
|
|
{:port (cf/get :srepl-port)
|
|
|
|
:host (cf/get :srepl-host)}
|
|
|
|
|
|
|
|
:app.setup/props
|
2021-05-04 15:12:42 +02:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
|
|
|
:key (cf/get :secret-key)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-07-06 10:42:24 +02:00
|
|
|
:app.setup/keys
|
|
|
|
{:props (ig/ref :app.setup/props)}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.loggers.zmq/receiver
|
|
|
|
{:endpoint (cf/get :loggers-zmq-uri)}
|
|
|
|
|
2021-08-25 10:38:15 +02:00
|
|
|
:app.loggers.audit/http-handler
|
2021-09-16 14:40:50 +02:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
2022-02-28 17:15:58 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
2021-08-25 10:38:15 +02:00
|
|
|
|
2021-05-14 12:38:28 +02:00
|
|
|
:app.loggers.audit/collector
|
2021-09-16 14:40:50 +02:00
|
|
|
{:pool (ig/ref :app.db/pool)
|
2022-02-18 18:01:21 +01:00
|
|
|
:executor (ig/ref [::worker :app.worker/executor])}
|
2021-05-09 14:06:27 +02:00
|
|
|
|
2021-05-14 12:38:28 +02:00
|
|
|
:app.loggers.audit/archive-task
|
2022-02-28 17:15:58 +01:00
|
|
|
{:uri (cf/get :audit-log-archive-uri)
|
|
|
|
:tokens (ig/ref :app.tokens/tokens)
|
|
|
|
:pool (ig/ref :app.db/pool)
|
|
|
|
:http-client (ig/ref :app.http/client)}
|
2021-05-14 12:38:28 +02:00
|
|
|
|
2021-09-16 14:40:50 +02:00
|
|
|
:app.loggers.audit/gc-task
|
|
|
|
{:max-age (cf/get :audit-log-gc-max-age cf/deletion-delay)
|
2021-05-14 12:38:28 +02:00
|
|
|
:pool (ig/ref :app.db/pool)}
|
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.loggers.loki/reporter
|
2022-03-06 20:30:13 +01:00
|
|
|
{:uri (cf/get :loggers-loki-uri)
|
|
|
|
:receiver (ig/ref :app.loggers.zmq/receiver)
|
|
|
|
:http-client (ig/ref :app.http/client)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
|
|
|
:app.loggers.mattermost/reporter
|
2022-02-28 17:15:58 +01:00
|
|
|
{:uri (cf/get :error-report-webhook)
|
|
|
|
:receiver (ig/ref :app.loggers.zmq/receiver)
|
|
|
|
:http-client (ig/ref :app.http/client)}
|
2021-03-30 14:55:19 +02:00
|
|
|
|
2021-09-15 14:10:43 +02:00
|
|
|
:app.loggers.database/reporter
|
|
|
|
{:receiver (ig/ref :app.loggers.zmq/receiver)
|
|
|
|
:pool (ig/ref :app.db/pool)
|
2022-02-18 18:01:21 +01:00
|
|
|
:executor (ig/ref [::worker :app.worker/executor])}
|
2021-09-15 14:10:43 +02:00
|
|
|
|
2021-03-30 14:55:19 +02:00
|
|
|
:app.storage/storage
|
|
|
|
{:pool (ig/ref :app.db/pool)
|
2022-02-28 17:15:58 +01:00
|
|
|
:executor (ig/ref [::default :app.worker/executor])
|
|
|
|
|
2022-02-10 19:50:40 +01:00
|
|
|
:backends
|
|
|
|
{:assets-s3 (ig/ref [::assets :app.storage.s3/backend])
|
|
|
|
:assets-fs (ig/ref [::assets :app.storage.fs/backend])
|
2021-07-29 12:34:17 +02:00
|
|
|
|
2022-02-10 19:50:40 +01:00
|
|
|
;; keep this for backward compatibility
|
|
|
|
:s3 (ig/ref [::assets :app.storage.s3/backend])
|
|
|
|
:fs (ig/ref [::assets :app.storage.fs/backend])}}
|
2021-06-14 11:50:26 +02:00
|
|
|
|
|
|
|
[::assets :app.storage.s3/backend]
|
2022-02-12 12:14:55 +01:00
|
|
|
{:region (cf/get :storage-assets-s3-region)
|
|
|
|
:endpoint (cf/get :storage-assets-s3-endpoint)
|
2022-02-28 17:15:58 +01:00
|
|
|
:bucket (cf/get :storage-assets-s3-bucket)
|
|
|
|
:executor (ig/ref [::default :app.worker/executor])}
|
2021-06-14 11:50:26 +02:00
|
|
|
|
|
|
|
[::assets :app.storage.fs/backend]
|
|
|
|
{:directory (cf/get :storage-assets-fs-directory)}
|
2022-06-22 11:34:36 +02:00
|
|
|
})
|
2020-12-27 22:47:31 +01:00
|
|
|
|
2021-01-05 12:31:16 +01:00
|
|
|
(def system nil)
|
2020-12-24 14:32:19 +01:00
|
|
|
|
|
|
|
(defn start
|
|
|
|
[]
|
2021-03-30 14:55:19 +02:00
|
|
|
(ig/load-namespaces system-config)
|
|
|
|
(alter-var-root #'system (fn [sys]
|
|
|
|
(when sys (ig/halt! sys))
|
|
|
|
(-> system-config
|
|
|
|
(ig/prep)
|
|
|
|
(ig/init))))
|
2021-04-06 23:25:34 +02:00
|
|
|
(l/info :msg "welcome to penpot"
|
|
|
|
:version (:full cf/version)))
|
2020-12-24 14:32:19 +01:00
|
|
|
|
|
|
|
(defn stop
|
|
|
|
[]
|
|
|
|
(alter-var-root #'system (fn [sys]
|
|
|
|
(when sys (ig/halt! sys))
|
|
|
|
nil)))
|
2020-08-18 18:46:39 +02:00
|
|
|
|
|
|
|
(defn -main
|
2020-12-02 12:36:08 +01:00
|
|
|
[& _args]
|
2020-12-24 14:32:19 +01:00
|
|
|
(start))
|