Commit Graph

227 Commits

Author SHA1 Message Date
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
Girish Ramakrishnan
26ab7f2767 add mailbox display name to schema 2022-06-01 22:06:34 -07:00
Johannes Zellner
6bd478b8b0 Add profile backgroundImage api 2022-05-15 12:08:11 +02:00
Girish Ramakrishnan
452a4d9a75 backups: add remotePath
the main motivation is that id can be used in REST API routes. previously,
the id was a path and this had a "/" in it. This made /api/v1/backups/:backupId
not work.
2022-04-04 20:40:40 -07:00
Girish Ramakrishnan
70695b1b0f backups: set label of backup and control it's retention 2022-04-02 19:30:54 -07:00
Girish Ramakrishnan
75c0caaa3d rename subdomains table to locations 2022-02-07 14:04:11 -08:00
Girish Ramakrishnan
8f08ed1aed Fix blobs schema 2022-02-01 17:29:25 -08:00
Girish Ramakrishnan
b34f66b115 add secondary domains
note that for updates to work, we keep the secondary domain optional,
even though they are really not.

part of #809
2022-01-16 12:10:48 -08:00
Girish Ramakrishnan
5592dc8a42 schema: add cron to apps table 2021-12-03 13:02:25 -08:00
Girish Ramakrishnan
e71d932de0 eventlog: add Json suffix to json fields 2021-11-17 12:31:46 -08:00
Girish Ramakrishnan
dc8ec9dcd8 mail: move dkim keys into the database 2021-10-11 20:30:42 -07:00
Girish Ramakrishnan
000db4e33d mail: add flag to enable/disable pop3 access per mailbox 2021-10-08 10:43:17 -07:00
Girish Ramakrishnan
a3fc5f226a make recvmail work
unlike sendmail, recvmail is always optional. this is the case because
the cloudron may not receive emails at all, so app always has to be
prepared for it.

part of #804
2021-10-02 03:11:47 -07:00
Johannes Zellner
cb31e5ae8b Separate invite and password reset token 2021-10-01 12:27:22 +02:00
Girish Ramakrishnan
339fdfbea1 schema: add missing args to tasks table 2021-09-30 09:01:43 -07:00
Girish Ramakrishnan
aa6b845c9c make loginLocationsJson mediumtext
it seems we overflow atleast in the demo cloudron
TEXT – 64KB (65,535 characters)
MEDIUMTEXT – 16MB (16,777,215 characters)
2021-08-20 10:30:14 -07:00
Girish Ramakrishnan
449220eca1 appAddonConfigs: change value to TEXT
since the value is used directly as an environment variable, we have to
allow up to max env var size (32767). Use TEXT which has a size of 64k
2021-08-09 13:40:23 -07:00
Johannes Zellner
be0c46ad8e Revert "Revert "Add avatar field constraint to not be NULL""
This reverts commit aafc22511b.
2021-07-07 18:50:09 +02:00
Johannes Zellner
aafc22511b Revert "Add avatar field constraint to not be NULL"
This reverts commit ba86802fc0.
2021-07-07 18:41:34 +02:00
Johannes Zellner
ba86802fc0 Add avatar field constraint to not be NULL 2021-07-07 18:32:05 +02:00
Girish Ramakrishnan
73917e95c9 rework notifications
notifications are now system level instead of user level.

To clarify the use events/notifications/email:
* eventlog - everything that is happenning on server
* notifications - specific important events (alerts)
* email - these are really urgent things that require immediate attention. this is for
  the case where an admin does not visit the dashboard often. can also be alerts like
  bad backup config or reboot required which are not events per-se.

Notes on notifications
* oom - notification only
* appUpdated - notification only
* cert renewal failure - only raise when < 10 days to go. also send email thereafter (todo).
* Backup failure - only if last 5 backups failed (todo).
* Box update - notification only. we anyway send newsletter.
* box update available - we raise a notification. no email.
* app update available - we already have update indicator on dashboard. so, no notification or email.

Alerts:
* backup config
* disk space
* mail status
* reboot
* box updated
* ubuntu update required
2021-05-28 15:29:53 -07:00
Girish Ramakrishnan
53dce1e7aa users: rename createdAt to creationTime 2021-05-17 07:54:54 -07:00