Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ec18900fe | ||
|
|
b6857bd0b3 | ||
|
|
6ba8084caa | ||
|
|
34e6c3037f | ||
|
|
b10404f0f3 | ||
|
|
d281364aef | ||
|
|
b2a355312f | ||
|
|
e8636ce7da | ||
|
|
f6bd6e2feb | ||
|
|
8cc5ed854a | ||
|
|
c8cc4b4b7c | ||
|
|
ae002b99f0 | ||
|
|
9d13365348 | ||
|
|
e367006a6c | ||
|
|
d15d5388fa | ||
|
|
b9f0278329 | ||
|
|
ed8450c0e2 | ||
|
|
f0b58317b9 | ||
|
|
82dcd6d33c | ||
|
|
1d8d55144f | ||
|
|
3ccc1f6698 | ||
|
|
ce821c1817 | ||
|
|
8a16293f0e | ||
|
|
463046c970 | ||
|
|
116e839f67 | ||
|
|
24950e1a12 | ||
|
|
1d127e2122 | ||
|
|
aaa4a9b577 | ||
|
|
ebc7ce67a1 | ||
|
|
4f28230243 | ||
|
|
a8c133bbf9 | ||
|
|
f3292211a8 | ||
|
|
99fa12a1be | ||
|
|
c38d88c209 | ||
|
|
757913cf00 | ||
|
|
a850f70e24 | ||
|
|
dbff980792 | ||
|
|
04a9316c8e | ||
|
|
3a0ef7867e | ||
|
|
5632d2252a | ||
|
|
73468bbb02 | ||
|
|
44cf4603fe | ||
|
|
608239e412 | ||
|
|
5840c9d1d0 | ||
|
|
d46db2c701 | ||
|
|
595c170c00 | ||
|
|
b29e856225 | ||
|
|
53664f2421 | ||
|
|
d62f462129 | ||
|
|
2d5cc1fd7c | ||
|
|
632665b0ed | ||
|
|
47599aba4a | ||
|
|
bd1cdc0817 | ||
|
|
54d72138d2 | ||
|
|
c88c3c13d6 | ||
|
|
9b79115170 | ||
|
|
66a0be42bd | ||
|
|
b8a23c7ec4 | ||
|
|
65ad797378 | ||
|
|
36c8e4cbaa | ||
|
|
86b9ac2ab6 | ||
|
|
22e39420bb | ||
|
|
2389c6f4bc | ||
|
|
8aa1872ea5 | ||
|
|
128714a1e0 | ||
|
|
56e45561d6 | ||
|
|
4308ff220b | ||
|
|
d06fc133e7 | ||
|
|
834d4f641b | ||
|
|
2353f114f6 | ||
|
|
dd521f9f1d | ||
|
|
34230cda21 | ||
|
|
0a67d88ff2 | ||
|
|
e8f578eb48 | ||
|
|
225f810513 | ||
|
|
b5d0a8cb66 | ||
|
|
2ea74816fb | ||
|
|
c3375b714d | ||
|
|
f57bb9f6eb | ||
|
|
cbd463e1d9 | ||
|
|
3f7c294948 | ||
|
|
8bb9f9950a | ||
|
|
447b012e48 | ||
|
|
65555c18e8 | ||
|
|
9f88823315 | ||
|
|
4b02d1c7d5 | ||
|
|
c6a627af8a | ||
|
|
dad6f1e0b8 | ||
|
|
e46318aee5 | ||
|
|
186743ee37 | ||
|
|
4337575b17 | ||
|
|
e66451afbd | ||
|
|
e1dd1990d7 | ||
|
|
c0093edc09 | ||
|
|
cf41148942 | ||
|
|
ebe8b163b9 | ||
|
|
5ffe9e4d27 | ||
|
|
601ced5981 | ||
|
|
033026f57c | ||
|
|
fea1bf68c5 | ||
|
|
406ce1eb70 | ||
|
|
6e9decfbec | ||
|
|
9aa16b0729 | ||
|
|
f4b564b9e1 | ||
|
|
6519345414 | ||
|
|
45bdc7ed8e | ||
|
|
9cf63ece72 | ||
|
|
79aa359c1f | ||
|
|
b9019d48fc | ||
|
|
70f2a576e1 | ||
|
|
c53bea7093 | ||
|
|
d7811b7c7a | ||
|
|
41555bb57d | ||
|
|
0b45eeb2d4 | ||
|
|
852ab511ab | ||
|
|
e0d63d94b4 | ||
|
|
4fd1b712fa | ||
|
|
34604c5842 | ||
|
|
970490d9c8 | ||
|
|
65ad1f6cfa | ||
|
|
0b4a9441d0 | ||
|
|
268488d93d | ||
|
|
7c03eecd30 | ||
|
|
635747a1ee | ||
|
|
e512c8215e | ||
|
|
e164a88a97 | ||
|
|
9bf9550b03 | ||
|
|
68ed888172 | ||
|
|
82243b4170 | ||
|
|
9ba581f64e | ||
|
|
3588fde3a2 | ||
|
|
844e0ed355 | ||
|
|
07e28b3f8d | ||
|
|
0c6504ef1c | ||
|
|
e36732cc2d | ||
|
|
ee1c5dc606 | ||
|
|
39e3ac2a87 | ||
|
|
6157a4f571 | ||
|
|
9a3ed74230 | ||
|
|
835dcc4faa | ||
|
|
155d8c5c4a | ||
|
|
81194032e0 | ||
|
|
d44c33dd69 | ||
|
|
bbf7d23c96 | ||
|
|
27eea08605 | ||
|
|
e5e71cc5f8 | ||
|
|
0a4a3ae35c | ||
|
|
342714528a | ||
|
|
93dcde471f | ||
|
|
757abe9a0f | ||
|
|
c4603a0b3a | ||
|
|
45ff3fb9ac | ||
|
|
5accfb4339 | ||
|
|
e0fce40bc3 | ||
|
|
13c87f4b07 | ||
|
|
d6206786f7 | ||
|
|
2c42e63bab | ||
|
|
30602e6b66 | ||
|
|
226d99b6bf | ||
|
|
5191d50d42 | ||
|
|
9c116cfe8c | ||
|
|
f4c0af4730 | ||
|
|
fe80ccc046 | ||
|
|
ccc22beda2 | ||
|
|
4d30e47ee8 | ||
|
|
81dd7b80d4 | ||
|
|
049c3f4a9a | ||
|
|
cc168b3460 | ||
|
|
9ef63a87cb | ||
|
|
70e7bda87e | ||
|
|
22f0c040a2 | ||
|
|
096c377897 | ||
|
|
deec2fe69d | ||
|
|
8c16730d31 | ||
|
|
f5ca74b63c | ||
|
|
63be4663ab | ||
|
|
d470bc8bf1 | ||
|
|
8aab635b13 | ||
|
|
46fa63af8a | ||
|
|
4c8ff39305 | ||
|
|
66848e8526 | ||
|
|
71f9330c67 | ||
|
|
85afff2c19 | ||
|
|
014f489857 | ||
|
|
d3c76bc303 | ||
|
|
530218a4b8 | ||
|
|
5498cf4342 | ||
|
|
138e46a286 | ||
|
|
41005390e8 | ||
|
|
79578e5daa | ||
|
|
132d9e3d02 | ||
|
|
7bee56b960 | ||
|
|
ab3faad6af | ||
|
|
c50372af06 | ||
|
|
dd7dae5f9d | ||
|
|
5871c7ae6e | ||
|
|
bd55b784d7 | ||
|
|
3ce6b0ce93 | ||
|
|
a08e975da1 | ||
|
|
78e6d3e431 | ||
|
|
0eb4c0a294 | ||
|
|
b76f1df27f | ||
|
|
e1b47ed153 | ||
|
|
6923a68837 | ||
|
|
1764f24243 | ||
|
|
3e21e72953 | ||
|
|
ea6e42175a | ||
|
|
0c37ef5578 | ||
|
|
0b0a1a88fd | ||
|
|
bc9be96123 | ||
|
|
5fe11f18ac | ||
|
|
61573431e3 | ||
|
|
42733a9a92 | ||
|
|
c56058b939 | ||
|
|
5ffbcc47e3 | ||
|
|
16c28bcba1 | ||
|
|
fa6b4b94f6 | ||
|
|
1f2c62241c | ||
|
|
4b9f74d5a8 | ||
|
|
dae66703f2 | ||
|
|
42f3917881 | ||
|
|
7e0768a09a | ||
|
|
d0379c57ce | ||
|
|
bd3eab8b40 | ||
|
|
a3c5494bf7 | ||
|
|
6f4ff68062 | ||
|
|
2966e25646 | ||
|
|
f5b807edc5 | ||
|
|
2effdff990 | ||
|
|
a6d2c115fe | ||
|
|
59a0514541 | ||
|
|
eb20d0bc5e | ||
|
|
62e44b5375 | ||
|
|
18558ab087 | ||
|
|
dfbd47f219 | ||
|
|
98165f71b0 | ||
|
|
f7251b8ce3 | ||
|
|
6fe7bbbbb5 | ||
|
|
1e740ea024 | ||
|
|
6d55e61cee | ||
|
|
ada089c05b | ||
|
|
39787f9552 | ||
|
|
b812d748ea | ||
|
|
190bd7d85c | ||
|
|
d2e27c12a2 | ||
|
|
e66b530f24 | ||
|
|
85ed89cf19 | ||
|
|
9cea0161d7 | ||
|
|
3042dacc00 | ||
|
|
3424691e4c | ||
|
|
363ed2e836 | ||
|
|
900ec18a7f | ||
|
|
13e103f382 | ||
|
|
32ef3ced59 | ||
|
|
44c982f015 | ||
|
|
762e4ee315 | ||
|
|
d42192b2f1 | ||
|
|
06683e2a07 | ||
|
|
5653828ff3 | ||
|
|
84734cca2f | ||
|
|
b987bdacfe | ||
|
|
1111784caa | ||
|
|
8e7a2f3d6c | ||
|
|
cf070d35f0 | ||
|
|
e019cc2cee | ||
|
|
2a87dad0ab | ||
|
|
d46951d12e | ||
|
|
8feec04601 | ||
|
|
1193c71579 | ||
|
|
31db4ede38 | ||
|
|
6f34a0a4fa | ||
|
|
cd9a8a0204 | ||
|
|
edcf996d12 | ||
|
|
5333de0e89 | ||
|
|
1ee3d1cc5e | ||
|
|
a8589a864a | ||
|
|
7f371b2ab6 | ||
|
|
8751637b92 | ||
|
|
10f9f3be2f | ||
|
|
2dd786ce14 | ||
|
|
6ae497323e | ||
|
|
4f29ff73c6 | ||
|
|
ac9e688e7a | ||
|
|
3fe325c4ce | ||
|
|
425e03650f | ||
|
|
4ce4bd1a4b | ||
|
|
26798ac430 | ||
|
|
70b9443e66 | ||
|
|
8788cd3e25 | ||
|
|
8dddb0b940 | ||
|
|
992d7038e5 | ||
|
|
0a1416ef92 | ||
|
|
8820ff1c15 | ||
|
|
ab81e76206 | ||
|
|
ef9bec3334 | ||
|
|
8094ac3190 | ||
|
|
7376a5dd4d | ||
|
|
d43885aa48 | ||
|
|
6eb50c0555 | ||
|
|
9252883a2b | ||
|
|
fe2cb99651 | ||
|
|
bf1e5cd107 | ||
|
|
9757fd0c10 | ||
|
|
288c53364e | ||
|
|
218f2f2475 | ||
|
|
585caaee58 | ||
|
|
578dfd8998 | ||
|
|
b4a1821a55 | ||
|
|
ac24297a7b | ||
|
|
20cf597c5c | ||
|
|
737c44da12 | ||
|
|
bfab2f2cdc | ||
|
|
fed3a1a32f | ||
|
|
cbdb180423 | ||
|
|
6d0d453aa1 | ||
|
|
3c1c910dc9 | ||
|
|
45ad2d4730 | ||
|
|
12733e1879 | ||
|
|
da0f2ae8ab | ||
|
|
14b4dd434c | ||
|
|
bc33f68209 | ||
|
|
81571e4c64 | ||
|
|
d24d2c9249 | ||
|
|
4bc7357e41 | ||
|
|
8dd6be2a5d | ||
|
|
08cf8bd50f | ||
|
|
0bd54ef941 | ||
|
|
7617d99ab2 | ||
|
|
06ac9fc87e | ||
|
|
ae1884045d | ||
|
|
9bf1fc1983 | ||
|
|
30b90a5bf5 | ||
|
|
5b88ecf2dd | ||
|
|
7f53bc900a | ||
|
|
ef2ed2dc58 | ||
|
|
07169e853b | ||
|
|
5562c271e1 | ||
|
|
66173f87be | ||
|
|
3f49e26d19 | ||
|
|
a6f79dbc75 | ||
|
|
28b9112781 | ||
|
|
ebed18afef | ||
|
|
cedbe99513 | ||
|
|
82ae18b4b9 | ||
|
|
a16f1501d3 | ||
|
|
4027ac66cb | ||
|
|
911051e75d | ||
|
|
c193b30c8e | ||
|
|
e9c5f27b17 | ||
|
|
a75281aa13 | ||
|
|
7b6afa1128 | ||
|
|
45759e6ca4 | ||
|
|
75a03de4e3 | ||
|
|
480bc20ae7 | ||
|
|
934fb6b689 | ||
|
|
928753add8 | ||
|
|
ad54cecbac | ||
|
|
82b33a4d50 | ||
|
|
dd378b3ad8 | ||
|
|
f523e5651b | ||
|
|
01fd774b18 | ||
|
|
9ad704f50a | ||
|
|
8d4adbea42 | ||
|
|
bfd49cd7b7 | ||
|
|
209ac191c9 | ||
|
|
152f824e2e | ||
|
|
1c261bf0a2 | ||
|
|
1cbbbeb6b0 | ||
|
|
a819790899 | ||
|
|
2ee69406b6 | ||
|
|
c85cff720b | ||
|
|
5c0f350296 | ||
|
|
626b6c16e0 | ||
|
|
74aacbc1eb | ||
|
|
3c24b890a4 | ||
|
|
4ec19dbd70 | ||
|
|
f8ab674b84 | ||
|
|
866a31b89d | ||
|
|
4f296ac1e3 | ||
|
|
d6a6d1233c | ||
|
|
8f86a71c39 | ||
|
|
1cddc3c373 | ||
|
|
bd2669af4d | ||
|
|
65495a07b2 | ||
|
|
a30b6eaa02 | ||
|
|
9ddaa59155 | ||
|
|
5bf64fc5f3 | ||
|
|
824db2087c | ||
|
|
1135873968 | ||
|
|
e7e7881772 | ||
|
|
f7b274c1ec | ||
|
|
b561f46d2c | ||
|
|
b9c95437d2 | ||
|
|
7d8595b63f | ||
|
|
32d627fd6d | ||
|
|
09430c6f40 | ||
|
|
49998fa23d | ||
|
|
14077d26d7 | ||
|
|
40832ff1c3 | ||
|
|
0b8f856876 | ||
|
|
16ac16cd30 | ||
|
|
326a6042ec | ||
|
|
8efe2d19ba | ||
|
|
1c5b920e13 | ||
|
|
00f5d3adea | ||
|
|
f6ceff5444 | ||
|
|
9559a1b5e2 | ||
|
|
e752361f39 | ||
|
|
41c9ae30e9 | ||
|
|
03bc311403 | ||
|
|
366f716b1c | ||
|
|
3731fe8e40 | ||
|
|
3c416600a6 | ||
|
|
6f6ee59461 | ||
|
|
9aed7ec524 | ||
|
|
816c880e8e | ||
|
|
816910ca40 | ||
|
|
6eb3f8a3d9 | ||
|
|
303ece0529 | ||
|
|
fd13edae6d | ||
|
|
09492f452f | ||
|
|
b6bc5391cf | ||
|
|
ac91efc421 | ||
|
|
2fba3236ad | ||
|
|
18352caabe | ||
|
|
e9731ec691 | ||
|
|
175387f0d3 | ||
|
|
2d8a4432cc | ||
|
|
c146084f75 | ||
|
|
1fcd265eb9 | ||
|
|
1a1e9a80c3 | ||
|
|
d14d263e8f | ||
|
|
48bed9a9fe | ||
|
|
91dd3289a9 | ||
|
|
b969cae524 | ||
|
|
aaf9fd1bce | ||
|
|
b254c651a7 | ||
|
|
3af656b09f | ||
|
|
321b0d84ae | ||
|
|
6b4a4af5f1 | ||
|
|
faf8fec9c7 | ||
|
|
0a87f33d89 | ||
|
|
eacab2ced6 | ||
|
|
f796932cd8 | ||
|
|
17db827e3a | ||
|
|
722c2f9a5c | ||
|
|
fa43bc749e | ||
|
|
5b5916ff92 | ||
|
|
5ca7dc9678 | ||
|
|
39d1d80383 | ||
|
|
813ce24aeb | ||
|
|
3941ec61d3 | ||
|
|
4a3cb63263 | ||
|
|
5386724e0d | ||
|
|
85f3d90329 | ||
|
|
bb34a47fa8 | ||
|
|
7fae0e44ac | ||
|
|
80d21ed0a1 | ||
|
|
67fd787a14 | ||
|
|
86be6256a4 | ||
|
|
c65a3d2c40 | ||
|
|
9fe97f2b8a | ||
|
|
e5d44c13b4 | ||
|
|
f89c6bb259 | ||
|
|
b9966f82a0 | ||
|
|
84f4cd05f4 | ||
|
|
4d14d5a3d4 | ||
|
|
d72792fe0a | ||
|
|
48da6b9c67 | ||
|
|
e3f8590ba2 | ||
|
|
384483b14c | ||
|
|
eb3eae3fac | ||
|
|
dfa2c1c0e2 | ||
|
|
22f4d42c19 | ||
|
|
4a116e013c | ||
|
|
5fe0da1a65 | ||
|
|
7a6ac5f0be | ||
|
|
15f79d3d8b | ||
|
|
05914b147d | ||
|
|
abc0116945 | ||
|
|
b6bcb72165 | ||
|
|
ca30b20873 | ||
|
|
ec6e7f04f2 | ||
|
|
1cc0aafc1a | ||
|
|
abe3fc777c | ||
|
|
6354f7e189 | ||
|
|
3731b90f6c | ||
|
|
433485bcf0 | ||
|
|
f1f2dee701 | ||
|
|
2a17f2d333 | ||
|
|
788858f0c1 | ||
|
|
ee8955574f | ||
|
|
ac27a9ab36 | ||
|
|
2de3dc30bf | ||
|
|
4d30c4c58f | ||
|
|
0052dff119 | ||
|
|
3bdca88144 | ||
|
|
4b18429945 | ||
|
|
d9b2297eca | ||
|
|
b4282c2b4b | ||
|
|
8554fbd6e5 | ||
|
|
550bb7f0eb | ||
|
|
cc37fdde9a | ||
|
|
e351638e52 | ||
|
|
90a642c1c5 | ||
|
|
e150b81190 | ||
|
|
94578475ea | ||
|
|
92c491b742 | ||
|
|
eb93a2131f | ||
|
|
1e177580c9 | ||
|
|
7df9a6415a | ||
|
|
1179f4fcd4 | ||
|
|
709d32050e | ||
|
|
b9d84fa72b | ||
|
|
7abc10acde | ||
|
|
9be0e3b5c4 | ||
|
|
ed0f0fb759 | ||
|
|
2d80515ad5 | ||
|
|
50125f4659 | ||
|
|
a6da34740f | ||
|
|
7ed06ccdcf | ||
|
|
db07e0debb | ||
|
|
a0be094cbd | ||
|
|
7366d2e16b | ||
|
|
82aa8948cf | ||
|
|
84a3a9a5b5 | ||
|
|
b260065245 | ||
|
|
264316eb29 | ||
|
|
c625c80958 | ||
|
|
6a04d29eed | ||
|
|
10e28cc5e2 | ||
|
|
970678986a | ||
|
|
40e45f3a01 | ||
|
|
518b79bec6 | ||
|
|
01fb4e308a | ||
|
|
b6300ffa30 | ||
|
|
b163a07e84 | ||
|
|
157f03b655 | ||
|
|
42a3a53314 | ||
|
|
9b7ca3d692 | ||
|
|
e51a59a829 | ||
|
|
4a06fa82eb | ||
|
|
80238bb7a1 | ||
|
|
dcbd46531e | ||
|
|
0864b39336 | ||
|
|
2a0c96bb4c | ||
|
|
c53213a357 | ||
|
|
62cadbcfa0 | ||
|
|
d7aefc4110 | ||
|
|
e972a8dddb | ||
|
|
dc633783e0 | ||
|
|
e33ab71fac | ||
|
|
88b9375a4e | ||
|
|
f7a3e3f0f8 | ||
|
|
72df3dec3b | ||
|
|
b80ec5c6ac | ||
|
|
fbd3aff6d8 | ||
|
|
0ad79c9bc1 | ||
|
|
e175d28c2c | ||
|
|
8e3f09774a | ||
|
|
dbc54032f7 | ||
|
|
047b99e2aa | ||
|
|
1859078cf4 | ||
|
|
c44ba91ec7 | ||
|
|
96a6d0ee5d | ||
|
|
5619bb27a1 | ||
|
|
dfc99c7d15 | ||
|
|
fb82f505b6 | ||
|
|
5970340a17 | ||
|
|
9a77e76ff4 | ||
|
|
3591415d46 | ||
|
|
ab06205744 | ||
|
|
0689e680fa | ||
|
|
297d5aca1f | ||
|
|
0a023c1556 | ||
|
|
aa600af7b2 | ||
|
|
fc4aae8c0c | ||
|
|
24c0b5fa52 | ||
|
|
2af2af3460 |
@@ -5,40 +5,15 @@ integration testing, and infrastructure automation.
|
||||
|
||||
## Local Development
|
||||
|
||||
The entire application stack (frontend, backend, worker, database, minio, quickwit) runs fully containerized via Docker Compose.
|
||||
|
||||
### Start Development Environment
|
||||
|
||||
To start the stack (builds are handled automatically):
|
||||
Use the provided `papercrate.tmux` to spin up the full stack in one tmux session:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.dev.yml up --build
|
||||
tmux -f papercrate.tmux attach
|
||||
```
|
||||
|
||||
### Apply Code Changes
|
||||
|
||||
Hot-reloading is handled automatically by `cargo watch` inside the container.
|
||||
When you save files in `backend/src`, the watcher will:
|
||||
|
||||
1. Rebuild the modified binaries.
|
||||
2. Restart the `backend`, `worker`, and `webdav` services via `supervisord`.
|
||||
|
||||
No manual restart is required.
|
||||
|
||||
### Running Migrations
|
||||
|
||||
Since `diesel-cli` runs inside the container:
|
||||
|
||||
```bash
|
||||
# Run pending migrations
|
||||
docker compose -f docker-compose.dev.yml exec server diesel migration run
|
||||
|
||||
# Revert last migration
|
||||
docker compose -f docker-compose.dev.yml exec server diesel migration revert
|
||||
|
||||
# Create new migration
|
||||
docker compose -f docker-compose.dev.yml exec server diesel migration generate name_of_migration
|
||||
```
|
||||
This creates windows for the compose stack, frontend dev server, backend API, and
|
||||
background worker using the repository-relative paths defined in the tmux file.
|
||||
Detach with `Ctrl+b d` and reattach later with the same command.
|
||||
|
||||
The development Postgres container now seeds two database roles:
|
||||
|
||||
@@ -52,21 +27,21 @@ role with `SET ROLE papercrate_app_login;` before querying tenant tables.
|
||||
|
||||
## Backend Integration Tests
|
||||
|
||||
Integration tests run in a dedicated, ephemeral container stack. The repository includes a lightweight compose file that provisions a fresh Postgres instance (using tmpfs) and Quickwit for every run.
|
||||
|
||||
To run the tests:
|
||||
Integration tests require a running Postgres instance (and, optionally, Quickwit
|
||||
for OCR indexing). The repository includes a lightweight compose file for local
|
||||
runs:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.test.yml run --rm test-runner
|
||||
docker compose -f docker-compose.test.yml up -d
|
||||
export TEST_DATABASE_URL=postgres://papercrate:papercrate_test@localhost:5433/papercrate_test
|
||||
# optional, enables Quickwit indexing jobs
|
||||
export QUICKWIT_ENDPOINT=http://localhost:7280
|
||||
export QUICKWIT_INDEX=documents
|
||||
cargo test
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Spin up `postgres-test` and `quickwit-test` (in background if not running).
|
||||
2. Start the `test-runner` container.
|
||||
3. Wait for DB, run migrations, and execute `cargo test`.
|
||||
4. Remove the runner container after exit.
|
||||
Stop the database when you are done:
|
||||
|
||||
To clean up the infrastructure afterwards:
|
||||
```bash
|
||||
docker compose -f docker-compose.test.yml down
|
||||
```
|
||||
@@ -75,8 +50,14 @@ The compose service uses tmpfs storage, giving each test run a clean database.
|
||||
|
||||
## Runtime Dependencies
|
||||
|
||||
- `ocrmypdf`: Used by the worker to extract text from images. If missing, the worker logs a warning and skips text extraction for that document.
|
||||
- `Quickwit`: Used for full-text search. If configured (via `QUICKWIT_ENDPOINT`), the worker pushes extracted text to the index. If missing, search features will simply be unavailable.
|
||||
- `ocrmypdf` (optional but recommended): Used by the OCR worker to extract text
|
||||
from PDFs when no embedded text layer is available. Ensure it is installed and
|
||||
available on the worker hosts if OCR is desired.
|
||||
- Quickwit (optional): The Quickwit indexer is used to ingest extracted text for
|
||||
search. Set `QUICKWIT_ENDPOINT` and `QUICKWIT_INDEX` in the environment when
|
||||
running workers if you want indexing jobs to run. The local compose file starts
|
||||
a Quickwit instance on `http://localhost:7280` and seeds the `documents` index
|
||||
automatically.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -95,8 +76,9 @@ runtime settings in staging without exposing credentials.
|
||||
|
||||
## Running Migrations in Kubernetes
|
||||
|
||||
The backend container image ships with the `papercrate-admin` binary, which can execute schema migrations
|
||||
as a short-lived Job (or Helm hook) before rolling out new pods. Example manifest:
|
||||
The backend container image ships the `diesel` CLI, so schema migrations can be
|
||||
executed as a short-lived Job (or Helm hook) before rolling out new pods. Example
|
||||
manifest:
|
||||
|
||||
```yaml
|
||||
apiVersion: batch/v1
|
||||
@@ -110,19 +92,16 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: ghcr.io/example/papercrate-backend:<TAG>
|
||||
command: ["/usr/local/bin/papercrate-admin", "migrate-database"]
|
||||
command: ["/usr/local/bin/diesel", "migration", "run"]
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: papercrate-db
|
||||
key: DATABASE_URL
|
||||
|
||||
- name: MIGRATIONS_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: papercrate-db
|
||||
key: DATABASE_URL
|
||||
```
|
||||
|
||||
Run the Job manually or use the Helm hooks configured in `k8s/papercrate/templates/migrate-job.yaml`. The `papercrate-admin` binary is built specifically for administrative tasks.
|
||||
Run the Job manually (`kubectl apply -f migrate-job.yaml`) or configure it as a
|
||||
Helm pre-install/pre-upgrade hook so migrations run automatically on each
|
||||
deployment. Once the Job succeeds, deploy/update the backend `Deployment` as
|
||||
usual.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
target/
|
||||
@@ -1,192 +1,82 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Global Arguments
|
||||
# ------------------------------------------------------------------------------
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
ARG RUST_VERSION=1
|
||||
ARG RUNTIME_DEPS="ocrmypdf tesseract-ocr ghostscript qpdf ffmpeg"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Base Stage: Shared Logic (PDFium)
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-slim AS base
|
||||
ARG RUNTIME_DEPS
|
||||
WORKDIR /app
|
||||
|
||||
# Install PDFium
|
||||
ARG TARGETARCH
|
||||
RUN set -eux; \
|
||||
case "${TARGETARCH}" in \
|
||||
amd64|x86_64) pdfium_package=pdfium-linux-x64.tgz ;; \
|
||||
arm64|aarch64) pdfium_package=pdfium-linux-arm64.tgz ;; \
|
||||
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates; \
|
||||
curl -fsSL "https://github.com/bblanchon/pdfium-binaries/releases/latest/download/${pdfium_package}" -o /tmp/pdfium.tgz; \
|
||||
mkdir -p /tmp/pdfium; \
|
||||
tar -xzf /tmp/pdfium.tgz -C /tmp/pdfium --strip-components=1; \
|
||||
pdfium_so="$(find /tmp/pdfium -name libpdfium.so -type f | head -n1)"; \
|
||||
[ -n "${pdfium_so}" ]; \
|
||||
mkdir -p /usr/local/lib; \
|
||||
cp "${pdfium_so}" /usr/local/lib/libpdfium.so; \
|
||||
rm -rf /tmp/pdfium.tgz /tmp/pdfium
|
||||
|
||||
# Install common build dependencies AND runtime deps (for dev/testing)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libpq-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
zlib1g-dev \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
${RUNTIME_DEPS} \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Development Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Chef Stage: Install cargo-chef (used for caching)
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS chef
|
||||
RUN cargo install cargo-chef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Planner Stage: Compute lockfile recipe
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Cacher Stage: Build dependencies only
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM chef AS cacher
|
||||
ENV CARGO_TARGET_DIR=/cargo-target
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
# Build dependencies (including test deps) based on the recipe
|
||||
RUN cargo chef cook --tests --recipe-path recipe.json
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Development Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS development
|
||||
WORKDIR /app
|
||||
|
||||
# Install additional development tools
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
procps \
|
||||
postgresql-client \
|
||||
supervisor \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install diesel-cli for migrations
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
# Install cargo-watch for hot reloading
|
||||
RUN cargo install cargo-watch
|
||||
|
||||
# Setup Cache
|
||||
ENV CARGO_TARGET_DIR=/cargo-target
|
||||
COPY --from=cacher /cargo-target /cargo-target
|
||||
COPY --from=cacher /usr/local/cargo /usr/local/cargo
|
||||
|
||||
# Copy PDFium from base
|
||||
COPY --from=base /usr/local/lib/libpdfium.so /usr/local/lib/libpdfium.so
|
||||
ENV LD_LIBRARY_PATH=/usr/local/lib
|
||||
RUN ldconfig
|
||||
|
||||
ENV RUST_LOG=info
|
||||
CMD ["./run-dev.sh"]
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Production Builder Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
# We restart from base to keep the image clean, but copy PDFium if needed for build/tests
|
||||
FROM base AS builder
|
||||
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-slim AS builder
|
||||
ARG TARGETARCH
|
||||
ENV TARGETARCH=${TARGETARCH}
|
||||
WORKDIR /app
|
||||
|
||||
# Resolve cross-compilation target script
|
||||
RUN cat <<'SCRIPT' >/usr/local/bin/resolve-target.sh
|
||||
#!/bin/sh
|
||||
set -e
|
||||
case "$1" in
|
||||
amd64) echo x86_64-unknown-linux-gnu ;;
|
||||
arm64) echo aarch64-unknown-linux-gnu ;;
|
||||
*) echo "Unsupported TARGETARCH: $1" >&2; exit 1 ;;
|
||||
amd64)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
;;
|
||||
arm64)
|
||||
echo aarch64-unknown-linux-gnu
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported TARGETARCH: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
SCRIPT
|
||||
RUN chmod +x /usr/local/bin/resolve-target.sh
|
||||
|
||||
# Install cross-compilation deps
|
||||
ARG BUILDPLATFORM
|
||||
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
|
||||
echo "x86_64-linux-gnu" > /tmp/target_deb_arch; \
|
||||
elif [ "${TARGETARCH}" = "arm64" ]; then \
|
||||
echo "aarch64-linux-gnu" > /tmp/target_deb_arch; \
|
||||
else \
|
||||
echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1; \
|
||||
fi
|
||||
ENV PKG_CONFIG_ALLOW_CROSS=1 \
|
||||
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig \
|
||||
PKG_CONFIG_PATH_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig \
|
||||
PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu=/usr/aarch64-linux-gnu \
|
||||
OPENSSL_DIR_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu \
|
||||
OPENSSL_LIB_DIR_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu \
|
||||
OPENSSL_INCLUDE_DIR_aarch64_unknown_linux_gnu=/usr/include/aarch64-linux-gnu \
|
||||
CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc \
|
||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc \
|
||||
PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu=/usr/lib/x86_64-linux-gnu/pkgconfig \
|
||||
PKG_CONFIG_PATH_x86_64_unknown_linux_gnu=/usr/lib/x86_64-linux-gnu/pkgconfig \
|
||||
OPENSSL_DIR_x86_64_unknown_linux_gnu=/usr/lib/x86_64-linux-gnu \
|
||||
OPENSSL_LIB_DIR_x86_64_unknown_linux_gnu=/usr/lib/x86_64-linux-gnu \
|
||||
OPENSSL_INCLUDE_DIR_x86_64_unknown_linux_gnu=/usr/include/x86_64-linux-gnu
|
||||
|
||||
RUN set -eux; \
|
||||
# Detect build arch (assuming debian-like names compatible with apt)
|
||||
dpkg_arch="$(dpkg --print-architecture)"; \
|
||||
target_deb_arch="$(cat /tmp/target_deb_arch)"; \
|
||||
\
|
||||
# If we are cross-compiling
|
||||
if [ "${dpkg_arch}" != "${TARGETARCH}" ]; then \
|
||||
# Map target arch to debian package arch suffix if needed, but usually apt handles :arch
|
||||
# For cross-compiling, we need to add the architecture
|
||||
dpkg --add-architecture "${TARGETARCH}"; \
|
||||
apt-get update; \
|
||||
\
|
||||
case "${TARGETARCH}" in \
|
||||
amd64) TARGET_DEB_ARCH=amd64 ;; \
|
||||
arm64) TARGET_DEB_ARCH=arm64 ;; \
|
||||
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
BUILD_DEB_ARCH="$(dpkg --print-architecture)"; \
|
||||
if [ "${TARGET_DEB_ARCH}" != "${BUILD_DEB_ARCH}" ]; then \
|
||||
dpkg --add-architecture "${TARGET_DEB_ARCH}"; \
|
||||
fi; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
curl \
|
||||
libssl-dev \
|
||||
libpq-dev \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
zlib1g-dev; \
|
||||
if [ "${TARGET_DEB_ARCH}" != "${BUILD_DEB_ARCH}" ]; then \
|
||||
case "${TARGETARCH}" in \
|
||||
arm64) CROSS_GCC=gcc-aarch64-linux-gnu ;; \
|
||||
amd64) CROSS_GCC=gcc-x86-64-linux-gnu ;; \
|
||||
esac; \
|
||||
\
|
||||
apt-get install -y --no-install-recommends \
|
||||
"${CROSS_GCC}" \
|
||||
"libc6-dev:${TARGETARCH}" \
|
||||
"libssl-dev:${TARGETARCH}" \
|
||||
"libpq-dev:${TARGETARCH}" \
|
||||
"libjpeg-dev:${TARGETARCH}" \
|
||||
"libpng-dev:${TARGETARCH}" \
|
||||
"zlib1g-dev:${TARGETARCH}"; \
|
||||
\
|
||||
# Configure PKG_CONFIG and LINKER to find foreign libraries
|
||||
case "${TARGETARCH}" in \
|
||||
"amd64") \
|
||||
GNU_ARCH="x86_64-linux-gnu" \
|
||||
RUST_ARCH="x86_64_unknown_linux_gnu" \
|
||||
RUST_ARCH_UPPER="X86_64_UNKNOWN_LINUX_GNU" \
|
||||
;; \
|
||||
"arm64") \
|
||||
GNU_ARCH="aarch64-linux-gnu" \
|
||||
RUST_ARCH="aarch64_unknown_linux_gnu" \
|
||||
RUST_ARCH_UPPER="AARCH64_UNKNOWN_LINUX_GNU" \
|
||||
;; \
|
||||
esac; \
|
||||
\
|
||||
{ \
|
||||
echo "export PKG_CONFIG_ALLOW_CROSS=1"; \
|
||||
echo "export PKG_CONFIG_PATH=/usr/lib/${GNU_ARCH}/pkgconfig"; \
|
||||
echo "export OPENSSL_DIR=/usr/lib/${GNU_ARCH}"; \
|
||||
echo "export OPENSSL_LIB_DIR=/usr/lib/${GNU_ARCH}"; \
|
||||
echo "export OPENSSL_INCLUDE_DIR=/usr/include/${GNU_ARCH}"; \
|
||||
echo "export CARGO_TARGET_${RUST_ARCH_UPPER}_LINKER=${GNU_ARCH}-gcc"; \
|
||||
echo "export CC_${RUST_ARCH}=${GNU_ARCH}-gcc"; \
|
||||
echo "export CXX_${RUST_ARCH}=${GNU_ARCH}-g++"; \
|
||||
} >> /etc/profile; \
|
||||
"libc6-dev:${TARGET_DEB_ARCH}" \
|
||||
"libssl-dev:${TARGET_DEB_ARCH}" \
|
||||
"libpq-dev:${TARGET_DEB_ARCH}" \
|
||||
"libjpeg-dev:${TARGET_DEB_ARCH}" \
|
||||
"libpng-dev:${TARGET_DEB_ARCH}" \
|
||||
"zlib1g-dev:${TARGET_DEB_ARCH}"; \
|
||||
fi; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PKG_CONFIG_ALLOW_CROSS=1
|
||||
|
||||
COPY Cargo.toml Cargo.lock build.rs ./
|
||||
COPY src ./src
|
||||
COPY migrations ./migrations
|
||||
@@ -195,9 +85,6 @@ COPY resources ./resources
|
||||
COPY diesel.toml ./
|
||||
|
||||
RUN set -eux; \
|
||||
echo "Loading cross-compilation environment..."; \
|
||||
. /etc/profile; \
|
||||
export PATH="$PATH:/usr/local/cargo/bin"; \
|
||||
TARGET="$(/usr/local/bin/resolve-target.sh "${TARGETARCH}")"; \
|
||||
rustup target add "${TARGET}"; \
|
||||
cargo build --release --target "${TARGET}" --bin backend --bin worker --bin webdav --bin admin; \
|
||||
@@ -206,18 +93,37 @@ RUN set -eux; \
|
||||
cp "target/${TARGET}/release/${bin}" "/artifacts/${bin}"; \
|
||||
done
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Production Runtime Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM debian:trixie-slim AS runtime
|
||||
RUN set -eux; \
|
||||
case "${TARGETARCH}" in \
|
||||
amd64) pdfium_package=pdfium-linux-x64.tgz ;; \
|
||||
arm64) pdfium_package=pdfium-linux-arm64.tgz ;; \
|
||||
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
curl -fsSL "https://github.com/bblanchon/pdfium-binaries/releases/latest/download/${pdfium_package}" -o /tmp/pdfium.tgz; \
|
||||
mkdir -p /tmp/pdfium; \
|
||||
tar -xzf /tmp/pdfium.tgz -C /tmp/pdfium --strip-components=1; \
|
||||
pdfium_so="$(find /tmp/pdfium -name libpdfium.so -type f | head -n1)"; \
|
||||
[ -n "${pdfium_so}" ]; \
|
||||
cp "${pdfium_so}" /artifacts/libpdfium.so; \
|
||||
rm -rf /tmp/pdfium.tgz /tmp/pdfium
|
||||
|
||||
FROM --platform=$TARGETPLATFORM debian:trixie-slim AS runtime
|
||||
ARG TARGETARCH
|
||||
ARG RUNTIME_DEPS
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl libssl3 libpq5 libjpeg62-turbo libpng16-16 \
|
||||
${RUNTIME_DEPS} \
|
||||
ca-certificates \
|
||||
curl \
|
||||
libssl3 \
|
||||
libpq5 \
|
||||
libjpeg62-turbo \
|
||||
libpng16-16 \
|
||||
ocrmypdf \
|
||||
tesseract-ocr \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /usr/local/lib \
|
||||
&& useradd --system --create-home --uid 10001 appuser
|
||||
@@ -226,8 +132,7 @@ COPY --from=builder /artifacts/backend /usr/local/bin/papercrate-backend
|
||||
COPY --from=builder /artifacts/worker /usr/local/bin/papercrate-worker
|
||||
COPY --from=builder /artifacts/webdav /usr/local/bin/papercrate-webdav
|
||||
COPY --from=builder /artifacts/admin /usr/local/bin/papercrate-admin
|
||||
COPY --from=base /usr/local/lib/libpdfium.so /usr/local/lib/libpdfium.so
|
||||
|
||||
COPY --from=builder /artifacts/libpdfium.so /usr/local/lib/libpdfium.so
|
||||
RUN ldconfig
|
||||
COPY migrations ./migrations
|
||||
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
[print_schema]
|
||||
file = "src/schema.rs"
|
||||
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
|
||||
|
||||
[migrations_directory]
|
||||
dir = "migrations"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Waiting for Postgres..."
|
||||
until pg_isready -h postgres -U papercrate; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Running migrations..."
|
||||
diesel migration run
|
||||
|
||||
echo "Building binaries for first run..."
|
||||
cargo build --bin backend --bin worker --bin webdav
|
||||
|
||||
echo "Starting supervisord..."
|
||||
exec supervisord -c supervisord.conf
|
||||
@@ -1,67 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[unix_http_server]
|
||||
file=/var/run/supervisor.sock
|
||||
chmod=0700
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///var/run/supervisor.sock
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Applications
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[program:backend]
|
||||
command=/cargo-target/debug/backend
|
||||
directory=/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:worker]
|
||||
command=/cargo-target/debug/worker
|
||||
directory=/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:webdav]
|
||||
command=/cargo-target/debug/webdav
|
||||
directory=/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Watcher
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[program:watcher]
|
||||
# 1. Check syntax
|
||||
# 2. Build binaries
|
||||
# 3. Restart services via supervisorctl
|
||||
command=cargo watch -w src -x check -x "build --bin backend --bin worker --bin webdav" -s "supervisorctl restart backend worker webdav"
|
||||
directory=/app
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -1,17 +1,3 @@
|
||||
x-backend-env: &backend-env
|
||||
DATABASE_URL: postgres://papercrate:papercrate_dev@postgres:5432/papercrate
|
||||
DATABASE_MAX_POOL_SIZE: 2
|
||||
AWS_ENDPOINT_URL: http://minio:9000
|
||||
AWS_ACCESS_KEY_ID: minioadmin
|
||||
AWS_SECRET_ACCESS_KEY: minioadmin
|
||||
AWS_REGION: us-east-1
|
||||
S3_BUCKET: documents
|
||||
PROXY_DOWNLOADS: "true"
|
||||
JWT_SECRET: change-me-super-secret
|
||||
QUICKWIT_ENDPOINT: http://quickwit:7280
|
||||
WEBAUTHN_RP_ID: localhost
|
||||
WEBAUTHN_ORIGIN: http://localhost:5173
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
@@ -76,49 +62,32 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
server:
|
||||
admin-bootstrap:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
network: host
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
environment:
|
||||
<<: *backend-env
|
||||
RUST_LOG: info
|
||||
SERVER_HOST: 0.0.0.0
|
||||
SERVER_PORT: 3000
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
quickwit:
|
||||
condition: service_healthy
|
||||
createbuckets:
|
||||
condition: service_completed_successfully
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
network: host
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
- /app/dist
|
||||
ports:
|
||||
- "5173:5173"
|
||||
environment:
|
||||
API_PROXY_PASS: http://server:3000
|
||||
depends_on:
|
||||
server:
|
||||
condition: service_started
|
||||
DATABASE_URL: postgres://papercrate:papercrate_dev@postgres:5432/papercrate
|
||||
DATABASE_MAX_POOL_SIZE: 2
|
||||
AWS_ENDPOINT_URL: http://minio:9000
|
||||
AWS_ACCESS_KEY_ID: minioadmin
|
||||
AWS_SECRET_ACCESS_KEY: minioadmin
|
||||
AWS_REGION: us-east-1
|
||||
S3_BUCKET: documents
|
||||
JWT_SECRET: change-me-super-secret
|
||||
QUICKWIT_ENDPOINT: http://quickwit:7280
|
||||
entrypoint: []
|
||||
command: >
|
||||
/bin/sh -c "
|
||||
echo 'Running database migrations' &&
|
||||
diesel migration run
|
||||
"
|
||||
user: root
|
||||
restart: "no"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
@@ -31,33 +31,28 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
test-runner:
|
||||
admin-bootstrap:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
depends_on:
|
||||
postgres-test:
|
||||
condition: service_healthy
|
||||
quickwit-test:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- /app/target
|
||||
environment:
|
||||
TEST_DATABASE_URL: postgres://papercrate:papercrate_test@postgres-test:5432/papercrate_test
|
||||
DATABASE_URL: postgres://papercrate:papercrate_test@postgres-test:5432/papercrate_test
|
||||
DATABASE_MAX_POOL_SIZE: 1
|
||||
S3_BUCKET: documents
|
||||
JWT_SECRET: change-me-super-secret
|
||||
QUICKWIT_ENDPOINT: http://quickwit-test:7280
|
||||
RUST_LOG: info
|
||||
entrypoint: []
|
||||
command: >
|
||||
/bin/bash -c "
|
||||
echo 'Waiting for Postgres...' &&
|
||||
until pg_isready -h postgres-test -U papercrate; do sleep 1; done &&
|
||||
echo 'Running tests...' &&
|
||||
cargo test
|
||||
/bin/sh -c "
|
||||
echo 'Running database migrations' &&
|
||||
diesel migration run
|
||||
"
|
||||
user: root
|
||||
restart: "no"
|
||||
|
||||
volumes:
|
||||
quickwit_test_data:
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 683 KiB |
|
Before Width: | Height: | Size: 557 KiB After Width: | Height: | Size: 1.1 MiB |
@@ -3,32 +3,16 @@
|
||||
ARG NODE_IMAGE=node:20-alpine
|
||||
ARG NGINX_IMAGE=nginx:alpine
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Base Stage: Install Dependencies
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} AS base
|
||||
FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
RUN npm ci --no-audit --no-fund
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Development Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS development
|
||||
EXPOSE 5173
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Build Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS build
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Runtime Stage
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM ${NGINX_IMAGE} AS runtime
|
||||
FROM ${NGINX_IMAGE}
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
COPY --from=build /app/dist ./
|
||||
|
||||
@@ -65,7 +65,7 @@ module.exports = {
|
||||
proxy: [
|
||||
{
|
||||
context: ['/api', '/download'],
|
||||
target: process.env.API_PROXY_PASS,
|
||||
target: 'http://127.0.0.1:3000',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# tmux session for Papercrate dev stack
|
||||
new-session -d -s papercrate -n docker -c . 'docker compose -f docker-composer.dev.yml up'
|
||||
|
||||
new-window -t papercrate:1 -n frontend -c ./frontend 'npm run dev'
|
||||
|
||||
new-window -t papercrate:2 -n backend -c ./backend 'cargo run --bin backend'
|
||||
|
||||
new-window -t papercrate:3 -n worker -c ./backend 'cargo run --bin worker'
|
||||
|
||||
select-window -t papercrate:0
|
||||
attach-session -t papercrate
|
||||