diff --git a/.dockerignore b/.dockerignore index b7ccb0127..7d13e48c3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,13 @@ tsconfig.json.tsbuildinfo **/node_modules **/tsconfig.json.tsbuildinfo +# Build outputs & tool caches +**/dist +**/build +**/.turbo +**/coverage +**/.vite + # Extracted data from iidx merge script typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/ifs-output typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/logs diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index cb98ce293..68576696d 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -53,7 +53,7 @@ jobs: --health-timeout 5s --health-retries 10 tachi-redis: - image: redis:7.4.1 + image: redis:7.4-alpine options: >- --health-cmd "redis-cli ping" --health-interval 5s diff --git a/Justfile-repo b/Justfile-repo index 58d33d079..c276cf03d 100644 --- a/Justfile-repo +++ b/Justfile-repo @@ -7,23 +7,19 @@ setup-fish: setup: ./dev/bootstrap.sh -f -# Deploy stuff for putting tachi on a server. -# -# It's only private because I'm too lazy to make it modular -# and it's also just hyperspecific to _my_ opinions on how -# tachi should be deployed. I've already given you the docker -# containers! -enable-zkldi-deploy-code: - git submodule update --init --remote deploy - -# Same image as GHA `docker-push` (prod-unified). Context is always repo root via `git rev-parse`. -docker-build-server: assert-docker-host +# Verify every Dockerfile in-repo that CI builds (excludes docs: see .github/workflows/docs.yml + Dockerfile.docs). +check-all-docker-builds: assert-docker-host #!/usr/bin/env bash set -euo pipefail root="$(git rev-parse --show-toplevel)" - exec docker build \ - -f "$root/docker/Dockerfile.server" \ - --target prod-unified \ - --build-arg "COMMIT_HASH=$(git -C "$root" rev-parse --short HEAD)" \ - -t tachi-server:local \ - "$root" + sha="$(git -C "$root" rev-parse --short HEAD)" + echo "==> server (prod-unified)" + docker build -f "$root/docker/Dockerfile.server" --target prod-unified \ + --build-arg "COMMIT_HASH=$sha" -t tachi-server:check "$root" + echo "==> bot" + docker build -f "$root/docker/Dockerfile.bot" -t tachi-bot:check "$root" + echo "==> github-bot" + docker build -f "$root/docker/Dockerfile.ghbot" -t tachi-ghbot:check "$root" + echo "==> dev image" + docker build -f "$root/Dockerfile.dev" -t tachi-dev:check "$root" + echo "All Docker builds succeeded." diff --git a/bun.lock b/bun.lock index 300e8d005..686fa3fc9 100644 --- a/bun.lock +++ b/bun.lock @@ -287,7 +287,6 @@ "dependencies": { "@types/lodash.get": "catalog:", "@types/node": "catalog:", - "better-sqlite3": "catalog:", "binary-parser": "catalog:", "bms-table-loader": "catalog:", "chalk": "catalog:", @@ -506,7 +505,6 @@ "@vitejs/plugin-react": "^6.0.1", "@vitest/coverage-v8": "~3.2.0", "bcryptjs": "2.4.3", - "better-sqlite3": "9.4.5", "binary-parser": "^2.3.0", "bms-table-loader": "2.0.0", "bootstrap-scss": "^5.3.0", @@ -1563,14 +1561,10 @@ "before-after-hook": ["before-after-hook@3.0.2", "", {}, "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A=="], - "better-sqlite3": ["better-sqlite3@9.4.5", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-uFVyoyZR9BNcjSca+cp3MWCv6upAv+tbMC4SWM51NIMhoQOm4tjIkyxFO/ZsYdGAF61WJBgdzyJcz4OokJi0gQ=="], - "big-integer": ["big-integer@1.6.52", "", {}, "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg=="], "binary-parser": ["binary-parser@2.3.0", "", {}, "sha512-TXOlPrhvi+kZUv3vA1qZ+MBdqZdihF8gWw7j/MRINiJqXH652GtLSqFTHNPjG8kHbiMQSCATG9oat9ao6aA8dA=="], - "bindings": ["bindings@1.5.0", "", { "dependencies": { "file-uri-to-path": "1.0.0" } }, "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="], - "bintrees": ["bintrees@1.0.2", "", {}, "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw=="], "bl": ["bl@2.2.1", "", { "dependencies": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" } }, "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g=="], @@ -1633,8 +1627,6 @@ "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], - "chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="], - "classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="], "clean-css": ["clean-css@5.3.3", "", { "dependencies": { "source-map": "~0.6.0" } }, "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg=="], @@ -1747,12 +1739,8 @@ "decode-named-character-reference": ["decode-named-character-reference@1.3.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q=="], - "decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="], - "deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], - "deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="], - "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], "deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="], @@ -1957,8 +1945,6 @@ "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="], - "expand-template": ["expand-template@2.0.3", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="], - "expect-type": ["expect-type@1.3.0", "", {}, "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA=="], "express": ["express@4.20.0", "", { "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "1.2.0", "fresh": "0.5.2", "http-errors": "2.0.0", "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.19.0", "serve-static": "1.16.0", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" } }, "sha512-pLdae7I6QqShF5PnNTCVn4hI91Dx0Grkn2+IAsMTgMIKuQVte2dN9PeGSSAME2FR8anOhVA62QDIUaWVfEXVLw=="], @@ -2001,8 +1987,6 @@ "file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], - "file-uri-to-path": ["file-uri-to-path@1.0.0", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="], - "filelist": ["filelist@1.0.6", "", { "dependencies": { "minimatch": "^5.0.1" } }, "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA=="], "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], @@ -2033,8 +2017,6 @@ "fresh": ["fresh@0.5.2", "", {}, "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="], - "fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="], - "fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], "fs.realpath": ["fs.realpath@1.0.0", "", {}, "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="], @@ -2065,8 +2047,6 @@ "getopts": ["getopts@2.3.0", "", {}, "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA=="], - "github-from-package": ["github-from-package@0.0.0", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="], - "glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], "glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], @@ -2135,8 +2115,6 @@ "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], - "ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="], - "inline-style-parser": ["inline-style-parser@0.1.1", "", {}, "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="], "internal-slot": ["internal-slot@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw=="], @@ -2423,8 +2401,6 @@ "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="], - "mini-create-react-context": ["mini-create-react-context@0.3.3", "", { "dependencies": { "@babel/runtime": "^7.12.1", "tiny-warning": "^1.0.3" }, "peerDependencies": { "prop-types": "^15.0.0", "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-TtF6hZE59SGmS4U8529qB+jJFeW6asTLDIpPgvPLSCsooAwJS7QprHIFTqv9/Qh3NdLwQxFYgiHX5lqb6jqzPA=="], "minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -2435,8 +2411,6 @@ "mkdirp": ["mkdirp@0.5.6", "", { "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw=="], - "mkdirp-classic": ["mkdirp-classic@0.5.3", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="], - "moment": ["moment@2.30.1", "", {}, "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how=="], "moment-timezone": ["moment-timezone@0.5.48", "", { "dependencies": { "moment": "^2.29.4" } }, "sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw=="], @@ -2479,8 +2453,6 @@ "nanoid": ["nanoid@3.1.23", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw=="], - "napi-build-utils": ["napi-build-utils@2.0.0", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="], - "napi-postinstall": ["napi-postinstall@0.3.4", "", { "bin": { "napi-postinstall": "lib/cli.js" } }, "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ=="], "natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="], @@ -2493,8 +2465,6 @@ "no-case": ["no-case@3.0.4", "", { "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" } }, "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg=="], - "node-abi": ["node-abi@3.87.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ=="], - "node-addon-api": ["node-addon-api@7.1.1", "", {}, "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ=="], "node-cache": ["node-cache@5.1.2", "", { "dependencies": { "clone": "2.x" } }, "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg=="], @@ -2633,8 +2603,6 @@ "preact": ["preact@10.12.1", "", {}, "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg=="], - "prebuild-install": ["prebuild-install@7.1.3", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="], - "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], "prettier": ["prettier@3.2.5", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A=="], @@ -2681,8 +2649,6 @@ "raw-body": ["raw-body@2.5.2", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA=="], - "rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="], - "react": ["react@17.0.2", "", { "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" } }, "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA=="], "react-async": ["react-async@10.0.1", "", { "peerDependencies": { "react": ">=16.3.1" } }, "sha512-ORUz5ca0B57QgBIzEZM5SuhJ6xFjkvEEs0gylLNlWf06vuVcLZsjIw3wx58jJkZG38p+0nUAxRgFW2b7mnVZzA=="], @@ -2827,10 +2793,6 @@ "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], - "simple-concat": ["simple-concat@1.0.1", "", {}, "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="], - - "simple-get": ["simple-get@4.0.1", "", { "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", "simple-concat": "^1.0.0" } }, "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA=="], - "slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="], "sonic-boom": ["sonic-boom@4.2.1", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q=="], @@ -2939,10 +2901,6 @@ "tagged-comment-parser": ["tagged-comment-parser@1.3.8", "", {}, "sha512-HYkOQ/8ha113ln/Vp48wiDTPtbB59AWOdU44AXjhLyJLJjWWfn2kjnXUcyWLQepwbixA/mEeo1iW2Z9OwaBClQ=="], - "tar-fs": ["tar-fs@2.1.4", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ=="], - - "tar-stream": ["tar-stream@2.2.0", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="], - "tarn": ["tarn@3.0.2", "", {}, "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ=="], "tdigest": ["tdigest@0.1.2", "", { "dependencies": { "bintrees": "1.0.2" } }, "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA=="], @@ -2993,8 +2951,6 @@ "tsutils": ["tsutils@3.21.0", "", { "dependencies": { "tslib": "^1.8.1" }, "peerDependencies": { "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA=="], - "tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="], - "type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="], "type-fest": ["type-fest@1.4.0", "", {}, "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="], @@ -3397,8 +3353,6 @@ "raw-body/iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="], - "rc/strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="], - "react-router/path-to-regexp": ["path-to-regexp@1.9.0", "", { "dependencies": { "isarray": "0.0.1" } }, "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g=="], "react-router/react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], @@ -3431,8 +3385,6 @@ "superagent/qs": ["qs@6.13.0", "", { "dependencies": { "side-channel": "^1.0.6" } }, "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg=="], - "tar-stream/bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="], - "terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], "test-exclude/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 3e1b50e73..46d979dfb 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -13,7 +13,7 @@ services: tachi-redis: container_name: tachi-redis command: redis-server --save 60 1 --loglevel warning - image: redis:7.4.1 + image: redis:7.4-alpine restart: unless-stopped ports: - "6379:6379" diff --git a/docker/Dockerfile.bot b/docker/Dockerfile.bot index 562de07ce..1ceae76ab 100644 --- a/docker/Dockerfile.bot +++ b/docker/Dockerfile.bot @@ -1,26 +1,16 @@ -# Build context must be the repo root. +# Build context must be the repo root. Full tree + .dockerignore (see repo root). # docker build -f docker/Dockerfile.bot . FROM oven/bun:alpine AS base WORKDIR /app -# --- deps: install ALL deps (dev included, needed for the build) --- FROM base AS deps -COPY package.json bun.lock bunfig.toml ./ -COPY patches ./patches - -COPY typescript/bot/package.json ./typescript/bot/ -COPY typescript/common/package.json ./typescript/common/ - +COPY . . RUN bun install --frozen-lockfile -# --- build: compile everything into a single native binary --- FROM deps AS build -COPY typescript/bot ./typescript/bot -COPY typescript/common ./typescript/common - RUN bun build \ --compile \ --target=bun \ diff --git a/docker/Dockerfile.ghbot b/docker/Dockerfile.ghbot index b5a2f5e15..56eb9658f 100644 --- a/docker/Dockerfile.ghbot +++ b/docker/Dockerfile.ghbot @@ -1,24 +1,16 @@ -# Build context must be the repo root. +# Build context must be the repo root. Full tree + .dockerignore (see repo root). # docker build -f docker/Dockerfile.ghbot . FROM oven/bun:alpine AS base WORKDIR /app -# --- deps: install ALL deps (dev included, needed for the build) --- FROM base AS deps -COPY package.json bun.lock bunfig.toml ./ -COPY patches ./patches - -COPY typescript/github-bot/package.json ./typescript/github-bot/ - +COPY . . RUN bun install --frozen-lockfile -# --- build: compile everything into a single native binary --- FROM deps AS build -COPY typescript/github-bot ./typescript/github-bot - RUN bun build \ --compile \ --target=bun \ diff --git a/docker/Dockerfile.server b/docker/Dockerfile.server index 1f9b3ac16..78e45a320 100644 --- a/docker/Dockerfile.server +++ b/docker/Dockerfile.server @@ -1,4 +1,5 @@ # Build context must be the repo root (same as GHA docker-push: context `.`). +# Respects .dockerignore (see repo root). Full tree copy keeps workspace installs correct. # docker build -f docker/Dockerfile.server --target prod-unified --build-arg COMMIT_HASH="$(git rev-parse --short HEAD)" -t tachi-server:local . # docker build -f docker/Dockerfile.server --target prod-api . # docker build -f docker/Dockerfile.server --target prod-job-worker . @@ -7,30 +8,16 @@ FROM oven/bun:alpine AS base WORKDIR /app -# --- deps: install ALL deps (dev included, needed for the build) --- +# --- install: full tree so bun sees every workspace package --- FROM base AS deps -COPY package.json bun.lock bunfig.toml ./ -COPY patches ./patches - -COPY typescript/server/package.json ./typescript/server/ -COPY typescript/common/package.json ./typescript/common/ -COPY typescript/db/package.json ./typescript/db/ -COPY typescript/db-migration-engine/package.json ./typescript/db-migration-engine/ - +COPY . . RUN bun install --frozen-lockfile -# --- build stages: compile each entrypoint into a native binary --- +# --- compile each entrypoint (inherits full /app from deps) --- FROM deps AS build-api -COPY typescript/server ./typescript/server -COPY typescript/common ./typescript/common -COPY typescript/db ./typescript/db -COPY typescript/db-migration-engine ./typescript/db-migration-engine -COPY db/migrations ./db/migrations -COPY package.json bunfig.toml ./ - -RUN bun build \ +RUN mkdir -p /out && bun build \ --compile \ --target=bun \ ./typescript/server/src/main.ts \ @@ -38,14 +25,7 @@ RUN bun build \ FROM deps AS build-job-worker -COPY typescript/server ./typescript/server -COPY typescript/common ./typescript/common -COPY typescript/db ./typescript/db -COPY typescript/db-migration-engine ./typescript/db-migration-engine -COPY db/migrations ./db/migrations -COPY package.json bunfig.toml ./ - -RUN bun build \ +RUN mkdir -p /out && bun build \ --compile \ --target=bun \ ./typescript/server/src/job-queue-worker.ts \ @@ -53,14 +33,7 @@ RUN bun build \ FROM deps AS build-cron-worker -COPY typescript/server ./typescript/server -COPY typescript/common ./typescript/common -COPY typescript/db ./typescript/db -COPY typescript/db-migration-engine ./typescript/db-migration-engine -COPY db/migrations ./db/migrations -COPY package.json bunfig.toml ./ - -RUN bun build \ +RUN mkdir -p /out && bun build \ --compile \ --target=bun \ ./typescript/server/src/cron-worker.ts \ @@ -76,7 +49,7 @@ ENV MIGRATIONS_DIR=/app/db/migrations RUN apk add --no-cache curl COPY --from=build-api /out/server /server -COPY db/migrations /app/db/migrations +COPY --from=deps /app/db/migrations /app/db/migrations EXPOSE 8080 @@ -95,7 +68,7 @@ ENV MIGRATIONS_DIR=/app/db/migrations RUN apk add --no-cache curl COPY --from=build-job-worker /out/job-queue-worker /job-queue-worker -COPY db/migrations /app/db/migrations +COPY --from=deps /app/db/migrations /app/db/migrations CMD ["/job-queue-worker"] @@ -109,7 +82,7 @@ ENV MIGRATIONS_DIR=/app/db/migrations RUN apk add --no-cache curl COPY --from=build-cron-worker /out/cron-worker /cron-worker -COPY db/migrations /app/db/migrations +COPY --from=deps /app/db/migrations /app/db/migrations CMD ["/cron-worker"] @@ -125,7 +98,7 @@ RUN apk add --no-cache curl COPY --from=build-api /out/server /server COPY --from=build-job-worker /out/job-queue-worker /job-queue-worker COPY --from=build-cron-worker /out/cron-worker /cron-worker -COPY db/migrations /app/db/migrations +COPY --from=deps /app/db/migrations /app/db/migrations EXPOSE 8080 diff --git a/package.json b/package.json index 6832acb78..bcca61dfa 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,6 @@ "@vitejs/plugin-react": "^6.0.1", "@vitest/coverage-v8": "~3.2.0", "bcryptjs": "2.4.3", - "better-sqlite3": "9.4.5", "binary-parser": "^2.3.0", "bms-table-loader": "2.0.0", "bootstrap-scss": "^5.3.0", diff --git a/typescript/seeds-scripts/package.json b/typescript/seeds-scripts/package.json index 6f28213db..bcf728c6e 100644 --- a/typescript/seeds-scripts/package.json +++ b/typescript/seeds-scripts/package.json @@ -22,7 +22,6 @@ "dependencies": { "@types/lodash.get": "catalog:", "@types/node": "catalog:", - "better-sqlite3": "catalog:", "binary-parser": "catalog:", "bms-table-loader": "catalog:", "chalk": "catalog:", diff --git a/typescript/seeds-scripts/rerunners/usc/add-usc-converts.js b/typescript/seeds-scripts/rerunners/usc/add-usc-converts.js index 6ba96cbf5..83e636814 100644 --- a/typescript/seeds-scripts/rerunners/usc/add-usc-converts.js +++ b/typescript/seeds-scripts/rerunners/usc/add-usc-converts.js @@ -1,4 +1,4 @@ -const sqlite3 = require("better-sqlite3"); +const { Database } = require("bun:sqlite"); const { Command } = require("commander"); const fs = require("fs"); @@ -19,8 +19,10 @@ const options = program.opts(); // Change this to see logs in the terminal const DEBUG = options.debug; -const db = sqlite3(options.db); -const dbRows = db.prepare(`SELECT * FROM Charts WHERE path LIKE '%${options.filter}%'`).all(); +const db = new Database(options.db, { readonly: true }); +const dbRows = db + .query(`SELECT * FROM Charts WHERE path LIKE '%${options.filter}%'`) + .all(); console.log(`Found ${dbRows.length} charts.`); const songs = ReadCollection("songs-usc.json"); diff --git a/typescript/seeds-scripts/rerunners/usc/add-usc-tables.ts b/typescript/seeds-scripts/rerunners/usc/add-usc-tables.ts index 68a75d85a..3e909db23 100644 --- a/typescript/seeds-scripts/rerunners/usc/add-usc-tables.ts +++ b/typescript/seeds-scripts/rerunners/usc/add-usc-tables.ts @@ -1,4 +1,4 @@ -import sqlite3 from "better-sqlite3"; +import { Database } from "bun:sqlite"; import { Command } from "commander"; import { parse } from "csv-parse/sync"; import fs from "fs"; @@ -114,11 +114,11 @@ for (let i = 0; i < packageData.length; i++) { directories[currentPack].push(directory); } -const db = sqlite3(options.db); +const db = new Database(options.db, { readonly: true }); // We could use proper queries to be more efficient, // but the db isn't really large enough for it to matter... -const dbRows = db.prepare("SELECT * FROM Charts").all(); +const dbRows = db.query("SELECT * FROM Charts").all(); const songs = ReadCollection("songs-usc.json"); const charts = ReadCollection("charts-usc.json"); diff --git a/typescript/server/.env.test b/typescript/server/.env.test index c118b00f4..97a64d0c7 100644 --- a/typescript/server/.env.test +++ b/typescript/server/.env.test @@ -1,7 +1,6 @@ # Vitest: NODE_ENV=test is set by vitest.config.ts before imports; POSTGRES_URL is set per-worker in vitest.setup.ts. TACHI_ENABLE_METRICS=false REDIS_URL=tachi-redis -MONGO_URL=tachi-mongo PORT=8080 MIGRATIONS_DIR=/tachi/db/migrations LOG_LEVEL=warn