Felipe Lalanne
445aefaa29
Ensure target state errors are sent to the log backend
...
Closes : #1838
2021-12-02 15:29:37 -03:00
Christina Wang
4a2ac557ef
Remove mz, mkdirp, body-parser dependencies
...
'mz' can be safely replaced with fs.promises
and util.promisify for faster native methods.
'mkdirp' after Node v8 uses native fs.mkdir, thus
is redundant. 'body-parser' is deprecated and
contained within express v4.x.
Closes : #1567
Change-type: patch
Signed-off-by: Christina Wang <christina@balena.io>
2021-04-28 07:20:15 +09:00
Miguel Casqueira
ba1c857c4f
Cancel pending apply target after /v1/update request
...
Closes : #1530
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2021-01-20 22:21:14 -05:00
Cameron Diver
975129188a
Remove superfluous current state reporting code from api-binder
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-10-12 11:53:19 +01:00
Rich Bayliss
96c68166a1
application-manager: Convert to a singleton
...
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-09-14 11:23:36 +01:00
Rich Bayliss
e3864915bc
device-state: Convert to a singleton
...
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-09-14 09:31:12 +01:00
Rich Bayliss
d50f7791e1
api-binder: Convert to a singleton
...
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-09-14 09:31:12 +01:00
Miguel Casqueira
7ea49bf4fb
Preventing removing all configurations if device has no backends
...
Closes : #1437
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-08-24 13:41:17 -04:00
Pagan Gazzard
90fab43022
Update pinejs-client-request to 7.2.1
...
Update pinejs-client-request from 7.1.0 to 7.2.1
Change-type: patch
2020-08-18 18:28:10 +01:00
Cameron Diver
aa823c1cfc
Fix device-tag fetching function
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-08-05 13:30:34 +01:00
Pagan Gazzard
511cbbe74e
Update pinejs-client-request and make use of a named key
...
Update pinejs-client-request from 7.0.0 to 7.1.0
Change-type: patch
2020-08-03 09:27:11 +00:00
Pagan Gazzard
ffe3da6261
Fix an issue with reporting initial config using a stale target state
...
Change-type: patch
2020-07-30 10:48:54 +01:00
Matthew McGinn
15c57a86b4
fix up "atleast" -> "at least"
...
Change-type: patch
Signed-off-by: Matthew McGinn <matthew@balena.io>
2020-07-29 11:55:22 -04:00
Pagan Gazzard
eeda7e3ab1
Extract current state reporting to its own module
...
Change-type: minor
2020-07-24 17:35:17 +01:00
Cameron Diver
5337c0102c
Convert deviceConfig module to a singleton
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-07-08 12:05:09 +01:00
Pagan Gazzard
c15f77434b
Update pinejs-client-request to 7.x
...
Update pinejs-client-request from 5.2.0 to 7.0.0
Change-type: patch
2020-06-18 12:24:52 +00:00
Akis Kesoglou
1dccbaecd8
Use API v6
...
See: https://github.com/balena-io/open-balena/issues/80
Change-type: minor
2020-06-15 13:57:32 +03:00
Cameron Diver
b5918f0d84
Respect an initialDeviceName field in the config.json
...
Closes : #909
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-10 13:27:03 +01:00
Cameron Diver
651e48b1bd
Make logger module a singleton
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-08 17:19:20 +01:00
Cameron Diver
389e14ec6b
Make the event-tracker module a singleton
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-08 10:13:33 +01:00
Pagan Gazzard
17a5d8dd49
Isolate target state fetching to its own module which emits on update
...
Change-type: minor
2020-06-03 17:37:38 -04:00
Cameron Diver
ff4a31a0e6
Make the config module a singleton
...
Change-type: patch
Co-authored-by: Pagan Gazzard <page@balena.io>
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-02 14:29:05 +01:00
Miguel Casqueira
ef83acdaeb
Refactor api-binder healthchecks to log reason for failure
...
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-29 16:14:58 -04:00
Cameron Diver
1d7381327e
Make the db module a singleton
...
We were treating the database class as a singleton, but still having to pass
around the db instance. Now we can simply require the db module and have
access to the database handle.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-29 15:02:38 +01:00
Cameron Diver
972b896c95
Check for ApiError before using it as such
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-26 14:43:59 +01:00
Cameron Diver
eaaa9c257e
check for 409 status code, rather than string matching uuid conflicts
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-21 14:57:26 -04:00
Pagan Gazzard
fb90042c39
Switch to balenaApi for the state patch as patching cannot be cached
...
Change-type: patch
2020-05-18 18:17:48 +00:00
Pagan Gazzard
dc187f0036
Catch errors in the target state poll so polling will always continue
...
Change-type: patch
2020-05-18 14:14:52 +01:00
Pagan Gazzard
afae5d15d4
Avoid querying instantUpdates
on every state poll
...
Change-type: patch
2020-05-18 13:23:44 +01:00
Pagan Gazzard
758f3caa48
Update to @balena/lint 5.x
...
Change-type: patch
2020-05-15 12:08:42 +01:00
Cameron Diver
58c6a69e5a
Add a random offset to the poll interval with each poll
...
Change-type: patch
Closes : #1242
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-15 10:34:06 +01:00
Pagan Gazzard
913418bb37
Remove unnecessary config.json keys
...
Change-type: patch
2020-05-08 12:56:42 +01:00
Cameron Diver
f599799950
Remove double printing of API status error
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-21 09:51:56 +01:00
Pagan Gazzard
a59af6abe8
Workaround a circular dependency
...
Change-type: patch
2020-04-08 17:40:39 +01:00
Cameron Diver
0a429f60a5
Add newTargetState event and use it for backup loading
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-07 14:50:34 +01:00
Pagan Gazzard
81927d7861
Update to balena-register-device 6.0.1
...
Change-type: patch
2020-04-06 17:45:03 +01:00
Cameron Diver
3c59944ce1
Pass in deviceId when fetching device tags
...
Change-type: patch
Closes : #1237
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-03-31 12:44:31 +01:00
Cameron Diver
c21da8f3db
Convert device-state module to typescript
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-02-25 14:50:21 +07:00
Rich Bayliss
fe5fd2b7ef
bug: Delay sending logs until the device is provisioned
...
Connects-to: #1189
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2020-02-06 10:21:27 +00:00
Cameron Diver
6e7a190ff0
❌ Remove unnecessary awaits
...
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-01-16 11:14:39 +00:00
Cameron Diver
53b6e8f1bb
⌛ Increase minimum backoff delay and use poll interval as max
...
This change will start the minimum backoff from 15s (up from 500ms) and
will use the appUpdatePollInterval configuration variable as the max.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-01-16 11:14:00 +00:00
Cameron Diver
4b0f431f9b
Throttle state report patches to once per 10 seconds
...
Change-type: patch
Closes : #1158
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-12-19 12:32:38 +00:00
Theodor Gherzan
659697ff79
Extract backup logic to migration
...
Part of device-state refactor
Fix the wrong usage of TargetState as DeviceApplicationState
Change-type: patch
Signed-off-by: Theodor Gherzan <theodor@balena.io>
2019-11-15 17:39:48 +00:00
Theodor Gherzan
54e9c2edd8
Run new prettier on code base
...
Signed-off-by: Theodor Gherzan <theodor@balena.io>
2019-11-15 14:51:24 +00:00
Cameron Diver
d16403f654
Correctly validate container contracts
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-10-02 15:48:17 +01:00
Cameron Diver
14e442f943
Add support for container contracts
...
These contracts can specify an OS version and supervisor version that
they require. If any of the containers in a release have requirements
that are not met, the release is rejected, and the previous release
continues to run.
Change-type: minor
Closes : #1086
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-10-01 16:17:44 +01:00
Cameron Diver
9843f62e24
Upgrade io-ts and fp-ts to 2.0.0
...
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-10-01 16:17:44 +01:00
Cameron Diver
2d168784b2
Avoid synchronous file accesses for os release info
...
This also required refactoring the request library to be generated with
a promise, as we now no longer get the information synchronously.
We also cache the release info, to avoid grabbing it again within the
same runtime, which does not make sense.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-10-01 16:17:43 +01:00
Roman Mazur
8b4c9837fa
Unify API errors processing
...
With this change, we define a custom error handler as express middleware
which renders 503 error with JSON response that includes status and message
fields.
The handler also logs the error, so the stack can be inspected in supervisor
logs. It's also a point where we can report the error to analytics services.
This removes a bunch of error handlers written in every request handler
function. Behaviour should remain unchanged except the fact that
/healthy endpoint now returns 503 in case of failure instead of 500.
Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
2019-09-23 17:20:38 +03:00
Cameron Diver
37945b4aa5
Don't attempt to setup a log stream to the cloud before provision
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-07-09 13:21:05 +01:00