Commit Graph

4448 Commits

Author SHA1 Message Date
Balena CI
da15bc3c63
v14.10.1 2023-04-07 00:16:01 +00:00
flowzone-app[bot]
d0d726ceb5
Merge pull request #2151 from balena-os/2150-mount-partitions-gpt-fix
Fix partition mounting for GPT partitioned disks
2023-04-07 00:15:14 +00:00
Christina Ying Wang
4ab8250c97 Use dbus-send to get current boot block device instead of fdisk
Closes: #2150
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-04-06 12:34:00 -07:00
Balena CI
980c838e44
v14.10.0 2023-03-28 19:13:51 +00:00
Christina Wang
bd351a273e
Merge pull request #2120 from balena-os/mount-host-partitions-in-entry
Mount host partitions into container on Supervisor start
2023-03-28 12:13:03 -07:00
Christina Ying Wang
4c948c8854 Mount data and state partitions on container startup
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-27 12:07:01 -07:00
Christina Ying Wang
49ee1042a8 Mount boot partition into container on Supervisor start
As the Supervisor is a privileged container, it has access to host /dev, and therefore has access
to boot, data, and state balenaOS partitions. This commit sets up the framework for the following:

- Finds the /dev partition that corresponds to each partition based on partition label
- Mounts the partitions into set mountpoints in the device
- Removes reliance on env vars and mountpoints provided by host's start-balena-supervisor script
- Simplifies host path querying by centralizing these queries through methods in lib/host-utils.ts

This particular changes env vars for and mounts the boot partition.

Since the Supervisor would no longer rely on container `run` arguments provided by a host script,
this change moves Supervisor closer to being able to start itself (Supervisor-as-an-app).

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-27 12:07:01 -07:00
Christina Ying Wang
9522c15ecd Change constants imports to remove 'require'
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-27 12:07:01 -07:00
Balena CI
07b8d44545
v14.9.8 2023-03-27 08:05:46 +00:00
Christina Wang
912a2eccbd
Merge pull request #2147 from balena-os/supervisor-revert-multiarch
Revert "Use multi-arch in dockerfile"
2023-03-27 01:04:54 -07:00
Felipe Lalanne
75eeac5ed4 Revert "Use multi-arch in dockerfile"
This reverts commit 00e389e5f5.

Images generated using this dockerfile still don't have the right
architecture. More testing is needed

Change-type: patch
2023-03-24 18:27:58 -03:00
Balena CI
9304a9215d
v14.9.7 2023-03-23 21:40:33 +00:00
Christina Wang
1d8844c4a6
Merge pull request #2145 from balena-os/add-missing-log-backend-reference
Add missing log backend field assignment in logger init
2023-03-23 14:39:48 -07:00
Christina Ying Wang
37371d89dc Add missing log backend field assignment in logger init
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-23 14:07:35 -07:00
Balena CI
7bc89faf12
v14.9.6 2023-03-23 20:18:33 +00:00
Felipe Lalanne
375087ee42
Merge pull request #2141 from balena-os/dockerfile-platform
Use multi-arch in dockerfile
2023-03-23 15:17:49 -05:00
Felipe Lalanne
7cde98d7f7 Update deploy-to-balena action to 0.26.2
Change-type: patch
2023-03-22 21:47:48 -03:00
Felipe Lalanne
00e389e5f5 Use multi-arch in dockerfile
This is necessary since the builder no longer passes the platform flag
to the build. This would lead to dockerfiles that are mixing multi and single
arch stages to pull the wrong architecture images, particularly when
trying to build images in emulated builds (e.g. armv7hf built on aarch64).

Moving the full build to multi-arch solves this as the docker engine is
capable of chosing the right architecture from the manifest.

