From bab4be2437b1976c5042e8d2a1ceb9877745f22a Mon Sep 17 00:00:00 2001 From: Scott Conway Date: Wed, 8 Sep 2021 19:48:24 -0400 Subject: [PATCH 1/3] added dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..efa9e8e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM alpine:latest + +CMD ["crond", "-f"] + +RUN echo -e "* * * * * cd /retropilot-server/; node -r esm worker.js\n* * * * * cd /retropilot-server; node -r esm server.js" > /etc/crontabs/root + +# Create the log file to be able to run tail +RUN touch /var/log/cron.log + +# Install dependencies +RUN apk add --no-cache git nodejs npm +# TODO maybe install nodejs-npm? + +# Install Retropilot +RUN git clone "https://github.com/florianbrede-ayet/retropilot-server.git"; cd retropilot-server; npm install + +# Install node packages, even though we should have it through retropilot... +RUN npm install -g esm + +# Remove build dependencies +RUN apk del git + From f86db032b809c83a15e34bf3e0cc533813558414 Mon Sep 17 00:00:00 2001 From: Scott Conway Date: Wed, 8 Sep 2021 19:48:41 -0400 Subject: [PATCH 2/3] `bunzip2 --version` exits with a non-zero status on latest build of Alpine Linux --- worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker.js b/worker.js index fe88d05..0b757a2 100644 --- a/worker.js +++ b/worker.js @@ -766,7 +766,7 @@ async function mainWorkerLoop() { // make sure bunzip2 is available try { - execSync(`bunzip2 --version`); + execSync(`bunzip2 --help`); } catch (exception) { logger.error("bunzip2 is not installed or not available in environment path") @@ -800,4 +800,4 @@ lockfile.lock('retropilot_worker.lock', { realpath: false, stale: 90000, update: }).catch((e) => { console.error(e) process.exit(); -}); \ No newline at end of file +}); From fcdc8fa5092e229a8c4ccf17243dfafcc1e760ce Mon Sep 17 00:00:00 2001 From: Florian Brede Date: Mon, 13 Sep 2021 02:00:22 +0200 Subject: [PATCH 3/3] FIX: incorrect null checks can lock up the worker --- worker.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/worker.js b/worker.js index 0b757a2..e50422e 100644 --- a/worker.js +++ b/worker.js @@ -443,7 +443,7 @@ async function updateSegments() { affectedDriveInitData={}; const drive_segments = await dbProtectedAll('SELECT * FROM drive_segments WHERE upload_complete = ? AND is_stalled = ? ORDER BY created ASC', false, false); - if (drive_segments!==null) { + if (drive_segments!=null) { for (var t=0; t