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 @@...@@ -1,5 +1,28 @@
1export async function main() {1export 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()
3 await incr.compile(generate);26 await incr.compile(generate);
427
5 await rsync.spawn({28 await rsync.spawn({
...@@ -18,19 +41,6 @@ export async function main() {...@@ -18,19 +41,6 @@ export async function main() {
18 ],41 ],
19 progress: progress.start("copy site files"),42 progress: progress.start("copy site files"),
20 });43 });
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 }
34 await subprocess.spawnAndWait({44 await subprocess.spawnAndWait({
35 stdio: "inherit",45 stdio: "inherit",
36 cmd: [46 cmd: [
src/file-viewer/bin/scan3.ts+13-2
...@@ -372,9 +372,19 @@ export async function main() {...@@ -372,9 +372,19 @@ export async function main() {
372 MediaFile.db.file,372 MediaFile.db.file,
373 "clo@zenith:/mnt/storage1/clover/Documents/Config/paperclover/cache.sqlite",373 "clo@zenith:/mnt/storage1/clover/Documents/Config/paperclover/cache.sqlite",
374 ],374 ],
375 progress: progress.start("Uploading database"),375 progress: progress.start("Uploading database (source of truth)"),
376 cwd: process.cwd(),376 cwd: process.cwd(),
377 });377 });
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 });
378 if (sotToken) {388 if (sotToken) {
379 const res = await fetch("https://db.paperclover.net/reload", {389 const res = await fetch("https://db.paperclover.net/reload", {
380 method: "POST",390 method: "POST",
...@@ -388,6 +398,7 @@ export async function main() {...@@ -388,6 +398,7 @@ export async function main() {
388 );398 );
389 }399 }
390 } else console.warn("Missing SOT token");400 } else console.warn("Missing SOT token");
401 // TODO: signal to web node(s)
391402
392 console.info(403 console.info(
393 "Updated file viewer index in \x1b[1m" +404 "Updated file viewer index in \x1b[1m" +
...@@ -1012,4 +1023,4 @@ import * as derived from "@/file-viewer/models/derived.ts";...@@ -1012,4 +1023,4 @@ import * as derived from "@/file-viewer/models/derived.ts";
1012import * as transcodeRules from "@/file-viewer/transcode-rules.ts";1023import * as transcodeRules from "@/file-viewer/transcode-rules.ts";
10131024
1014import { rawFileRoot as root } from "../paths.ts";1025import { rawFileRoot as root } from "../paths.ts";
1015import { UNWRAP } from "lib/assert.ts";1026import { ASSERT, UNWRAP } from "lib/assert.ts";