Relatest-to: balena-io/balena-builder#1010
Change-type: patch
2023-03-22 19:50:31 -03:00
Balena CI
b55964e207
v14.9.5 2023-03-20 19:21:49 +00:00
Christina Wang
4c369785e7
Merge pull request #2140 from balena-os/move-log-stream-to-subdomain
Use log endpoint subdomain if it exists in config.json
2023-03-20 12:21:01 -07:00
Christina Ying Wang
36e46d80a6 Use log endpoint subdomain if it exists in config.json
See: https://github.com/balena-io/open-balena-api/pull/1288
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-14 12:56:32 -07:00
Balena CI
d0061e426b
v14.9.4 2023-03-13 20:49:33 +00:00
Felipe Lalanne
cd268d8b48
Merge pull request #2139 from balena-os/pin-device
Skip pin device step if release was deleted
2023-03-13 15:48:36 -05:00
Felipe Lalanne
f6435814cd Skip pin device step if release was deleted
Preloaded devices can require that the device is pinned to the preloaded
release on provisioning. However if the provisioned release gets
released in the future, that would lead to the device remaining in "VPN
only" state forever as the provisioning process could not finish due to
pinning failure.

This commit changes the behavior so if the release does not exist, the
pinning step is skipped and the device follows the fleet pinning state.

Closes: #2133
Change-type: patch
2023-03-13 10:03:00 -03:00
Balena CI
2e81eb1abf
v14.9.3 2023-03-10 22:26:09 +00:00
Felipe Lalanne
9b1ad62f7b
Merge pull request #2142 from balena-os/dockerfile-single-arch
Use single-arch in dockerfile
2023-03-10 17:25:20 -05:00
Felipe Lalanne
17aa625d3b Use single-arch in dockerfile
This is necessary since the builder no longer passes the platform flag
to the build. This would lead to dockerfiles that are mixing multi and single
arch stages to pull the wrong architecture images, particularly when
trying to build images in emulated builds (e.g. armv7hf built on aarch64).

Moving the full build to single-arch solves this as the docker engine is
capable of chosing the right architecture from the manifest. Once some
of the builder issues are fixed, we should move to #2141

Relates-to: balena-io/balena-builder#1010
Change-type: patch
2023-03-10 17:30:22 -03:00
Balena CI
4411f4f074
v14.9.2 2023-03-02 21:48:08 +00:00
Christina Wang
d06b8b7de8
Merge pull request #2135 from balena-os/fix-iptables-input-flush
Replace BALENA-FIREWALL rule in INPUT chain instead of flushing
2023-03-02 13:47:25 -08:00
Christina Ying Wang
84a9e7e9ac Replace BALENA-FIREWALL rule in INPUT chain instead of flushing
The issue with the original Supervisor implementation of the firewall is that
on Supervisor start, the Supervisor flushes the INPUT chain of the filter table.
This doesn't play well with services that add to the INPUT chain on startup that
may start up before the Supervisor, such as certain NetworkManager connection
profiles. This change only replaces the BALENA-FIREWALL rule in the INPUT chain,
preserving the other rules as well as their order.

Closes: #1482
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-03-01 13:42:07 -08:00
Balena CI
935a4fba59
v14.9.1 2023-02-15 14:13:58 +00:00
Page-
1b210d4fa6
Merge pull request #2132 from balena-os/lower-case-cpu-id
Always lower case the cpu id to avoid bouncing between casing when reporting
2023-02-15 14:13:12 +00:00
Pagan Gazzard
d356f979d3 Always lower case the cpu id to avoid bouncing between casing when reporting
Change-type: patch
2023-02-15 13:54:40 +00:00
Balena CI
5b0c8e6743
v14.9.0 2023-02-14 17:10:10 +00:00
Felipe Lalanne
f834c551a4
Merge pull request #2130 from balena-os/duplicate-networks
Find and remove duplicate networks
2023-02-14 12:09:22 -05:00
Felipe Lalanne
89175432af Find and remove duplicate networks
We have seen a few times devices with duplicated network names for some
reason. While we don't know the cause the networks get duplicates, this
can be disruptive for updates as trying to create a container referencing a duplicate
network results in a 400 error from the engine.

This commit finds and removes duplicate networks via the state engine,
this means that even if somehow a container could be referencing a
network that has been duplicated later somehow, this will remove the
container first.

While thies doesn't solve the problem of duplicate networks being
created in the first place, it will fix the state of the system to
correct the inconsistency.

