Commit Graph

8763 Commits

Author SHA1 Message Date
Girish Ramakrishnan
cc759a8427 Add waiting for lock message 2024-12-09 08:40:54 +01:00
Girish Ramakrishnan
bb392207ea remove global lock
Currently, the update/apptask/fullbackup/platformstart take a
global lock and cannot run in parallel. This causes situations
where when a user tries to trigger an apptask, it says "waiting for
backup to finish..." etc

The solution is to let them run in parallel. We need a lock at the
app level as app operations running in parallel would be bad (tm).
In addition, the update task needs a lock just for the update part.
We also need multi-process locks. Running tasks as processes is core
to our "kill" strategy.

Various inter process locks were explored:

* node's IPC mechanism with process.send(). But this only works for direct node.js
children. taskworker is run via sudo and the IPC does not work.

* File lock using O_EXCL. Basic ideas to create lock files. While file creation
can be done atomically, it becomes complicated to clean up lock files when
the tasks crash. We need a way to know what locks were held by the crashing task.
flock and friends are not built-into node.js

* sqlite/redis were options but introduce additional deps

* Settled on MySQL based locking. Initial plan was to have row locks
or table locks. Each row is a kind of lock. While implementing, it was found that
we need many types of locks (and not just update lock and app locks). For example,
we need locks for each task type, so that only one task type is active at a time.

* Instead of rows, we can just lock table and have a json blob in it. This hit a road
block that LOCK TABLE is per session and our db layer cannot handle this easily! i.e
when issing two db.query() it might use two different connections from the pool. We have to
expose the connection, release connection etc.

* Next idea was atomic blob update of the blob checking if old blob was same. This approach,
was finally refined into a version field.

Phew!
2024-12-07 20:41:22 +01:00
Johannes Zellner
146afce934 Improve devices error handling 2024-12-06 13:35:52 +01:00
Johannes Zellner
fbed850acc Also validate devices in the setter route 2024-12-05 15:16:06 +01:00
Johannes Zellner
8493022f75 Allow apps to specify custom devices 2024-12-05 14:21:07 +01:00
Girish Ramakrishnan
e4fb040ddf make tests great again 2024-12-04 16:36:05 +01:00
Girish Ramakrishnan
2bfa49cc2e applinks: add tests 2024-12-04 16:17:07 +01:00
Girish Ramakrishnan
3b9d617e37 groups: add events to eventlog 2024-12-04 11:30:30 +01:00
Girish Ramakrishnan
fdf8025a02 style: remove -> del 2024-12-03 17:36:50 +01:00
Girish Ramakrishnan
0a4aede3a8 eventlog: branding events 2024-12-02 12:18:09 +01:00
Girish Ramakrishnan
872705d58d oidc: use the cloudron name as provider name 2024-12-02 12:01:19 +01:00
Girish Ramakrishnan
ca5776e6f3 services: fix oidc usage 2024-12-02 11:00:12 +01:00
Girish Ramakrishnan
1230e5c9e7 oidc: add load pattern 2024-12-02 08:36:03 +01:00
Girish Ramakrishnan
dc3d23c27b oidc: flatten the export list 2024-12-02 08:31:35 +01:00
Girish Ramakrishnan
1ecb853309 mail: attachment search 2024-11-30 17:42:26 +01:00
Girish Ramakrishnan
2a6c52800b system: filesystems in exclude are excluded from content analysis
some disks can be very slow and noisy (at home). this allows users to simply skip them.
also, applicable for large storage boxes
2024-11-30 13:08:21 +01:00
Girish Ramakrishnan
320ddfda2e compute docker df only once 2024-11-30 12:44:15 +01:00
Girish Ramakrishnan
40febc8ef2 system: rename DISK_TYPES to FS_TYPES 2024-11-30 12:04:07 +01:00
Girish Ramakrishnan
56f6519b3e rename disks to filesystems 2024-11-30 12:04:04 +01:00
Girish Ramakrishnan
f219abf082 system: indent cache file 2024-11-30 11:11:54 +01:00
Girish Ramakrishnan
742a04d149 system: expose getDisks only for tests 2024-11-30 10:42:06 +01:00
Girish Ramakrishnan
26caacc12e Fix debugs 2024-11-30 10:18:48 +01:00
Girish Ramakrishnan
1497518867 better assert message 2024-11-30 10:18:40 +01:00
Johannes Zellner
1a4a69f365 update postgres to add pgvector extension 2024-11-28 17:37:22 +01:00
Girish Ramakrishnan
78520e09c3 domains: add inwx provider 2024-11-26 19:13:33 +05:30
Girish Ramakrishnan
f0207ff161 test: comment it out, it is not run anyway 2024-11-26 15:54:55 +05:30
Girish Ramakrishnan
ccd1a4319d lint 2024-11-21 19:18:26 +05:30
Girish Ramakrishnan
22be1f1b72 sqlite: create dumps based on the basename 2024-11-21 12:34:06 +05:30
Girish Ramakrishnan
7095862601 sqlite: add some comments 2024-11-21 12:24:27 +05:30
Girish Ramakrishnan
fa98e0570f sqlite: change path to paths 2024-11-21 10:02:26 +05:30
Girish Ramakrishnan
4316d3eade add sqlite3 addon take 2
- there is no container id during the addon lifecycle
- sqlite3 requires the localstorage addon to be inited. so this has to
  become like the ftp option
