Commit Graph

99 Commits

Author SHA1 Message Date
Girish Ramakrishnan
f14a7808cb move update notification and eventlog after the task update 2025-10-17 19:11:02 +02:00
Girish Ramakrishnan
45d68c4da8 shell: set utf8 encoding explicity for spawn and as the default for sudo 2025-10-13 13:14:50 +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
c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Girish Ramakrishnan
2f4766af9d Fix update progress display 2025-09-10 21:46:03 +02:00
Girish Ramakrishnan
c2e5f19226 very possible code path 2025-09-10 21:10:56 +02:00
Johannes Zellner
eb2ebead28 Get the primary backup target during box update 2025-08-21 11:15:42 +02:00
Girish Ramakrishnan
12e073e8cf use node: prefix for requires
mostly because code is being autogenerated by all the AI stuff using
this prefix. it's also used in the stack trace.
2025-08-14 12:55:35 +05:30
Girish Ramakrishnan
fc4da4408c backups: fix app restore with tgz 2025-07-25 13:39:09 +02:00
Girish Ramakrishnan
100bea981d constants: rename AUTOUPDATE_PATTERN_NEVER to CRON_PATTERN_NEVER 2025-07-24 21:47:46 +02:00
Girish Ramakrishnan
931311f11f rename backups to backuptargets 2025-07-24 18:54:10 +02:00
Girish Ramakrishnan
0aca6c2588 locks: rename lock types to make it clearer 2025-07-18 13:40:15 +02:00
Girish Ramakrishnan
989d843fcb shell: make shell.sudo promise based and waitable 2025-07-16 22:04:24 +02:00
Girish Ramakrishnan
6d5671dd0e typo 2025-07-01 15:28:39 +02:00
Girish Ramakrishnan
37621f8548 typo 2025-06-30 17:39:18 +02:00
Girish Ramakrishnan
19c9d7d59d updateInfo: move updateInfo into apps table
this has many advantages:
* easy to deliver the updateInfo via the apps object
* after updating, the task can clear it
* when apps are deleted, the info is automatically gone

otherwise, it's a mess of deps between apps/updater/apptask/rest routes

box update info is still in a file
2025-06-26 15:47:15 +02:00
Girish Ramakrishnan
abd640d36b merge updatechecker into updater 2025-06-26 14:00:30 +02:00
Girish Ramakrishnan
a085e9ed54 updatechecker: raise app update notifications in the updatechecker job
the updatechecker runs even if auto-updates is disabled. doing notifications
in updatechecker ensures notifications are raised even when auto-update is disabled.
2025-06-26 13:36:21 +02:00
Girish Ramakrishnan
84297ff473 updater: move app update logic and attach the manual update reason 2025-06-20 22:08:02 +02:00
Girish Ramakrishnan
1ffad1ebaf updater: move the auto update logic into updater 2025-06-20 19:10:25 +02:00
Girish Ramakrishnan
2db99e7807 refactor: rename updater functions to have box in them 2025-06-20 19:04:55 +02:00
Girish Ramakrishnan
d9c104613c tasks: rework the startTask API
it is now async. change was required to reset the pending flag
2025-06-17 19:32:46 +02:00
Girish Ramakrishnan
746e694d7e notifications: rename alert to pin and unpin 2024-12-11 17:31:32 +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
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
Girish Ramakrishnan
6eda037544 lint: const fixes 2024-05-13 17:02:20 +02:00
Girish Ramakrishnan
eb5b8b42dc updater: delete any old dirs from failed updates 2024-05-13 17:00:58 +02:00
Girish Ramakrishnan
d137cdf881 update cron module
CronJob -> CronJob.from
CronJob(time) -> CronTime
2024-04-19 18:31:47 +02:00
Girish Ramakrishnan
a6f078330f shell: no need to promise scoping 2024-02-21 19:40:27 +01:00
Girish Ramakrishnan
2237d2bbb7 shell: remove usage of .spawn 2024-02-21 13:27:04 +01:00
Girish Ramakrishnan
1128edc23e update: remove dead pre-flight checks 2024-02-20 22:48:12 +01:00
Girish Ramakrishnan
26eb739b46 shell: add options to exec 2024-02-20 21:11:09 +01:00
Girish Ramakrishnan
cbfb52b920 updater: if update just finished, update info is obsolete 2023-09-09 20:46:24 +05:30
Girish Ramakrishnan
8f9bc8817d cloudron-setup: add AVX check for 7.6 and beyond 2023-09-02 12:02:37 +05:30
Girish Ramakrishnan
070f6e5de3 move startup logic to platform.js 2023-08-12 22:25:46 +05:30
Girish Ramakrishnan
da73067315 rename change notifiers to have handle prefix 2023-08-04 11:54:15 +05:30
Girish Ramakrishnan
e73b75e4b5 settings: move backup settings 2023-08-04 11:54:12 +05:30
Girish Ramakrishnan
5603b9e811 move updater routes and settings under /api/v1/updater 2023-08-03 15:35:27 +05:30
Girish Ramakrishnan
c86059e070 backups: move limits into a sub object
fixes #817
2023-07-13 12:17:57 +05:30
Girish Ramakrishnan
df54ba3a0a Add AVX check in preparation for mongodb 5 2023-07-09 12:54:12 +05:30
Girish Ramakrishnan
78877f3731 Show upgrade fail message that ubuntu 18.04 is now required 2023-07-09 12:53:59 +05:30
Girish Ramakrishnan
f83295372b updater: combine installer logs into the task file 2023-05-15 19:09:40 +02:00
Girish Ramakrishnan
c4f4f3e914 logs: use %o to format error
otherwise, they are printed as multi-line and this messes up tail+date formatting
2023-04-16 10:49:59 +02:00
Girish Ramakrishnan
af7a5d2182 updater: better error message 2023-01-30 12:54:25 +01:00
Girish Ramakrishnan
17c7cc5ec7 Remove external df module
It has some parsing issues with locale
2022-10-18 19:56:18 +02:00
Girish Ramakrishnan
a3e097d541 add missing awaits for eventlog.add 2022-02-24 20:04:46 -08:00
Girish Ramakrishnan
e59efc7e34 bump free space requirement to 2GB 2022-02-18 09:56:42 -08:00
Girish Ramakrishnan
013f5d359d pass debug to promise-retry 2021-12-07 11:18:26 -08:00