Add script & file for running production without docker

This commit is contained in:
advplyr 2021-09-19 19:22:35 -05:00
parent a63d76985c
commit c7b01165fd
6 changed files with 23 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "audiobookshelf-client",
"version": "1.0.0",
"version": "1.1.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -9,7 +9,7 @@
"start": "nuxt start",
"generate": "nuxt generate"
},
"author": "",
"author": "advplyr",
"license": "ISC",
"dependencies": {
"@nuxtjs/axios": "^5.13.6",

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "audiobookshelf",
"version": "1.1.7",
"version": "1.1.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -6,7 +6,8 @@
"scripts": {
"dev": "node index.js",
"start": "node index.js",
"prod": "NODE_ENV=production node index.js"
"client": "cd client && npm install --production && npm run generate",
"prod": "npm run client && npm install && node prod.js"
},
"author": "advplyr",
"license": "ISC",
@ -29,4 +30,4 @@
"watcher": "^1.2.0"
},
"devDependencies": {}
}
}

16
prod.js Normal file
View File

@ -0,0 +1,16 @@
const Path = require('path')
process.env.TOKEN_SECRET = '09f26e402586e2faa8da4c98a35f1b20d6b033c6097befa8be3486a829587fe2f90a832bd3ff9d42710a4da095a2ce285b009f0c3730cd9b8e1af3eb84df6611'
process.env.NODE_ENV = 'production'
const server = require('./server/Server')
global.appRoot = __dirname
const PORT = process.env.PORT || 3333
const CONFIG_PATH = process.env.CONFIG_PATH || Path.resolve('config')
const AUDIOBOOK_PATH = process.env.AUDIOBOOK_PATH || Path.resolve('audiobooks')
const METADATA_PATH = process.env.METADATA_PATH || Path.resolve('metadata')
console.log('Config', CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH)
const Server = new server(PORT, CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH)
Server.start()

View File

@ -1,6 +1,6 @@
const Ffmpeg = require('fluent-ffmpeg')
if (process.env.NODE_ENV !== 'production') {
if (process.env.FFMPEG_PATH) {
Ffmpeg.setFfmpegPath(process.env.FFMPEG_PATH)
}