X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.ts;h=44e93d1a6102324d97703cc9462b89b434305de2;hb=f6dc2fff48cbc3b95eb71d3af5eb60d3b689c2ad;hp=a89cdd69aad1621bfff5fe36096df567bb2f52c9;hpb=91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index a89cdd69a..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,8 +53,13 @@ migrate() // ----------- PeerTube modules ----------- import { installApplication } from './server/initializers' -import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib' +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 ----------- @@ -77,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({ @@ -150,7 +158,7 @@ app.use(function (req, res, next) { }) app.use(function (err, req, res, next) { - logger.error(err) + logger.error(err, err) res.sendStatus(err.status || 500) }) @@ -163,9 +171,20 @@ function onDatabaseInitDone () { .then(() => { // ----------- Make the server listening ----------- server.listen(port, () => { + // 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) - activitypubHttpJobScheduler.activate() - transcodingJobScheduler.activate() + + // 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)