-// ----------- Create the certificates if they don't already exist -----------
-peertubeCrypto.createCertsIfNotExist(function (err) {
- if (err) throw err
- // Create/activate the webtorrent module
- webtorrent.create(function () {
- function cleanForExit () {
- utils.cleanForExit(webtorrent.app)
- }
-
- function exitGracefullyOnSignal () {
- process.exit(-1)
- }
-
- process.on('exit', cleanForExit)
- process.on('SIGINT', exitGracefullyOnSignal)
- process.on('SIGTERM', exitGracefullyOnSignal)
-
- // ----------- Make the server listening -----------
- server.listen(port, function () {
- // Activate the pool requests
- poolRequests.activate()
-
- videos.seedAllExisting(function () {
- logger.info('Seeded all the videos')
+// ----------- Run -----------
+
+function onDatabaseInitDone () {
+ const port = constants.CONFIG.LISTEN.PORT
+ // Run the migration scripts if needed
+ migrator.migrate(function (err) {
+ if (err) throw err
+
+ installer.installApplication(function (err) {
+ if (err) throw err
+
+ // ----------- Make the server listening -----------
+ server.listen(port, function () {
+ // Activate the communication with friends
+ friends.activate()
+