Commit Graph

2403 Commits

Author SHA1 Message Date
Cameron Diver
25fd11bed3
Refactor container logging interface and rename logging-backends
Container logging is now handled by a class which attaches and emits
information from the container. We add these to the directory
logging-backends/, and rename it to logging/.

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-04-05 10:06:26 +01:00
Cameron Diver
196f173e13
ux: Show a supervisor starting log message in dashboard
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-04-05 10:06:25 +01:00
Cameron Diver
0504776169
ux: Remove service already running log message
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-04-05 10:06:24 +01:00
Resin CI
b82eb6efd6 v9.13.0 2019-04-03 20:08:09 +03:00
Pablo Carranza Vélez
7be35d783e
Merge pull request #934 from balena-io/polling-jitter
Add a random jitter to target state polls, and a config var to ignore…
2019-04-03 10:06:21 -07:00
Pablo Carranza Velez
3d0e35f2a2 Fix test for deviceConfig.getDefaults with the addition of SUPERVISOR_INSTANT_UPDATE_TRIGGER
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-04-03 09:15:50 -07:00
Pablo Carranza Velez
9961ebb41d In /v1/update, return 202 when we're not updating immediately
We also add a catch to any errors when getting configuration, and send 503 in this case, even if it's
unlikely.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-04-03 09:15:50 -07:00
Pablo Carranza Velez
8f07bf62de Add a random jitter to target state polls, and a config var to ignore update notifications and not poll immediately after startup
This commit does two related things:

* We make the poll interval a random time between 0.5 and 1.5 times the configured interval.
* We introduce the BALENA_SUPERVISOR_INSTANT_UPDATE_TRIGGER configuration variable, that defaults to true. If this variable is set
to false, then calls to /v1/update are ignored, and on startup the supervisor waits for a poll interval before getting the target state.

This will help especially on cases where there's a large number of devices on a single network. By disabling instant updates and setting a large
poll interval, we can now achieve a sitation where not all devices apply an update at the same time, which can help avoid
overwhelming the network.

Change-type: minor
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-04-03 09:15:49 -07:00
Resin CI
77d5c10aee v9.12.7 2019-04-03 15:39:32 +03:00
CameronDiver
e0db04e6a9
Merge pull request #956 from balena-io/fix-service-comparison
Fix service comparison when starting a stopped service
2019-04-03 13:37:23 +01:00
Cameron Diver
9a343316b2
Fix service comparison when starting a stopped service
When comparing a stopped container after a start request, the container
ID will be present in the target state (where usually it is not). We
were already filtering this value out of the current state, but
neglected to do so for the target state. This change now ensures we
remove it from both alias lists if it exists.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-04-03 13:08:22 +01:00
Pablo Carranza Vélez
1d7e5b40d2
Merge pull request #954 from balena-io/changelog-fix-9.11.4
CHANGELOG.md: Add entry for 9.11.4 that was skipped by versionbot
2019-03-29 14:20:50 -07:00
Pablo Carranza Velez
9fc25da1a6 CHANGELOG.md: Add entry for 9.11.4 that was skipped by versionbot
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-29 11:30:41 -07:00
Resin CI
4e5d9df717 v9.12.6 2019-03-29 20:04:35 +02:00
Pablo Carranza Vélez
8a430b6b84
Merge pull request #910 from balena-io/fix-legacy-migration-2-apps
Fix migration of legacy apps when there's more than one app
2019-03-29 11:02:26 -07:00
Pablo Carranza Velez
c902706600 Fix migration of legacy apps when there's more than one app in the local DB
In an edge case observed in the field, a supervisor's database held two applications
because the device had been moved and the update lock was set in the old app. This causes
the updated supervisor to be unable to start, logging "No compatible releases found in API",
because it can't fetch the release for the app it was moved from.