- remove all that child_process streaming stuff. too complicated
2024-11-21 00:13:17 +05:30
Girish Ramakrishnan
f8cd0b5f52 add sqlite3 addon 2024-11-21 00:13:17 +05:30
Johannes Zellner
78cb36ea0e Start using POST /api/v1/apps to install 2024-11-20 16:18:37 +01:00
Girish Ramakrishnan
b4d58f0609 aws: add a 20min timeout
in some services like b2, the multi-part copy just hangs. this allows
us to retry
2024-11-20 07:13:43 +05:30
Girish Ramakrishnan
18abc214a6 mail: update haraka to 3.0.5 2024-11-20 06:32:13 +05:30
Girish Ramakrishnan
5e3857fd3d Fix assert
NETWORK_ERROR is usually an AggregateError which causes an
assert in BoxError
2024-11-19 17:08:55 +05:30
Johannes Zellner
e35b36643c Add more oidc debugs 2024-11-18 18:09:01 +01:00
Johannes Zellner
16fa339025 Add refresh_token grant type 2024-11-18 18:07:32 +01:00
Girish Ramakrishnan
051b0e0fd3 oidc: set a refresh token ttl to avoid warning
oidc-provider NOTICE: default ttl.RefreshToken function called, you SHOULD change it in order to define the expiration for RefreshToken artifacts.
2024-11-18 15:29:14 +05:30
Girish Ramakrishnan
62d3212f88 applink: add timeout when detecting metadata 2024-11-18 08:18:39 +05:30
Girish Ramakrishnan
fd96665e97 rsync: show better error message with too many empty dirs, symlinks or executables 2024-11-18 08:11:14 +05:30
Girish Ramakrishnan
8f6637773b shell: add option for maxLines 2024-11-18 07:59:05 +05:30
Johannes Zellner
7b61bafab7 Fix oidc login layout for long instance names 2024-11-06 17:15:03 +01:00
Girish Ramakrishnan
6407d795ed du: better error handling of du
du can fail when files and directories go missing. luckily, when du fails,
it still provides the best effort output
2024-11-06 14:54:52 +01:00
Girish Ramakrishnan
9cf235af39 boxerror: assign extra fields in all cases 2024-11-06 13:40:37 +01:00
Johannes Zellner
18e5365104 Fix typo 2024-11-05 14:24:40 +01:00
Johannes Zellner
c03eff8da2 shell.js using argument array list now 2024-11-05 13:09:27 +01:00
Johannes Zellner
28f79cd6c9 return early if docker ps returns nothing 2024-11-05 13:05:12 +01:00
Girish Ramakrishnan
fc2786b07f taskworker: fix programming error 2024-11-01 16:15:32 +01:00
Girish Ramakrishnan
4a207395ca middleground in timeout
DO BLR droplets still fail with 1s timeout!
2024-10-31 10:22:55 +01:00