X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server.ts;h=44e93d1a6102324d97703cc9462b89b434305de2;hb=8892e8cc63fcef1ce4952b6a8e2946d730c5e8bb;hp=e46ff85c7c214200a3b03b8d2de884151284ee49;hpb=01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index e46ff85c7..44e93d1a6 100644 --- a/server.ts +++ b/server.ts @@ -1,3 +1,6 @@ +// FIXME: https://github.com/nodejs/node/pull/16853 +require('tls').DEFAULT_ECDH_CURVE = 'auto' + import { isTestInstance } from './server/helpers/core-utils' if (isTestInstance()) { @@ -50,9 +53,13 @@ migrate() // ----------- PeerTube modules ----------- import { installApplication } from './server/initializers' -import { activitypubHttpJobScheduler, transcodingJobScheduler } from './server/lib/jobs' +import { Emailer } from './server/lib/emailer' +import { JobQueue } from './server/lib/job-queue' import { VideosPreviewCache } from './server/lib/cache' import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers' +import { Redis } from './server/lib/redis' +import { BadActorFollowScheduler } from './server/lib/schedulers/bad-actor-follow-scheduler' +import { RemoveOldJobsScheduler } from './server/lib/schedulers/remove-old-jobs-scheduler' // ----------- Command line ----------- @@ -78,7 +85,7 @@ if (isTestInstance()) { // For the logger app.use(morgan('combined', { - stream: { write: logger.info } + stream: { write: logger.info.bind(logger) } })) // For body requests app.use(bodyParser.json({ @@ -164,9 +171,20 @@ function onDatabaseInitDone () { .then(() => { // ----------- Make the server listening ----------- server.listen(port, () => { - VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.FILE_SIZE) - activitypubHttpJobScheduler.activate() - transcodingJobScheduler.activate() + // Emailer initialization and then job queue initialization + Emailer.Instance.init() + Emailer.Instance.checkConnectionOrDie() + .then(() => JobQueue.Instance.init()) + + // Caches initializations + VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.SIZE) + + // Enable Schedulers + BadActorFollowScheduler.Instance.enable() + RemoveOldJobsScheduler.Instance.enable() + + // Redis initialization + Redis.Instance.init() logger.info('Server listening on port %d', port) logger.info('Web server: %s', CONFIG.WEBSERVER.URL)