Commit Graph

248 Commits

Author SHA1 Message Date
Girish Ramakrishnan f44ff12a5f Fix ordering of columns 2025-10-01 12:49:09 +02:00
Johannes Zellner 3bfa7b1cdd Column is called enableForUpdates 2025-09-23 21:23:33 +02:00
Girish Ramakrishnan 5157789774 backups: add per site enabledForUpdates flag
previously, we had a singleton 'main' flag to indicate a site can
be used for updates. with this new approach, we can get rid of the
'primary' concept. each site can be used for updates or not.
2025-09-22 18:03:01 +02:00
Girish Ramakrishnan 4686e38a5e schema: add contentsJson to backupSites 2025-09-22 17:05:01 +02:00
Girish Ramakrishnan c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Girish Ramakrishnan fd2705a49d schema: more missing fields 2025-08-14 20:28:34 +05:30
Girish Ramakrishnan 935c9a50ab schema: add missing fields 2025-08-14 19:58:30 +05:30
Girish Ramakrishnan 132132307f backuptarget: rename label to name 2025-08-04 14:28:37 +02:00
Girish Ramakrishnan 94dd1eb0c2 backups: add setPrimary route 2025-07-25 09:43:26 +02:00
Girish Ramakrishnan cfce39c1de backups: no need to track taskId, we track it in task.type+prefix 2025-07-25 07:41:48 +02:00
Girish Ramakrishnan 3aafbd2ccb backups: add backup multiple targets 2025-07-25 01:30:27 +02:00
Girish Ramakrishnan bf315258c5 backups: add target foreign key to backups table
format is part of the backup target

in the future, if we want per-app format or schedule, we can add this
separately to the apps table itself. the full box backup can ignore
apps with a set backup target and use the latest backup (like an errored app).
the nice thing is restore will work correctly.
2025-07-24 17:32:16 +02:00
Girish Ramakrishnan 9780db6fa0 add backup targets table 2025-07-24 17:32:16 +02:00
Girish Ramakrishnan 47580c6976 tasks: make type field longer 2025-07-18 14:24:24 +02:00
Girish Ramakrishnan b42be9899e tasks: add completed flag
in some cases, the tasks are setting percent to 100 and crashing later
2025-07-16 15:40:46 +02:00
Girish Ramakrishnan 622aecfd6d users: add unset route for avatar
also add missing tests for avatar and profile locking
2025-07-15 10:06:26 +02:00
Girish Ramakrishnan 6da8396c76 another schema update 2025-06-19 19:43:51 +02:00
Girish Ramakrishnan 79e0a1b94c Update schema 2025-06-19 18:10:11 +02:00
Girish Ramakrishnan b23699f0c1 db: change the encoding and collation
by mistake many fields are encoded at utf8 which is an alias of utf8mb3

fixes #836
2025-06-18 22:08:43 +02:00
Girish Ramakrishnan 1bbdabc42f registry config: create table and migrate existing setting 2025-05-07 15:56:13 +02:00
Girish Ramakrishnan 5342dae5b3 tokens: add ip restriction 2025-03-07 17:50:50 +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 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 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
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
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 aecc16af5d add inboxDomain fk constraint 2024-02-27 13:45:08 +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
Johannes Zellner 5489285406 oidc: remove now unsupported provider logout handling 2023-07-20 13:26:07 +02:00
Johannes Zellner 8f4c86c1b4 oidc: add clients.tokenSignatureAlgorithm 2023-04-04 16:43:10 +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 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
Johannes Zellner 56c567ac86 Add token scopes 2022-09-22 22:28:59 +02:00
Girish Ramakrishnan b23189b45c mail: quota support 2022-08-18 11:31:40 +02:00
Johannes Zellner e1ac2b7b00 Add initial applink support 2022-07-06 20:37:52 +02:00
Johannes Zellner 6a7379e64c Add apps.upstreamUri support 2022-06-09 10:48:54 +02:00
Girish Ramakrishnan dddc5a1994 migrate app dataDir to volumes 2022-06-02 16:29:01 -07:00