From c63162eb282d70eb0b47fb3b9ab5ed24cc8d83f8 Mon Sep 17 00:00:00 2001 From: Matthew Lopez <73856503+MatthewL246@users.noreply.github.com> Date: Mon, 22 Jul 2024 22:42:16 -0400 Subject: [PATCH] Update submodules with upstream Dockerization PRs --- compose.yml | 2 +- config/juxtaposition-config.js | 1 + environment/juxtaposition-ui.env | 3 +- .../BOSS/dockerfile-enable-debugging.patch | 10 ++ patches/BOSS/dockerize.patch | 64 --------- patches/BOSS/exit-on-sigterm.patch | 12 -- patches/BOSS/make-boss-keys-optional.patch | 23 ---- patches/BOSS/make-fs-extra-dependency.patch | 130 ------------------ .../account/dockerfile-enable-debugging.patch | 10 ++ .../dockerfile-enable-debugging.patch | 10 ++ .../juxtaposition-ui/dockerfile-update.patch | 27 ---- .../juxtaposition-ui/exit-on-sigterm.patch | 23 ---- .../juxtaposition-ui/fix-mongoose-uri.patch | 21 --- .../redis-create-client-with-url.patch | 13 -- ...stead-of-json-with-module-alias-hack.patch | 81 +++++++++-- .../dockerfile-enable-debugging.patch | 10 ++ patches/miiverse-api/dockerfile-update.patch | 75 ---------- patches/miiverse-api/exit-on-sigterm.patch | 19 --- .../website/dockerfile-enable-debugging.patch | 10 ++ patches/website/dockerize.patch | 26 ---- patches/website/exit-on-sigterm.patch | 12 -- repos/BOSS | 2 +- repos/juxtaposition-ui | 2 +- repos/miiverse-api | 2 +- repos/website | 2 +- 25 files changed, 126 insertions(+), 464 deletions(-) create mode 100644 patches/BOSS/dockerfile-enable-debugging.patch delete mode 100644 patches/BOSS/dockerize.patch delete mode 100644 patches/BOSS/exit-on-sigterm.patch delete mode 100644 patches/BOSS/make-boss-keys-optional.patch delete mode 100644 patches/BOSS/make-fs-extra-dependency.patch create mode 100644 patches/account/dockerfile-enable-debugging.patch create mode 100644 patches/juxtaposition-ui/dockerfile-enable-debugging.patch delete mode 100644 patches/juxtaposition-ui/dockerfile-update.patch delete mode 100644 patches/juxtaposition-ui/exit-on-sigterm.patch delete mode 100644 patches/juxtaposition-ui/fix-mongoose-uri.patch delete mode 100644 patches/juxtaposition-ui/redis-create-client-with-url.patch create mode 100644 patches/miiverse-api/dockerfile-enable-debugging.patch delete mode 100644 patches/miiverse-api/dockerfile-update.patch delete mode 100644 patches/miiverse-api/exit-on-sigterm.patch create mode 100644 patches/website/dockerfile-enable-debugging.patch delete mode 100644 patches/website/dockerize.patch delete mode 100644 patches/website/exit-on-sigterm.patch diff --git a/compose.yml b/compose.yml index 955f3c3..85e2cac 100644 --- a/compose.yml +++ b/compose.yml @@ -280,7 +280,7 @@ services: target: /app/logs/ - type: bind source: ./config/website-config.json - target: /app/config.json + target: /home/node/app/config.json read_only: true networks: internal: diff --git a/config/juxtaposition-config.js b/config/juxtaposition-config.js index f8ba9f6..71fcd21 100644 --- a/config/juxtaposition-config.js +++ b/config/juxtaposition-config.js @@ -9,6 +9,7 @@ module.exports = JSON.parse( server_environment: process.env.JUXT_CONFIG_SERVER_ENVIRONMENT, mongoose: { uri: process.env.JUXT_CONFIG_MONGODB_URI, + database: process.env.JUXT_CONFIG_MONGODB_DATABASE, options: { useNewUrlParser: true, useUnifiedTopology: true, diff --git a/environment/juxtaposition-ui.env b/environment/juxtaposition-ui.env index 73a516b..51e5699 100644 --- a/environment/juxtaposition-ui.env +++ b/environment/juxtaposition-ui.env @@ -1,5 +1,6 @@ JUXT_CONFIG_HTTP_PORT=8080 -JUXT_CONFIG_MONGODB_URI=mongodb://mongodb:27017/pretendo_miiverse?replicaSet=rs +JUXT_CONFIG_MONGODB_URI=mongodb://mongodb:27017 +JUXT_CONFIG_MONGODB_DATABASE=pretendo_miiverse?replicaSet=rs JUXT_CONFIG_SERVER_ENVIRONMENT=prod JUXT_CONFIG_CDN_DOMAIN= JUXT_CONFIG_MII_IMAGE_CDN=mii.olv.pretendo.cc diff --git a/patches/BOSS/dockerfile-enable-debugging.patch b/patches/BOSS/dockerfile-enable-debugging.patch new file mode 100644 index 0000000..767d8ad --- /dev/null +++ b/patches/BOSS/dockerfile-enable-debugging.patch @@ -0,0 +1,10 @@ +diff --git i/Dockerfile w/Dockerfile +index 53811ab..1a5b1a9 100644 +--- i/Dockerfile ++++ w/Dockerfile +@@ -44,4 +44,4 @@ COPY package.json . + COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules + COPY --from=build ${app_dir}/dist ${app_dir}/dist + +-CMD ["node", "."] ++CMD ["node", "--inspect=0.0.0.0:9233", "."] diff --git a/patches/BOSS/dockerize.patch b/patches/BOSS/dockerize.patch deleted file mode 100644 index 827ed62..0000000 --- a/patches/BOSS/dockerize.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git c/.dockerignore i/.dockerignore -new file mode 100644 -index 0000000..19cdd91 ---- /dev/null -+++ i/.dockerignore -@@ -0,0 +1,4 @@ -+.git -+node_modules -+dist -+logs -diff --git c/Dockerfile i/Dockerfile -new file mode 100644 -index 0000000..25e1b0a ---- /dev/null -+++ i/Dockerfile -@@ -0,0 +1,48 @@ -+# syntax=docker/dockerfile:1 -+ -+ARG app_dir="/home/node/app" -+ -+ -+# * Base Node.js image -+FROM node:20-alpine AS base -+ARG app_dir -+WORKDIR ${app_dir} -+ -+ -+# * Installing production dependencies -+FROM base AS dependencies -+ -+RUN --mount=type=bind,source=package.json,target=package.json \ -+ --mount=type=bind,source=package-lock.json,target=package-lock.json \ -+ --mount=type=cache,target=/root/.npm \ -+ npm ci --omit=dev -+ -+ -+# * Installing development dependencies and building the application -+FROM base AS build -+ -+RUN --mount=type=bind,source=package.json,target=package.json \ -+ --mount=type=bind,source=package-lock.json,target=package-lock.json \ -+ --mount=type=cache,target=/root/.npm \ -+ npm ci -+ -+COPY . . -+RUN npm run build -+ -+ -+# * Running the final application -+FROM base AS final -+ARG app_dir -+ -+RUN mkdir -p ${app_dir}/logs -+RUN chown node:node ${app_dir}/logs -+ -+ENV NODE_ENV production -+USER node -+ -+COPY package.json . -+ -+COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules -+COPY --from=build ${app_dir}/dist ${app_dir}/dist -+ -+CMD ["node", "."] diff --git a/patches/BOSS/exit-on-sigterm.patch b/patches/BOSS/exit-on-sigterm.patch deleted file mode 100644 index 359836e..0000000 --- a/patches/BOSS/exit-on-sigterm.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git i/src/server.ts w/src/server.ts -index 5db5542..f4c1d47 100644 ---- i/src/server.ts -+++ w/src/server.ts -@@ -1,4 +1,7 @@ - process.title = 'Pretendo - BOSS'; -+process.on('SIGTERM', () => { -+ process.exit(0); -+}); - - import express from 'express'; - import morgan from 'morgan'; diff --git a/patches/BOSS/make-boss-keys-optional.patch b/patches/BOSS/make-boss-keys-optional.patch deleted file mode 100644 index 9843270..0000000 --- a/patches/BOSS/make-boss-keys-optional.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git i/src/config-manager.ts w/src/config-manager.ts -index b027e54..fa5284e 100644 ---- i/src/config-manager.ts -+++ w/src/config-manager.ts -@@ -83,15 +83,15 @@ if (!config.http.port) { - } - - if (md5(config.crypto.wup.aes_key) !== BOSS_WIIU_AES_KEY_MD5_HASH) { -- errors.push('Invalid BOSS WiiU AES key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable'); -+ warnings.push('Invalid BOSS WiiU AES key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable'); - } - - if (md5(config.crypto.wup.hmac_key) !== BOSS_WIIU_HMAC_KEY_MD5_HASH) { -- errors.push('Invalid BOSS WiiU HMAC key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable'); -+ warnings.push('Invalid BOSS WiiU HMAC key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable'); - } - - if (md5(config.crypto.ctr.aes_key) !== BOSS_3DS_AES_KEY_MD5_HASH) { -- errors.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable'); -+ warnings.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable'); - } - - if (!config.grpc.boss.address) { diff --git a/patches/BOSS/make-fs-extra-dependency.patch b/patches/BOSS/make-fs-extra-dependency.patch deleted file mode 100644 index 7127f30..0000000 --- a/patches/BOSS/make-fs-extra-dependency.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff --git i/package-lock.json w/package-lock.json -index f72209d..00d6594 100644 ---- i/package-lock.json -+++ w/package-lock.json -@@ -20,6 +20,7 @@ - "dotenv": "^10.0.0", - "express": "^4.17.1", - "express-subdomain": "^1.0.5", -+ "fs-extra": "^11.2.0", - "moment": "^2.29.4", - "mongoose": "^7.4.3", - "morgan": "^1.10.0", -@@ -36,7 +37,6 @@ - "@typescript-eslint/parser": "^6.4.0", - "axios": "^1.6.2", - "eslint": "^8.47.0", -- "fs-extra": "^10.1.0", - "tsc-alias": "^1.8.7", - "typescript": "^5.1.6", - "xmlbuilder2": "^3.0.2" -@@ -3458,17 +3458,16 @@ - } - }, - "node_modules/fs-extra": { -- "version": "10.1.0", -- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", -- "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", -- "dev": true, -+ "version": "11.2.0", -+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", -+ "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { -- "node": ">=12" -+ "node": ">=14.14" - } - }, - "node_modules/fs-minipass": { -@@ -3599,8 +3598,7 @@ - "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", -- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", -- "dev": true -+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" - }, - "node_modules/graphemer": { - "version": "1.4.0", -@@ -3855,7 +3853,6 @@ - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", -- "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, -@@ -5211,7 +5208,6 @@ - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", -- "dev": true, - "engines": { - "node": ">= 10.0.0" - } -@@ -8071,10 +8067,9 @@ - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" - }, - "fs-extra": { -- "version": "10.1.0", -- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", -- "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", -- "dev": true, -+ "version": "11.2.0", -+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", -+ "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", -@@ -8172,8 +8167,7 @@ - "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", -- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", -- "dev": true -+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" - }, - "graphemer": { - "version": "1.4.0", -@@ -8357,7 +8351,6 @@ - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", -- "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" -@@ -9317,8 +9310,7 @@ - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", -- "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", -- "dev": true -+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" - }, - "unpipe": { - "version": "1.0.0", -diff --git i/package.json w/package.json -index 0e95ff9..24a694b 100644 ---- i/package.json -+++ w/package.json -@@ -24,6 +24,7 @@ - "dotenv": "^10.0.0", - "express": "^4.17.1", - "express-subdomain": "^1.0.5", -+ "fs-extra": "^11.2.0", - "moment": "^2.29.4", - "mongoose": "^7.4.3", - "morgan": "^1.10.0", -@@ -40,7 +41,6 @@ - "@typescript-eslint/parser": "^6.4.0", - "axios": "^1.6.2", - "eslint": "^8.47.0", -- "fs-extra": "^10.1.0", - "tsc-alias": "^1.8.7", - "typescript": "^5.1.6", - "xmlbuilder2": "^3.0.2" diff --git a/patches/account/dockerfile-enable-debugging.patch b/patches/account/dockerfile-enable-debugging.patch new file mode 100644 index 0000000..5a9ce27 --- /dev/null +++ b/patches/account/dockerfile-enable-debugging.patch @@ -0,0 +1,10 @@ +diff --git i/Dockerfile w/Dockerfile +index 53811ab..a141e8c 100644 +--- i/Dockerfile ++++ w/Dockerfile +@@ -44,4 +44,4 @@ COPY package.json . + COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules + COPY --from=build ${app_dir}/dist ${app_dir}/dist + +-CMD ["node", "."] ++CMD ["node", "--inspect=0.0.0.0:9229", "."] diff --git a/patches/juxtaposition-ui/dockerfile-enable-debugging.patch b/patches/juxtaposition-ui/dockerfile-enable-debugging.patch new file mode 100644 index 0000000..29c7315 --- /dev/null +++ b/patches/juxtaposition-ui/dockerfile-enable-debugging.patch @@ -0,0 +1,10 @@ +diff --git i/Dockerfile w/Dockerfile +index 7f2cada..b989512 100644 +--- i/Dockerfile ++++ w/Dockerfile +@@ -49,4 +49,4 @@ COPY --from=build ${app_dir} ${app_dir} + # TODO: change back after TypeScript migration + #COPY --from=build ${app_dir}/dist ${app_dir}/dist + +-CMD ["node", "."] ++CMD ["node", "--inspect=0.0.0.0:9232", "."] diff --git a/patches/juxtaposition-ui/dockerfile-update.patch b/patches/juxtaposition-ui/dockerfile-update.patch deleted file mode 100644 index 8dbba5d..0000000 --- a/patches/juxtaposition-ui/dockerfile-update.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git i/Dockerfile w/Dockerfile -index be1b7af..9340a30 100644 ---- i/Dockerfile -+++ w/Dockerfile -@@ -1,15 +1,17 @@ --FROM node:18-alpine -+# https://github.com/nodejs/docker-node/issues/2009 -+FROM node:18-alpine3.18 - --RUN apk add --no-cache python3 make gcc g++ - WORKDIR /app - - COPY "docker/entrypoint.sh" ./ - - COPY package*.json ./ -+# For the config.js hack -+RUN npm install module-alias - RUN npm install - - COPY . ./ -+# There is an npm run build task in the package.json, and it runs tsc, but there -+# is no TypeScript at all in the source code. Weird. - --VOLUME [ "/app/config.json", "/app/certs" ] -- --CMD ["sh", "entrypoint.sh"] -+CMD ["node", "--inspect=0.0.0.0:9232", "./src/server.js"] diff --git a/patches/juxtaposition-ui/exit-on-sigterm.patch b/patches/juxtaposition-ui/exit-on-sigterm.patch deleted file mode 100644 index 3f3ee2f..0000000 --- a/patches/juxtaposition-ui/exit-on-sigterm.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git i/src/server.js w/src/server.js -index be65907..ff45025 100644 ---- i/src/server.js -+++ w/src/server.js -@@ -1,6 +1,11 @@ - /* eslint-disable @typescript-eslint/explicit-function-return-type */ - /* eslint-disable @typescript-eslint/no-var-requires */ -+require('module-alias/register'); - process.title = 'Pretendo - Juxt-Web'; -+process.on('SIGTERM', () => { -+ process.exit(0); -+}); -+ - const express = require('express'); - const morgan = require('morgan'); - const cookieParser = require('cookie-parser'); -@@ -88,4 +93,4 @@ async function main() { - }); - } - --main().catch(console.error); -\ No newline at end of file -+main().catch(console.error); diff --git a/patches/juxtaposition-ui/fix-mongoose-uri.patch b/patches/juxtaposition-ui/fix-mongoose-uri.patch deleted file mode 100644 index f30a9ea..0000000 --- a/patches/juxtaposition-ui/fix-mongoose-uri.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git i/src/database.js w/src/database.js -index ebdd39a..21a4b77 100644 ---- i/src/database.js -+++ w/src/database.js -@@ -9,14 +9,14 @@ const { POST } = require('./models/post'); - const { SETTINGS } = require('./models/settings'); - const { REPORT } = require('./models/report'); - --const { uri, database, options } = mongooseConfig; -+const { uri, options } = mongooseConfig; - const logger = require('./logger'); - - let connection; - mongoose.set('strictQuery', true); - - async function connect() { -- await mongoose.connect(`${uri}/${database}`, options); -+ await mongoose.connect(`${uri}`, options); - connection = mongoose.connection; - connection.on('connected', function () { - logger.info(`MongoDB connected ${this.name}`); diff --git a/patches/juxtaposition-ui/redis-create-client-with-url.patch b/patches/juxtaposition-ui/redis-create-client-with-url.patch deleted file mode 100644 index 3e3dd39..0000000 --- a/patches/juxtaposition-ui/redis-create-client-with-url.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git i/src/redisCache.js w/src/redisCache.js -index b4f3b7a..cabe595 100644 ---- i/src/redisCache.js -+++ w/src/redisCache.js -@@ -5,7 +5,7 @@ const logger = require('./logger'); - const config = require('../config.json'); - const { host, port } = config.redis; - --const redisClient = redis.createClient({ host, port }); -+const redisClient = redis.createClient({ url: `redis://${host}:${port}` }); - - redisClient.on('error', (error) => { - logger.error(error); diff --git a/patches/juxtaposition-ui/use-config-js-instead-of-json-with-module-alias-hack.patch b/patches/juxtaposition-ui/use-config-js-instead-of-json-with-module-alias-hack.patch index dbd9533..be6bc2a 100644 --- a/patches/juxtaposition-ui/use-config-js-instead-of-json-with-module-alias-hack.patch +++ b/patches/juxtaposition-ui/use-config-js-instead-of-json-with-module-alias-hack.patch @@ -1,20 +1,75 @@ +diff --git i/package-lock.json w/package-lock.json +index f2dc7fd..01d5ade 100644 +--- i/package-lock.json ++++ w/package-lock.json +@@ -24,6 +24,7 @@ + "hashmap": "^2.4.0", + "image-pixels": "^1.1.1", + "memory-cache": "^0.2.0", ++ "module-alias": "^2.2.3", + "moment": "^2.29.1", + "mongoose": "^6.0.13", + "mongoose-fuzzy-search-next": "^1.0.13", +@@ -5249,6 +5250,11 @@ + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, ++ "node_modules/module-alias": { ++ "version": "2.2.3", ++ "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz", ++ "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==" ++ }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", +@@ -11132,6 +11138,11 @@ + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, ++ "module-alias": { ++ "version": "2.2.3", ++ "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz", ++ "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==" ++ }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", diff --git i/package.json w/package.json -index 5132be7..177de10 100644 +index 5132be7..3568117 100644 --- i/package.json +++ w/package.json -@@ -64,5 +64,14 @@ +@@ -36,6 +36,7 @@ + "hashmap": "^2.4.0", + "image-pixels": "^1.1.1", + "memory-cache": "^0.2.0", ++ "module-alias": "^2.2.3", + "moment": "^2.29.1", + "mongoose": "^6.0.13", + "mongoose-fuzzy-search-next": "^1.0.13", +@@ -64,5 +65,14 @@ "request": "^2.88.2", "tsc-alias": "^1.8.6", "typescript": "^5.1.3" -- } -+ }, -+ "_moduleAliases": { -+ "config.json": "/app/config.js", -+ "../config.json": "/app/config.js", -+ "../../config.json": "/app/config.js", -+ "../../../config.json": "/app/config.js", -+ "../../../../config.json": "/app/config.js", -+ "../../../../../config.json": "/app/config.js", -+ "../../../../../../config.json": "/app/config.js" -+ } ++ }, ++ "_moduleAliases": { ++ "config.json": "/app/config.js", ++ "../config.json": "/app/config.js", ++ "../../config.json": "/app/config.js", ++ "../../../config.json": "/app/config.js", ++ "../../../../config.json": "/app/config.js", ++ "../../../../../config.json": "/app/config.js", ++ "../../../../../../config.json": "/app/config.js" + } } +diff --git i/src/server.js w/src/server.js +index eb628fb..73f24af 100644 +--- i/src/server.js ++++ w/src/server.js +@@ -1,5 +1,7 @@ + /* eslint-disable @typescript-eslint/explicit-function-return-type */ + /* eslint-disable @typescript-eslint/no-var-requires */ ++require('module-alias/register'); ++ + process.title = 'Pretendo - Juxt-Web'; + process.on('SIGTERM', () => { + process.exit(0); diff --git a/patches/miiverse-api/dockerfile-enable-debugging.patch b/patches/miiverse-api/dockerfile-enable-debugging.patch new file mode 100644 index 0000000..680c1ce --- /dev/null +++ b/patches/miiverse-api/dockerfile-enable-debugging.patch @@ -0,0 +1,10 @@ +diff --git i/Dockerfile w/Dockerfile +index 53811ab..a56b582 100644 +--- i/Dockerfile ++++ w/Dockerfile +@@ -44,4 +44,4 @@ COPY package.json . + COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules + COPY --from=build ${app_dir}/dist ${app_dir}/dist + +-CMD ["node", "."] ++CMD ["node", "--inspect=0.0.0.0:9231", "."] diff --git a/patches/miiverse-api/dockerfile-update.patch b/patches/miiverse-api/dockerfile-update.patch deleted file mode 100644 index c9a1315..0000000 --- a/patches/miiverse-api/dockerfile-update.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff --git i/.dockerignore w/.dockerignore -index b4bb16e..19cdd91 100644 ---- i/.dockerignore -+++ w/.dockerignore -@@ -1,5 +1,4 @@ --node_modules - .git --config.json --certs --src/logs -+node_modules -+dist -+logs -diff --git i/Dockerfile w/Dockerfile -index be1b7af..25e1b0a 100644 ---- i/Dockerfile -+++ w/Dockerfile -@@ -1,15 +1,48 @@ --FROM node:18-alpine -+# syntax=docker/dockerfile:1 - --RUN apk add --no-cache python3 make gcc g++ --WORKDIR /app -+ARG app_dir="/home/node/app" - --COPY "docker/entrypoint.sh" ./ - --COPY package*.json ./ --RUN npm install -+# * Base Node.js image -+FROM node:20-alpine AS base -+ARG app_dir -+WORKDIR ${app_dir} - --COPY . ./ - --VOLUME [ "/app/config.json", "/app/certs" ] -+# * Installing production dependencies -+FROM base AS dependencies - --CMD ["sh", "entrypoint.sh"] -+RUN --mount=type=bind,source=package.json,target=package.json \ -+ --mount=type=bind,source=package-lock.json,target=package-lock.json \ -+ --mount=type=cache,target=/root/.npm \ -+ npm ci --omit=dev -+ -+ -+# * Installing development dependencies and building the application -+FROM base AS build -+ -+RUN --mount=type=bind,source=package.json,target=package.json \ -+ --mount=type=bind,source=package-lock.json,target=package-lock.json \ -+ --mount=type=cache,target=/root/.npm \ -+ npm ci -+ -+COPY . . -+RUN npm run build -+ -+ -+# * Running the final application -+FROM base AS final -+ARG app_dir -+ -+RUN mkdir -p ${app_dir}/logs -+RUN chown node:node ${app_dir}/logs -+ -+ENV NODE_ENV production -+USER node -+ -+COPY package.json . -+ -+COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules -+COPY --from=build ${app_dir}/dist ${app_dir}/dist -+ -+CMD ["node", "."] diff --git a/patches/miiverse-api/exit-on-sigterm.patch b/patches/miiverse-api/exit-on-sigterm.patch deleted file mode 100644 index 44fc12f..0000000 --- a/patches/miiverse-api/exit-on-sigterm.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git i/src/server.ts w/src/server.ts -index bc34398..46d42c7 100644 ---- i/src/server.ts -+++ w/src/server.ts -@@ -1,4 +1,7 @@ - process.title = 'Pretendo - Miiverse'; -+process.on('SIGTERM', () => { -+ process.exit(0); -+}); - - import express from 'express'; - import morgan from 'morgan'; -@@ -78,4 +81,4 @@ async function main(): Promise { - }); - } - --main().catch(console.error); -\ No newline at end of file -+main().catch(console.error); diff --git a/patches/website/dockerfile-enable-debugging.patch b/patches/website/dockerfile-enable-debugging.patch new file mode 100644 index 0000000..a9a5c81 --- /dev/null +++ b/patches/website/dockerfile-enable-debugging.patch @@ -0,0 +1,10 @@ +diff --git i/Dockerfile w/Dockerfile +index b72d258..03e2025 100644 +--- i/Dockerfile ++++ w/Dockerfile +@@ -48,4 +48,4 @@ COPY --from=build ${app_dir} ${app_dir} + # TODO: change back after TypeScript migration + #COPY --from=build ${app_dir}/dist ${app_dir}/dist + +-CMD ["node", "."] ++CMD ["node", "--inspect=0.0.0.0:9230", "."] diff --git a/patches/website/dockerize.patch b/patches/website/dockerize.patch deleted file mode 100644 index 3479d5c..0000000 --- a/patches/website/dockerize.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git c/.dockerignore i/.dockerignore -new file mode 100644 -index 0000000..dd2040f ---- /dev/null -+++ i/.dockerignore -@@ -0,0 +1,3 @@ -+.git -+node_modules -+logs -diff --git c/Dockerfile i/Dockerfile -new file mode 100644 -index 0000000..233a823 ---- /dev/null -+++ i/Dockerfile -@@ -0,0 +1,11 @@ -+FROM node:18-alpine -+ -+WORKDIR /app -+ -+COPY package*.json . -+RUN npm install -+ -+COPY . . -+RUN npm run build -+ -+CMD ["node", "--inspect=0.0.0.0:9230", "./src/server.js"] diff --git a/patches/website/exit-on-sigterm.patch b/patches/website/exit-on-sigterm.patch deleted file mode 100644 index 460cbb5..0000000 --- a/patches/website/exit-on-sigterm.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git i/src/server.js w/src/server.js -index b73bdde..04c714b 100644 ---- i/src/server.js -+++ w/src/server.js -@@ -1,4 +1,7 @@ - process.title = 'Pretendo - Website'; -+process.on('SIGTERM', () => { -+ process.exit(0); -+}); - - const express = require('express'); - const handlebars = require('express-handlebars'); diff --git a/repos/BOSS b/repos/BOSS index 61f8611..23bf64c 160000 --- a/repos/BOSS +++ b/repos/BOSS @@ -1 +1 @@ -Subproject commit 61f8611cf3430310e1b94a0b2aeae3480148348a +Subproject commit 23bf64c2c5788c8cbedf7095e6a4d1002900600e diff --git a/repos/juxtaposition-ui b/repos/juxtaposition-ui index 95fab2b..f04db21 160000 --- a/repos/juxtaposition-ui +++ b/repos/juxtaposition-ui @@ -1 +1 @@ -Subproject commit 95fab2bae9f7e810724ea1bfee47dd0314d351c6 +Subproject commit f04db21730686811d73cdc852201c8f04b4c301b diff --git a/repos/miiverse-api b/repos/miiverse-api index c81d3b8..0648852 160000 --- a/repos/miiverse-api +++ b/repos/miiverse-api @@ -1 +1 @@ -Subproject commit c81d3b863ea741260a26a633466d775ce359636a +Subproject commit 0648852c427307abb814ce62b30b032cbc5e10dc diff --git a/repos/website b/repos/website index 139a18d..f5a4810 160000 --- a/repos/website +++ b/repos/website @@ -1 +1 @@ -Subproject commit 139a18ddd1890f18db977a2912ea42b8b7f71c25 +Subproject commit f5a4810d2b3744f90c3a4498abf70f31e599a8a9