Browse Source

feat: heroku compatibility

pull/880/head
Nick 5 years ago
parent
commit
9f58a08fcb
5 changed files with 9 additions and 24 deletions
  1. 2
      dev/build/Dockerfile
  2. 22
      dev/index.js
  3. 5
      package.json
  4. 2
      server/core/config.js
  5. 2
      server/core/db.js

2
dev/build/Dockerfile

@ -46,4 +46,6 @@ USER node
EXPOSE 3000
# HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://localhost/healthz
CMD ["node", "server"]

wiki.js → dev/index.js

@ -15,7 +15,7 @@ const init = {
const chokidar = require('chokidar')
global.DEV = true
global.WP_CONFIG = require('./dev/webpack/webpack.dev.js')
global.WP_CONFIG = require('./webpack/webpack.dev.js')
global.WP = webpack(global.WP_CONFIG)
global.WP_DEV = {
devMiddleware: require('webpack-dev-middleware')(global.WP, {
@ -25,7 +25,7 @@ const init = {
}
global.WP_DEV.devMiddleware.waitUntilValid(() => {
console.info(chalk.yellow.bold('>>> Starting Wiki.js in DEVELOPER mode...'))
require('./server')
require('../server')
process.stdin.setEncoding('utf8')
process.stdin.on('data', data => {
@ -84,22 +84,8 @@ const init = {
process.removeAllListeners('unhandledRejection')
process.removeAllListeners('uncaughtException')
require('./server')
require('../server')
}
}
require('yargs') // eslint-disable-line no-unused-expressions
.usage('Usage: node $0 <cmd> [args]')
.command({
command: 'dev',
desc: 'Start in Developer Mode',
handler: argv => {
init.dev()
}
})
.recommendCommands()
.demandCommand(1, 'You must provide one of the accepted commands above.')
.help()
.version()
.epilogue('Read the docs at https://docs-beta.requarks.io/dev')
.argv
init.dev()

5
package.json

@ -6,14 +6,11 @@
"main": "wiki.js",
"scripts": {
"start": "node server",
"dev": "node wiki dev",
"dev": "node dev",
"build": "webpack --profile --config dev/webpack/webpack.prod.js",
"watch": "webpack --config dev/webpack/webpack.dev.js",
"test": "eslint --format codeframe --ext .js,.vue . && pug-lint server/views && jest"
},
"bin": {
"wiki": "wiki.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Requarks/wiki.git"

2
server/core/config.js

@ -48,7 +48,7 @@ module.exports = {
appconfig = _.defaultsDeep(appconfig, appdata.defaults.config)
if (appconfig.port < 1) {
if (appconfig.port < 1 || process.env.HEROKU) {
appconfig.port = process.env.PORT || 80
}

2
server/core/db.js

@ -24,7 +24,7 @@ module.exports = {
let self = this
let dbClient = null
let dbConfig = (!_.isEmpty(process.env.WIKI_DB_CONNSTR)) ? process.env.WIKI_DB_CONNSTR : {
let dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
host: WIKI.config.db.host,
user: WIKI.config.db.user,
password: WIKI.config.db.pass,

Loading…
Cancel
Save