Commit Graph

446 Commits

Author SHA1 Message Date
Girish Ramakrishnan
7674e23580 Fix superagent use 2025-04-15 13:53:27 +02:00
Girish Ramakrishnan
5342dae5b3 tokens: add ip restriction 2025-03-07 17:50:50 +01:00
Girish Ramakrishnan
8e58349bfa replace with custom superagent based on fetch API 2025-02-15 15:14:09 +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
d0d0913c70 notifications: add context field 2024-12-11 22:29:00 +01:00
Girish Ramakrishnan
6004cd17bf notifications: per user email prefs 2024-12-11 19:12: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
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
cec2106cfe update the schema file 2024-12-09 22:42:22 +01:00
Girish Ramakrishnan
147e014205 backup: add archive flag 2024-12-09 16:25:31 +01:00
Girish Ramakrishnan
65a7f5f1c6 Use subarray instead of slice
says it's deprecated
2024-12-09 16:14:49 +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
8493022f75 Allow apps to specify custom devices 2024-12-05 14:21:07 +01:00
Girish Ramakrishnan
423dfb6ace schema: update comment 2024-12-03 16:33:59 +01:00
Girish Ramakrishnan
ce5a2b1f0a gandi: use PAT token instead
https://api.gandi.net/docs/authentication/
2024-10-08 17:51:01 +02:00
Girish Ramakrishnan
aeddaa4566 apps: rework portBindings
ports is REST API input . Map of env var to the host port
portBinding is the database structure. Map of env var to host port, count, type etc

also, rename portCount -> count in various places to keep things consistent
2024-07-17 00:25:47 +02:00
Johannes Zellner
4a33415b06 Set notes on existing apps to empty string if NULL 2024-06-29 09:52:41 +02:00
Girish Ramakrishnan
6c68f7da2e apps: updateTime should be null if never updated
"TIMESTAMP NULL" is an attribute modifier to make the column nullable.
Without it, if you assign null, the timestamp becomes the current time!
2024-06-25 17:24:02 +02:00
Girish Ramakrishnan
f1e8b91f61 backups: remove limit object from storage config
this is causing UI to get confused
2024-05-01 12:06:04 +02:00
Johannes Zellner
3c7e6b59f0 Add initial support for apps.checklist 2024-04-17 16:54:54 +02:00
Johannes Zellner
87ae95aa4f Add per-app notes feature 2024-04-10 18:34:58 +02:00
Girish Ramakrishnan
b4e4f26361 Rework cpuShares into cpuQuota
cpuShares is the relative weight wrt other apps. This is used when
there is contention for CPU. If we want this, maybe we implement
a UI where we show all the apps and let the user re-order them.
As it stands, it is confusing.

cpuQuota is a more straightforward "hard limit" of the CPU% that you
want the app to consume.

Can be tested with : stress -c 8 -t 20s
2024-04-10 18:25:14 +02:00
Girish Ramakrishnan
7047915995 typo 2024-03-10 19:56:36 +01:00
Girish Ramakrishnan
49b514054f fixup mail fk constraints
it's possible previous releases bad a bug that they did not clear the mail domain
fields properly. this migration fixes it up.
2024-03-10 12:09:20 +01:00
Girish Ramakrishnan
aecc16af5d add inboxDomain fk constraint 2024-02-27 13:45:08 +01:00
Girish Ramakrishnan
6525504923 profile: store preferred language in the database 2024-02-26 13:30:35 +01:00
Johannes Zellner
909fe5dc15 Add appPortBindings port count column 2024-02-23 17:57:24 +01:00
Johannes Zellner
b72a5e9c69 Add notification types 2023-09-22 17:58:13 +02:00
Girish Ramakrishnan
964dc990a6 network: simply use ip instead of ipv4/ipv6
this makes it simpler for openapi docs
2023-09-12 20:34:55 +05:30
Girish Ramakrishnan
9c3173e8ef Fix broken directory server config migration 2023-08-25 16:44:08 +05:30
Girish Ramakrishnan
f152331615 Fix issue where backup config disappeared 2023-08-21 22:17:28 +05:30
Girish Ramakrishnan
de7879afb5 store subdomain in database instead of fqdn
this makes it more consistent with the locations table
2023-08-16 21:58:56 +05:30
Girish Ramakrishnan
cd9d49116e backups: move limits and storage into separate keys 2023-08-15 10:48:56 +05:30
Girish Ramakrishnan
d475df8d63 settings: rename to directory_server_config 2023-08-03 07:35:14 +05:30
Girish Ramakrishnan
92a103d635 settings: move ipv6/ipv4 config into network
this also rename sysinfo_config to ipv4_config
2023-08-03 06:40:04 +05:30
Johannes Zellner
5489285406 oidc: remove now unsupported provider logout handling 2023-07-20 13:26:07 +02:00
Girish Ramakrishnan
a2c53df042 typo 2023-07-13 12:49:58 +05:30
Girish Ramakrishnan
95314d46e2 backup policy must be inserted 2023-07-13 12:27:44 +05:30
Girish Ramakrishnan
c86059e070 backups: move limits into a sub object
fixes #817
2023-07-13 12:17:57 +05:30
Girish Ramakrishnan
1a5cbfb2a1 delete spurious mountStatus while we are at it 2023-07-13 11:10:40 +05:30
Girish Ramakrishnan
9cebde3005 backups: split config and policy
keeping them together makes the test/validation quite complicated.
for example, when policy is changed, we test the storage backends

part of #817
2023-07-13 11:07:06 +05:30
Johannes Zellner
8f4c86c1b4 oidc: add clients.tokenSignatureAlgorithm 2023-04-04 16:43:10 +02:00
Girish Ramakrishnan
00767d583c Add the migration for optional addons
the implementation will come in the next patch release.
2023-03-29 10:48:01 +02:00
Johannes Zellner
5d903451fa Add oidc.name and oidc.appId fields 2023-03-23 09:44:31 +01:00
Johannes Zellner
27ff2316b9 oidc: initial logout redirect URI support 2023-03-19 16:01:22 +01:00
Johannes Zellner
4b7e4731a8 oidc: put clients into the db 2023-03-19 16:01:22 +01:00
Girish Ramakrishnan
d2f0bb2b44 sftp: ed25519 keys 2023-03-09 11:03:13 +01:00
Girish Ramakrishnan
8448d28f6f Implement HSTS preload
This allows browsers to query https directly instead of the initial http redirect

https://hstspreload.org/#opt-in says it should be explicitly opt in
2023-03-06 11:46:05 +01:00
Girish Ramakrishnan
03a77ddf01 Fix validation of hostPath
When adding a volume, this comes in mountOptions. The hostPath in the
database is the computed host path.
2023-02-25 23:41:11 +01:00