This commit changes the migration code to iterate through all apps, and remove any for which
we can't get a release.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-28 17:14:06 -07:00
Resin CI
32bdd1e397 v9.12.5 2019-03-29 02:13:23 +02:00
Pablo Carranza Vélez
114a62606c
Merge pull request #943 from balena-io/test-device-config-defaults
test: Add a test case for deviceConfig.getDefaults
2019-03-28 17:11:33 -07:00
Pablo Carranza Velez
ea6ebf8223 test: Add a test case for deviceConfig.getDefaults
This would help avoid bugs like the one fixed in 9.11.1.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-28 16:01:00 -07:00
Resin CI
e5fee8d277 v9.12.4 2019-03-28 20:39:07 +02:00
Pablo Carranza Vélez
0f943dba1b
Merge pull request #924 from balena-io/only-modprobe-ip6tables-if-needed
Only modprobe ip6_tables if it's necessary
2019-03-28 11:36:52 -07:00
Pablo Carranza Velez
de05165316 Only modprobe ip6_tables if it's necessary
If the kernel was built with support for ip6tables, there's no need to load the module. This is the case when running
balenaOS in a container in Mac OS, which also can't do modprobes easily.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-28 11:12:10 -07:00
Resin CI
efdd3e817b v9.12.3 2019-03-28 16:47:23 +02:00
Page-
6fe04f8a0e
Merge pull request #951 from balena-io/faster-builds
Parallelise cache pulling for builds
2019-03-28 14:45:14 +00:00
Pagan Gazzard
9af416c7c0 Parallelise cache pulling for builds
Change-type: patch
2019-03-28 13:39:16 +00:00
Resin CI
898312151a v9.12.2 2019-03-28 15:23:17 +02:00
CameronDiver
d1bcbfbdbf
Merge pull request #952 from balena-io/fix-typo
Fix typo in delta request error message
2019-03-28 13:21:00 +00:00
Cameron Diver
175cbfee50
Fix typo in delta request error message
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-28 12:31:50 +00:00
Resin CI
56c79945c3 v9.12.1 2019-03-28 14:10:20 +02:00
CameronDiver
b26a527ed0
Merge pull request #933 from balena-io/fix-network-joining
Fix network alias creation and comparison
2019-03-28 12:08:24 +00:00
Cameron Diver
c4b7fb481a
Remove log-timestamp due to having journald logs
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-28 10:27:22 +00:00
Cameron Diver
1570935b2c
misc: Fix lint errors
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-28 10:27:22 +00:00
Cameron Diver
b3192679c7
fix: Correctly compare and generate network membership aliases
Before this change, service name resolution would only occur in the
default network. This was because we were not explicitly adding aliases
of the service names to the aliases fields.

We also fix the comparison, which would do funny things based on
container IDs, which was correct but unnecessary.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-28 10:27:21 +00:00
Resin CI
f1c6dd46c3 v9.12.0 2019-03-28 11:45:43 +02:00
CameronDiver
e956242d45
Merge pull request #949 from balena-io/use-default-device-config
When a device config variables requested value is not valid, fallback to the default
2019-03-28 09:43:30 +00:00
Resin CI
88a58b683f v9.11.4 2019-03-27 22:36:57 +02:00
Pablo Carranza Vélez
0eb43615c4
Merge pull request #946 from balena-io/change-supervisor-net-ip
Ensure the supervisor0 network uses a subnet less likely to cause conflicts
2019-03-27 13:34:37 -07:00
Cameron Diver
1191b39ee5
misc: Update build stages to debian stretch
Jessie recently had the jessie-updates repos dropped. We upgrade to
stretch to avoid a 404 on update (and to update things anyway).

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-27 14:18:34 +00:00
Cameron Diver
c7499a6b12
device-config: Show invalid values in dashboard logs
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-27 14:03:45 +00:00
Cameron Diver
83d53cfb56
events: Allow system messages to not be tracked
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-27 13:14:40 +00:00
Cameron Diver
c211efe399
device-config: Use default values for any invalid target values
If a value is requested which does not pass validation, we instead set
it to the default value, to ensure that the state engine continues to
work and move towards the target state.

Change-type: minor
Closes: #938
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-27 13:08:04 +00:00
Pablo Carranza Velez
dab5d7546c Ensure the supervisor0 network uses a subnet less likely to cause conflicts
We put the supervisor0 network in the 10.114.104.0/25 subnet to avoid issues when the device
is in a network using the 172.17.* network.

We also ensure we recreate this network if it was created in the incorrect subnet (i.e. if we're updating
from an old supervisor that didn't do this), for which we have to kill any containers using this network.

Closes #731

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-21 16:02:49 -07:00
Resin CI
3e6a6359a7 v9.11.3 2019-03-21 15:08:31 +02:00
Page-
0444899762
Merge pull request #945 from balena-io/fix-await-provisioning
Fixes for the provisioning and pinning process
2019-03-21 13:06:53 +00:00
Pablo Carranza Velez
22a5b33196 fix: When pinning a preloaded device, ensure the pinning is done when retrying after a failure
Without this patch, if for some reason device pinning fails (e.g. connectivity goes down) or anything
interrupts the initialization after provisioning completes but before pinning is completed, after a retry
the supervisor would just skip the pinning code, leaving the device unpinned. This patch ensures that the
pinning procedure is run even if the device was already provisioned (as long as the pinning flag has been set,
of course). This matches the behavior that the CoffeeScript code had from before the TypeScript conversion.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-20 17:50:26 -07:00
Pablo Carranza Velez
6e3bedeb1d fix: Return a promise when retrying provisioning to avoid continuing after a failure
Otherwise we'll keep doing the rest of the APIBinder init steps, like reporting initial config,
potentially before completing the provisioning.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-20 16:48:20 -07:00
Resin CI
1572640bce v9.11.2 2019-03-20 21:56:37 +02:00
Pablo Carranza Vélez
b8ec9f0d54
Merge pull request #944 from balena-io/await-reporting-initial-config
fix: Await reporting the initial config before continuing APIBinder init
2019-03-20 12:54:35 -07:00
Pablo Carranza Velez
b374bd81dd fix: Await reporting the initial config before continuing APIBinder initialization
This avoid a race condition, in which config.txt can be cleared if a target state is fetched before the
initial values have been created as config vars.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2019-03-20 12:27:20 -07:00
Resin CI
59d2f98166 v9.11.1 2019-03-19 22:59:48 +02:00