mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Changes to the requirements and debug option on run.js
This commit is contained in:
parent
2402ee5e15
commit
0b653aaba8
14
README.md
14
README.md
|
|
@ -86,12 +86,16 @@ Search filters at the bottom of this screen are self explanatory.
|
|||
|
||||
It is fairly easy to have *Rdio Scanner* up and running.
|
||||
|
||||
Ensure that your operating system is fully updated and that the prerequisites are installed:
|
||||
Ensure that your operating system is **fully updated** and that the prerequisites are met or installed:
|
||||
|
||||
* Minimum of **2 GB** of system memory
|
||||
* [Git v2.23.0 or higher](https://git-scm.com/downloads)
|
||||
* [Node.js v10.9.0 or higher](https://nodejs.org/en/download/)
|
||||
* [SQLite v3.30.0 or higher](https://www.sqlite.org/download.html)
|
||||
* [Node.js v10.9.0 or higher](https://nodejs.org/en/download/) (get it [here](https://github.com/nodesource/distributions) if your distro doesn't have the required package)
|
||||
* [npm v6.2.0 or higher](https://www.npmjs.com/get-npm)
|
||||
|
||||
Note that it may be possible to run *Rdio Scanner* on a system with less than 2 Gb of memory. However, the client portion will most probably fail to build when you first start *Rdio Scanner*. Try it at your own risk.
|
||||
|
||||
Then clone the *Rdio Scanner* code and run it:
|
||||
|
||||
```bash
|
||||
|
|
@ -114,7 +118,11 @@ Creating SQLITE database at /home/radio/rdio-scanner/server/database.sqlite... d
|
|||
Rdio Scanner is running at http://0.0.0.0:3000/
|
||||
```
|
||||
|
||||
Note that the first time you start *Rdio Scanner*, it will be longer to do so as it has to install required node modules and build the progressive web app.
|
||||
Note that the first time you start *Rdio Scanner*, it will be longer to do so as it has to install required node modules and build the progressive web app. If it fails at this point, you can rerun the following command for more information on the reasons for the failure.
|
||||
|
||||
```bash
|
||||
$ DEBUG=true node run.js
|
||||
```
|
||||
|
||||
A default configuration file `rdio-scanner/server/.env` will be created. A new random API key will be generated where it will have to be use in your upload scripts.
|
||||
|
||||
|
|
|
|||
45
run.js
45
run.js
|
|
@ -4,31 +4,34 @@ const childProcess = require('child_process');
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const clientPath = path.resolve(__dirname, 'client');
|
||||
const serverPath = path.resolve(__dirname, 'server');
|
||||
try {
|
||||
const stdio = `${!!process.env.DEBUG}` === 'true' ? 'inherit' : 'ignore';
|
||||
|
||||
const missingModules = {
|
||||
const clientPath = path.resolve(__dirname, 'client');
|
||||
const serverPath = path.resolve(__dirname, 'server');
|
||||
|
||||
const missingModules = {
|
||||
client: !fs.existsSync(path.resolve(clientPath, 'node_modules')),
|
||||
server: !fs.existsSync(path.resolve(serverPath, 'node_modules')),
|
||||
}
|
||||
}
|
||||
|
||||
if (missingModules.client || missingModules.server) {
|
||||
if (missingModules.client || missingModules.server) {
|
||||
process.stdout.write('Installing node modules...');
|
||||
|
||||
if (missingModules.client) {
|
||||
childProcess.execSync('npm install', { cwd: clientPath, stdio: ['ignore', 'ignore', 'pipe'] });
|
||||
childProcess.execSync('npm install', { cwd: clientPath, stdio });
|
||||
}
|
||||
|
||||
if (missingModules.server) {
|
||||
childProcess.execSync('npm install', { cwd: serverPath, stdio: ['ignore', 'ignore', 'pipe'] });
|
||||
childProcess.execSync('npm install', { cwd: serverPath, stdio });
|
||||
}
|
||||
|
||||
process.stdout.write(' done\n');
|
||||
}
|
||||
}
|
||||
|
||||
const envFile = path.resolve(serverPath, '.env');
|
||||
const envFile = path.resolve(serverPath, '.env');
|
||||
|
||||
if (!fs.existsSync(envFile)) {
|
||||
if (!fs.existsSync(envFile)) {
|
||||
const apiKey = require(`${serverPath}/node_modules/uuid/v4`)();
|
||||
|
||||
const data = [
|
||||
|
|
@ -48,24 +51,28 @@ if (!fs.existsSync(envFile)) {
|
|||
|
||||
process.stdout.write(`Default configuration created at ${envFile}\n`);
|
||||
process.stdout.write(`Make sure your upload scripts use this API key: ${apiKey}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.resolve(clientPath, 'dist/main.html'))) {
|
||||
if (!fs.existsSync(path.resolve(clientPath, 'dist/main.html'))) {
|
||||
process.stdout.write('Building client app...');
|
||||
childProcess.execSync('npm run build', { cwd: clientPath, stdio: ['ignore', 'ignore', 'pipe'] });
|
||||
childProcess.execSync('npm run build', { cwd: clientPath, stdio });
|
||||
process.stdout.write(' done\n');
|
||||
}
|
||||
}
|
||||
|
||||
require(path.resolve(serverPath, 'node_modules/dotenv')).config({ path: envFile });
|
||||
require(path.resolve(serverPath, 'node_modules/dotenv')).config({ path: envFile });
|
||||
|
||||
if (process.env.DB_DIALECT === 'sqlite') {
|
||||
if (process.env.DB_DIALECT === 'sqlite') {
|
||||
const dbFile = path.resolve(serverPath, process.env.DB_STORAGE || 'database.sqlite');
|
||||
|
||||
if (!fs.existsSync(dbFile)) {
|
||||
process.stdout.write(`Creating SQLITE database at ${dbFile}...`);
|
||||
childProcess.execSync('npm run migrate', { cwd: serverPath, stdio: ['ignore', 'ignore', 'pipe'] });
|
||||
childProcess.execSync('npm run migrate', { cwd: serverPath, stdio });
|
||||
process.stdout.write(' done\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
childProcess.execSync('node index.js', { cwd: serverPath, stdio: 'inherit' });
|
||||
childProcess.execSync('node index.js', { cwd: serverPath, stdio: 'inherit' });
|
||||
|
||||
} catch (error) {
|
||||
console.error('\n\nAn error has occured. Please re-run the command like this: \'DEBUG=true node run.js\'');
|
||||
}
|
||||
Loading…
Reference in a new issue