Commit Graph

1190 Commits

Author SHA1 Message Date
Girish Ramakrishnan
5342dae5b3 tokens: add ip restriction 2025-03-07 17:50:50 +01:00
Girish Ramakrishnan
f0848e23c7 replace validator module 2025-03-07 12:32:50 +01:00
Girish Ramakrishnan
1197693591 test: add root dn response 2025-02-26 14:14:42 +01:00
Girish Ramakrishnan
81f91f3324 lint 2025-02-26 14:03:30 +01:00
Girish Ramakrishnan
d75e95a23d superagent: rewrite using native node request
the learning is that fetch() is really meant to be a browser side
XMLHttpRequest replacement. It's complicated to do things like
setting user agent, custom headers like Host, disabling tls validation etc.
2025-02-18 16:23:06 +01:00
Girish Ramakrishnan
cceae6770c superagent: multipart requires content-type to be unset 2025-02-15 16:11:55 +01:00
Girish Ramakrishnan
4cfa658fde add some superagent tests 2025-02-15 15:54:39 +01:00
Girish Ramakrishnan
8e58349bfa replace with custom superagent based on fetch API 2025-02-15 15:14:09 +01:00
Girish Ramakrishnan
221181092e tasks -> changes 2025-02-13 17:28:10 +01:00
Girish Ramakrishnan
b94ce542c3 syncer: simply return the changes
this is easier to test. the initial code wanted to make the changes a stream.
but this never happenned since the need never arose
2025-02-13 17:06:24 +01:00
Girish Ramakrishnan
bd5ecf358a tests: tests for underscore 2025-02-13 14:51:51 +01:00
Girish Ramakrishnan
dd5e4adc73 replace underscore with our own
we only need like 5 simple functions
2025-02-13 14:14:34 +01:00
Girish Ramakrishnan
a138425298 storage: start migration of s3 api 2025-02-12 23:04:37 +01:00
Girish Ramakrishnan
9888aa8c08 storage: rework listDir api to be a generator (like) function 2025-02-12 19:34:57 +01:00
Girish Ramakrishnan
bd44bb4534 groups: add app access tests 2025-02-12 14:21:46 +01:00
Girish Ramakrishnan
7322006455 test: fix route53 tests 2025-02-11 11:29:43 +01:00
Girish Ramakrishnan
c6e93b9870 test: enable nock as needed 2025-02-06 15:01:59 +01:00
Girish Ramakrishnan
f64297c256 test: readdirp signature has changed 2025-02-06 15:01:41 +01:00
Girish Ramakrishnan
fa64191082 assert.strictEqual results in oom, go figure 2025-02-05 19:11:02 +01:00
Girish Ramakrishnan
aa54e47029 tests: enable nock when needed
by default, it makes all requests disappear
2025-02-05 18:27:57 +01:00
Girish Ramakrishnan
7bcb6dd7cb unused require 2025-02-05 17:27:07 +01:00
Girish Ramakrishnan
73e1e6881e docker: fix parsing of imageRef if no namespace 2025-01-03 10:10:06 +01:00
Girish Ramakrishnan
1e2ca7b835 volumes: test host path validation 2025-01-02 11:46:11 +01:00
Girish Ramakrishnan
5898436638 test: fix dockerproxy 2024-12-19 13:10:14 +01:00
Girish Ramakrishnan
ba6ba44955 use enum for access levels 2024-12-19 12:24:08 +01:00
Girish Ramakrishnan
0008e5a83b docker: parse registry also 2024-12-14 14:10:29 +01:00
Girish Ramakrishnan
5ce82d6794 docker: parseImageRef 2024-12-14 14:00:05 +01:00
Girish Ramakrishnan
f59837f7c3 spurious console 2024-12-11 22:44:04 +01:00
Girish Ramakrishnan
d0d0913c70 notifications: add context field 2024-12-11 22:29:00 +01:00
Girish Ramakrishnan
746e694d7e notifications: rename alert to pin and unpin 2024-12-11 17:31:32 +01:00
Girish Ramakrishnan
ead419003b notifications: rename ALERT_ to TYPE_ 2024-12-11 15:29:20 +01:00
Girish Ramakrishnan
41bc08a07e backup: move appConfig to backups table
this is useful for clone also to copy notes, operators, checklist
of the time when the backup was made (as opposed to current)

at this point, it's not clear why we need a archives table. it's
an optimization to not have to store icon for every backup.
2024-12-10 21:04:37 +01:00
Girish Ramakrishnan
f973536f7f archives: add eventlog 2024-12-10 11:10:35 +01:00
Girish Ramakrishnan
490840b71d archives: use separate table
Cleaner to separate things from the backups table.

* icon, appConfig, appStoreIcon etc are only valid for archives
* older version cloudron does not have appConfig in backups table (so it
  cannot be an archive entry)
2024-12-10 10:36:44 +01:00
Girish Ramakrishnan
2ad93c114e archive: add appConfig, icon and appStoreIcon 2024-12-09 23:25:31 +01:00
Girish Ramakrishnan
147e014205 backup: add archive flag 2024-12-09 16:25:31 +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
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
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
56f6519b3e rename disks to filesystems 2024-11-30 12:04:04 +01:00
Girish Ramakrishnan
742a04d149 system: expose getDisks only for tests 2024-11-30 10:42:06 +01:00
Girish Ramakrishnan
8f6637773b shell: add option for maxLines 2024-11-18 07:59:05 +05:30
Girish Ramakrishnan
df5ba25010 shell: add explicit bash() function 2024-10-16 10:40:17 +02:00
Girish Ramakrishnan
6c3ca9c364 shell: rework code to use shell.spawn
spawn gives out streams and we have more control over the stdout/stderr
buffers. otherwise, we have to provide a max buffer capture size to exec
2024-10-15 12:13:46 +02:00
Girish Ramakrishnan
a9e1d7641d shell: make require take a tag 2024-10-14 21:08:32 +02:00