Skip to content

Commit

Permalink
Persist published games (#30)
Browse files Browse the repository at this point in the history
game-db-updater app to persist games and game entities

- mqtt is run locally from dev container env
- local mqtt is accessible from Playnite test instance on another
machine
- mongodb is run locally from dev container env
- persist games and game entities as-is from messges
- includes persisting assets (binary files)

Closes #28
  • Loading branch information
andrew-codes authored Dec 11, 2023
2 parents da4e224 + cc106be commit d878f51
Show file tree
Hide file tree
Showing 242 changed files with 103,550 additions and 1,291 deletions.
4 changes: 0 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ RUN apt-get update
RUN apt-get install -y \
mosquitto \
mosquitto-clients
RUN mosquitto_passwd -b -c /etc/mosquitto/passwd local dev
RUN echo -e "allow_anonymous false \
password_file /etc/mosquitto/passwd" > /etc/mosquitto/conf.d/default.conf

# MongoDB
RUN apt-get install -y \
Expand All @@ -33,4 +30,3 @@ RUN apt-get update -y
RUN apt-get install -y \
mono-complete \
git-lfs

8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"johnuphoff.vscode-styled-sort",
"kisstkondoros.vscode-codemetrics",
"mikestead.dotenv",
"ms-dotnettools.csdevkit",
"ms-vscode.powershell",
"Orta.vscode-jest",
"paulmolluzzo.convert-css-in-js",
Expand All @@ -64,5 +63,8 @@
},
"remoteUser": "root",
"postCreateCommand": "bash -i -c './.devcontainer/post-create.sh'",
"postStartCommand": "./.devcontainer/post-start.sh"
}
"postStartCommand": "./.devcontainer/post-start.sh",
"appPort": [
"1883:18833"
]
}
22 changes: 18 additions & 4 deletions .devcontainer/post-start.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/usr/bin/env bash
set -e

cd "$(dirname "${BASH_SOURCE[0]}")"
git lfs install

mkdir -p ../.mongodb/data
set -o allexport
. $PWD/local.env
set +o allexport

git lfs install
mkdir -p .data/mongodb
docker stop playnite-web-db || true
docker container rm playnite-web-db || true
docker run --rm --name playnite-web-db -d \
-e MONGO_INITDB_ROOT_USERNAME=$MONGO_INITDB_ROOT_USERNAME \
-e MONGO_INITDB_ROOT_PASSWORD=$MONGO_INITDB_ROOT_PASSWORD \
-v $PWD/.data/mongodb:/data/db \
mongo:7.0.3-jammy

mosquitto_passwd -b -c /etc/mosquitto/passwd local dev
echo -e "allow_anonymous false
password_file /etc/mosquitto/passwd
listener 1883" > /etc/mosquitto/conf.d/default.conf
mosquitto -c /etc/mosquitto/conf.d/default.conf --daemon --verbose
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.mongodb
.data

.nx/cache

Expand All @@ -9,3 +9,5 @@
*.log
.vs
*.user
*.env
!local.env
5,959 changes: 5,296 additions & 663 deletions .pnp.cjs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"**/.yarn": true,
"**/.pnp.*": true
},
"dotnet.defaultSolution": "PlayniteWebPlugin.sln"
"dotnet.defaultSolution": "PlayniteWebPlugin.sln",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
Binary file modified .yarn/install-state.gz
Binary file not shown.
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/lib/tsc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const { existsSync } = require(`fs`)
const { createRequire } = require(`module`)
const { resolve } = require(`path`)

const relPnpApiPath = '../../../../.pnp.cjs'

const absPnpApiPath = resolve(__dirname, relPnpApiPath)
const absRequire = createRequire(absPnpApiPath)

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup()
}
}

// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`)
Loading

0 comments on commit d878f51

Please sign in to comment.