authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-10-06 01:37:24-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-10-14 02:40:48-07:00
logf813b9c7cef18191915ed92fb4564d8faeda0175
tree42f4fa3785741cf879ee1452cd2cc278f4e60994
parentdf4fa11a813a4697d6f36f728a19aa83c1b210bc
signature Commit is signed but in an unrecognized format.

fix(site): deployment must download databases

see https://paperclover.net/q+a#2510051828

2 files changed, 37 insertions(+), 16 deletions(-)

src/deploy.ts+24-14
......@@ -1,5 +1,28 @@
11export async function main() {
2 if (!process.argv.includes("-f")) await incr.restore();
2 await rsync.spawn({
3 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
4 args: [
5 "-a",
6 "--progress",
7 "clo@zenith:/mnt/storage1/clover/Documents/Config/paperclover/cache.sqlite",
8 ".clover/",
9 ],
10 progress: progress.start("download file cache"),
11 });
12 await rsync.spawn({
13 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
14 args: [
15 "-a",
16 "--progress",
17 "clo@paperclover.net:~/paperclover.net/.clover/questions.sqlite",
18 ".clover/",
19 ],
20 progress: progress.start("download questions state"),
21 });
22
23 // cannot call incr.restore until database calls are
24 // considered in the watch graph.
25 // await incr.restore()
326 await incr.compile(generate);
427
528 await rsync.spawn({
......@@ -18,19 +41,6 @@ export async function main() {
1841 ],
1942 progress: progress.start("copy site files"),
2043 });
21 const cache = Path.resolve(".clover/cache.sqlite").ifExistsSync();
22 if (cache) {
23 await rsync.spawn({
24 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
25 args: [
26 "-a",
27 "--progress",
28 cache.toString(),
29 "paperclover.net:~/paperclover.net/.clover/cache.sqlite",
30 ],
31 progress: progress.start("copy file viewer cache"),
32 });
33 }
3444 await subprocess.spawnAndWait({
3545 stdio: "inherit",
3646 cmd: [
src/file-viewer/bin/scan3.ts+13-2
......@@ -372,9 +372,19 @@ export async function main() {
372372 MediaFile.db.file,
373373 "clo@zenith:/mnt/storage1/clover/Documents/Config/paperclover/cache.sqlite",
374374 ],
375 progress: progress.start("Uploading database"),
375 progress: progress.start("Uploading database (source of truth)"),
376376 cwd: process.cwd(),
377377 });
378 await rsync.spawn({
379 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
380 args: [
381 "-a",
382 "--progress",
383 "clo@paperclover.net:~/paperclover.net/.clover/questions.sqlite",
384 ".clover/",
385 ],
386 progress: progress.start("Uploading database (web node)"),
387 });
378388 if (sotToken) {
379389 const res = await fetch("https://db.paperclover.net/reload", {
380390 method: "POST",
......@@ -388,6 +398,7 @@ export async function main() {
388398 );
389399 }
390400 } else console.warn("Missing SOT token");
401 // TODO: signal to web node(s)
391402
392403 console.info(
393404 "Updated file viewer index in \x1b[1m" +
......@@ -1012,4 +1023,4 @@ import * as derived from "@/file-viewer/models/derived.ts";
10121023import * as transcodeRules from "@/file-viewer/transcode-rules.ts";
10131024
10141025import { rawFileRoot as root } from "../paths.ts";
1015import { UNWRAP } from "lib/assert.ts";
1026import { ASSERT, UNWRAP } from "lib/assert.ts";