Process Manager feature

pull/33/head
NGPixel 8 years ago
parent da549cd637
commit ae7373b937

@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Automated Upgrade / Re-install feature
- Automated process manager
## [v1.0-beta.5] - 2017-02-12
### Added

@ -102,8 +102,8 @@ module.exports = {
try {
fs.ensureDirSync(path.resolve(ROOTPATH, appconfig.paths.data))
fs.emptyDirSync(path.resolve(ROOTPATH, appconfig.paths.data))
fs.ensureDirSync(path.resolve(ROOTPATH, appconfig.paths.data, './cache'))
fs.emptyDirSync(path.resolve(ROOTPATH, appconfig.paths.data, './cache'))
fs.ensureDirSync(path.resolve(ROOTPATH, appconfig.paths.data, './thumbs'))
fs.ensureDirSync(path.resolve(ROOTPATH, appconfig.paths.data, './temp-upload'))

@ -4,7 +4,7 @@
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "server.js",
"scripts": {
"start": "node server",
"start": "node wiki start",
"dev": "gulp dev",
"test": "snyk test && standard && pug-lint ./views",
"snyk-protect": "snyk protect",
@ -40,6 +40,7 @@
"cheerio": "^0.22.0",
"child-process-promise": "^2.2.0",
"chokidar": "^1.6.0",
"commander": "^2.9.0",
"compression": "^1.6.2",
"connect-flash": "^0.1.1",
"connect-mongo": "^1.3.2",
@ -76,6 +77,7 @@
"moment-timezone": "^0.5.11",
"mongoose": "^4.8.1",
"multer": "^1.2.1",
"ora": "^1.1.0",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"passport-google-oauth20": "^1.0.0",

@ -0,0 +1,50 @@
'use strict'
const ora = require('ora')
const Promise = require('bluebird')
const pm2 = Promise.promisifyAll(require('pm2'))
const cmdr = require('commander')
cmdr.version('1.0.0')
cmdr.command('start')
.description('Start Wiki.js process')
.action(() => {
let spinner = ora('Initializing...').start()
pm2.connectAsync().then(() => {
return pm2.startAsync({
name: 'wiki',
script: 'server.js',
cwd: __dirname
}).then(() => {
spinner.succeed('Wiki.js has started successfully.')
}).finally(() => {
pm2.disconnect()
})
}).catch(err => {
console.error(err)
process.exit(1)
})
})
cmdr.command('stop')
.description('Stop Wiki.js process')
.action(() => {
let spinner = ora('Shutting down Wiki.js...').start()
pm2.connectAsync().then(() => {
return pm2.stopAsync('wiki').then(() => {
spinner.succeed('Wiki.js has stopped successfully.')
}).finally(() => {
pm2.disconnect()
})
}).catch(err => {
console.error(err)
process.exit(1)
})
})
cmdr.parse(process.argv)
if (!process.argv.slice(2).length) {
cmdr.help()
}
Loading…
Cancel
Save