Adding some more instructions on how to install. Fixed an issue with the SqlLite directory not being created. Added a .env file for configuration.

This commit is contained in:
Tim Pilius
2022-12-29 14:36:19 -05:00
parent ab83066d8d
commit 34ce99abd0
6 changed files with 36 additions and 6 deletions

1
.env.example Normal file
View File

@@ -0,0 +1 @@
logFileLocation=/mnt/example/path/to/lancache/logs/access.log

View File

@@ -1,12 +1,28 @@
# lancache-ui-service
Backend service for lancache-ui frontend. Implements log monitor, GQL, and DB caching
# Install dependencies
```
## Install dependencies
```bash
# Installing NodeJS via Node Version Manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# Installing NodeJS
nvm install v18.12.1
# Install PNPM
curl -fsSL https://get.pnpm.io/install.sh | sh -
# Install project dependencies
pnpm install
```
# Start service
## Configure
Rename `.env.example` to `.env`, and point `logFileLocation` to point to your Lancache's `access.log`
## Start service
```
pnpm start
```

View File

@@ -21,6 +21,7 @@
"@graphql-tools/schema": "^9.0.4",
"@graphql-yoga/node": "^2.13.13",
"better-sqlite3": "^7.6.2",
"dotenv": "^16.0.3",
"fastq": "^1.13.0",
"graphql": "^16.6.0",
"phin": "^3.6.1"

7
pnpm-lock.yaml generated
View File

@@ -6,6 +6,7 @@ specifiers:
'@types/node': 18.7.19
better-sqlite3: ^7.6.2
cross-env: 7.0.3
dotenv: ^16.0.3
fastq: ^1.13.0
graphql: ^16.6.0
phin: ^3.6.1
@@ -17,6 +18,7 @@ dependencies:
'@graphql-tools/schema': 9.0.4_graphql@16.6.0
'@graphql-yoga/node': 2.13.13_graphql@16.6.0
better-sqlite3: 7.6.2
dotenv: 16.0.3
fastq: 1.13.0
graphql: 16.6.0
phin: 3.6.1
@@ -436,6 +438,11 @@ packages:
engines: {node: '>=0.3.1'}
dev: true
/dotenv/16.0.3:
resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==}
engines: {node: '>=12'}
dev: false
/dset/3.1.2:
resolution: {integrity: sha512-g/M9sqy3oHe477Ar4voQxWtaPIFw1jTdKZuomOjhCcBx9nHUNn0pu6NopuFFrTh/TRZIKEj+76vLWFu9BNKk+Q==}
engines: {node: '>=4'}

View File

@@ -1,6 +1,10 @@
'use strict'
const fs = require('fs')
const sqlite3 = require('better-sqlite3')
if(!fs.existsSync("data")) {
fs.mkdirSync("data")
}
const db = new sqlite3('data/gameinfo.db', /*{ verbose: console.log }*/)
module.exports = class database {

View File

@@ -6,11 +6,12 @@ import logtail from './lib/logtail.js'
import chunkInfo from './lib/chunkInfo.js'
import stats from './stats.js'
import dotenv from 'dotenv'
dotenv.config()
const pubSub = createPubSub()
// FIXME: Use a .env file + docker environment variable for log file location
const logFileLocation = '/run/user/1000/gvfs/sftp:host=10.0.1.101,user=root/mnt/user/appdata/lancache/logs/access.log'
const tailInstance = new logtail(logFileLocation, false)
const tailInstance = new logtail(process.env.logFileLocation, false)
chunkInfo.init()
// stats.init(pubSub)