Change-type: minor
Closes: #590
2023-02-10 20:24:36 -05:00
Felipe Lalanne
180c4ff31a Reference networks by Id instead of by name
We have seen a few times devices with duplicated network names for some
reason. While we don't know the cause the networks get duplicates,
this is disruptive of updates, as the supervisor usually queries
resource by name, resulting in a 400 error from the engine because of
the ambiguity.

This replaces those queries by name to queries by id. This includes
network removal. If a `removeNetwork` step is generated, the supervisor
opts to remove all instances of the network with the same name as it
cannot easily resolve the ambiguity.

This doesn't solve the problem of ambiguous networks, because even if
networks are referenced by id when creating a container, the engine will
throw an error (see https://github.com/balena-os/balena-supervisor/issues/590#issuecomment-1423557871)

Change-type: patch
Relates-to: #590
2023-02-10 20:24:36 -05:00
Balena CI
e7aaae9db9
v14.8.0 2023-02-10 23:01:04 +00:00
Christina Wang
c80f5b887a
Merge pull request #2105 from balena-os/remove-dependent-devices-code
Remove dependent devices content in codebase
2023-02-10 15:00:18 -08:00
Christina Ying Wang
c4f9d72172 Remove dependent devices content in codebase
This includes:
- proxyvisor.js
- references in docs
- references device-state, api-binder, compose modules, API
- references in tests

The commit also adds a migration to remove the 4 dependent device tables from the DB.

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-02-06 19:34:02 -08:00
Balena CI
cfd18a7620
v14.7.1 2023-02-07 00:59:07 +00:00
Christina Wang
6693a02d3e
Merge pull request #2129 from balena-os/patch-journalctl-date-format
patch: Convert internal timestamp passed to journalctl from number to string
2023-02-06 18:58:18 -06:00
Christina Ying Wang
9b26fc263a patch: Convert internal timestamp passed to journalctl from number to string
See: https://github.com/balena-os/balena-supervisor/pull/2084
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-02-06 15:59:16 -08:00
Balena CI
3d28f36fb2
v14.7.0 2023-02-03 00:06:05 +00:00
Christina Wang
e2383c8cca
Merge pull request #2084 from rkeulemans/feature/support_since_and_until_in_journald_supervisor_wrapper
Feature: Support `since` and `until` in supervisor journald wrapper
2023-02-01 17:04:12 -08:00
Ruben Keulemans
9a1cde7f44 Support since and until in supervisor journalctl wrapper API.
Signed-off-by: Ruben Keulemans ruben.keulemans@protonmail.com
Change-type: minor
Closes: #2083
2023-02-01 09:17:10 +01:00
Balena CI
8b7cecfd3e
v14.6.4 2023-01-31 19:43:30 +00:00
Balena CI
11952fd266
Merge pull request #2102 from balena-os/supervisor-sigterm
Add SIGTERM listener on supervisor start
2023-01-31 21:41:31 +02:00
Felipe Lalanne
4d74505087 Fix wait-for-it script to work with external signals
The wait-for-it script used during tests would setup a timer
that would send SIGUSR2 to the parent process after the timer ends.
Since node was ignoring additional signals, the timer ending would have
no effect after the node process had replaced the start script. However
when node has pid != 1, SIGUSR2 default behavior is to terminate the
process, meaning the tests would fail after 30 seconds.

The script is now updated so the timer is killed once the services are
ready for the tests.
2023-01-31 10:43:19 -03:00
Felipe Lalanne
6683bca07d Add SIGTERM listener on application start
As reported by issue #2100, the supervisor was not correctly reacting to
`SIGTERM` sent by the engine when terminating the process (for instance
before a reboot). This would lead to the supervisor requiring an
additional 10 seconds to terminate (after which the engine will send a
`SIGKILL`).

The reason for this is explained by the following info coming from Node

> Node.js was not designed to run as PID 1 which leads to unexpected behaviour when running inside of Docker. For example, a Node.js process running as PID 1 will not respond to `SIGINT` (`CTRL-C`) and similar signals. [reference](https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals)

On internal testing, it was discovered that simply adding a listener for
the signal on the Node process was enough to handle the signal, even
when the process runs as PID 1.

This adds a listener for `SIGTERM` before starting the supervisor main
loop.

Closes: #2100
Change-type: patch
2023-01-31 10:43:19 -03:00