Commit Graph

50 Commits

Author SHA1 Message Date
Felipe Lalanne
55594274f7 Fix journalctl to work with persistent logs
v14.4.5 introduced a new way to retrieve the host logs by symlinking the
log directories into the host /run/log/journal and using a local copy of
the journalctl binary instead of chrooting into the host. This failed to
account for the location of persistent logs when that option is turned
on (/var/log/journal instead of /run/log/journal). This fixes the checks
consider this case and also makes sure to remove the original symlink to
avoid having nested links `/run/log/journal/journal/journal`, which was a
bug in the previous implementation.

Change-type: patch
2022-12-15 19:01:44 -03:00
Felipe Lalanne
91b119cbae Stop using host journalctl
The supervisor had to chroot into the host root in order to read the
journal logs. This won't be possible anymore once the supervisor becomes
an app. This commit copies the journalctl binary and necessary libraries
from a debian image into the supervisor image in order to be able to use
the tool on runtime.

Change-type: patch
2022-12-05 17:09:20 -03:00
Felipe Lalanne
46fa7321c0 Run the built supervisor as part of docker-compose tests
This allows to test that the supervisor build actually runs and opens up the
possibility of running more exhaustive API tests against a working supervisor.

Change-type: patch
2022-11-03 15:45:39 -03:00
Felipe Lalanne
460c3ba0aa Remove DOCKER_ROOT assignments from entry.sh
These variables are not used anywhere and they don't seem to serve any
purpose. Cleaning these assingments as dead code
2022-11-03 10:33:51 -03:00
Felipe Lalanne
8681d6b580 Do not fail lockfile cleanup if files do not exist
Change-type: patch
2022-04-13 12:33:15 -04:00
Christina Wang
51e63ea22b Add lockfile binary and internal lib for interfacing with it
The linked issue describes the Supervisor not cleaning up locks it creates due
to crashing at just the wrong time. After internal discussion we decided to
differentiate Supervisor-created lockfiles from user-created lockfiles by using
the `nobody` UID (65534) for Supervisor-created lockfiles.

As the existing NPM lockfile lib does not allow creating lockfiles atomically
with different UIDs, we move to using the lockfile binary, which is part of the
procmail package. To allow nonroot users to write to lock directories, permissions
are changed to allow write access by nonroot users.

See: https://www.flowdock.com/app/rulemotion/r-resinos/threads/gWMgK5hmR26TzWGHux62NpgJtVl
Change-type: minor
Closes: #1758
Signed-off-by: Christina Wang <christina@balena.io>
2022-04-12 12:02:26 -07:00
Rich Bayliss
f0c2a3cba7
bug: Resolve mDNS API URLs
Due to switching to Alpine the ability to resolve mDNS
hostnames was lost. This patch overrides the lookup and
manually resolves the names.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2020-08-27 11:34:18 +01:00
Cameron Diver
e2eba6280d Fix livepush predicate for POSIX sh in entry.sh
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-21 12:56:58 +01:00
Cameron Diver
aa46be93d4 🔎 Also watch js files during livepush
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-14 10:50:21 +01:00
Pagan Gazzard
a2ec35456b Convert application-manager.coffee to javascript
Change-type: patch
2020-04-08 12:15:06 +01:00
Cameron Diver
8ab63656bd Update synchronisation scripts for supervisor development
We move the old sync.js script to tools/, and delete the now-broken
sync-debug.js.

We add a command `npm run sync`, which starts a livepush process
with the supervisor on a device.

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-06 13:05:38 +01:00
Cameron Diver
3690acbd70 🔧 Move to an alpine base image and drop i386-nlp support
We also remove the Makefile to go to a simpler build system, as long with
the retry_docker_push.sh file. We remove the rest of the automation tools
as they're no longer used and update the circle.yml file.

We also remove debug builds, as these aren't needed moving forward, and were
only to enable livepush builds.

Change-type: major
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-06 10:50:00 +01:00
Matthew McGinn
cda39ab9e1
entry.sh: conform to shellcheck syntax
Change-type: patch
Signed-off-by: Matthew McGinn <matthew@balena.io>
2019-09-02 18:39:16 +02:00
Cameron Diver
1b1e0ce2f3 Dont check config.gz for loaded i6tables module
We also dont fail the initialisation if we cannot load the module.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-05-17 17:48:59 +01:00
Cameron Diver
4e779608a3 Add debug build infrastructure and configuration
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-05-15 12:41:27 +01:00
Heds Simons
24ba07571c
avahi: Remove default service definitions
Removes default 'example' service definitions that
are included by Avahi 0.7+. These conflict with
our balenaOS advertised services, causing potential
issues.

Connects-to: #957
Change-type: patch
Signed-off-by: Heds Simons <heds@balena.io>
2019-04-05 13:33:45 +01: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
Cameron Diver
fae2548f27
Don't mount /lib/modules if it is already mounted
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-14 13:49:03 +00:00
Cameron Diver
93c24298ff
Symlink kernel modules and modprobe ip6_tables
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-13 20:57:05 +00:00
Cameron Diver
ec87d26be1
fix: Clear dbus pid file on startup
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-29 14:19:44 +00:00
Cameron Diver
15187a54c0
Remove node garbage collection flags
The introduction of these flags correlates with OOM issues on the
supervisor. More investigation is needed into these features
before adding them back into production.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-11-06 09:46:51 +00:00
Pablo Carranza Velez
67486146c4 entry.sh: Use symbolic link to link to legacy lock path
The lack of `-s` was a typo.

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
2018-10-23 15:43:59 -07:00
Pablo Carranza Velez
8003f25c3d Add /tmp/balena lock and handover paths and BALENA_ env vars
We change the lockfile to /tmp/balena/updates.lock, and the resin-kill-me file to /tmp/balena/handover-complete.
In the host, we change to use /tmp/balena-supervisor instead of /tmp/resin-supervisor.

We add BALENA_ env vars in addition to the RESIN_ env vars.

We keep backwards compatibility by using both paths for the lockfile and handover, and keeping the RESIN_ env vars.

Changelog-entry: Move the handover and lock files to /tmp/balena, rename them, and add BALENA_ env vars
Change-type: minor
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-10-16 15:12:04 +02:00
Mathew Heard
23013709b5
memory: Reduce memory usage by applying node command line flags
Change-type: patch
Closes: #690
Signed-off-by: Cameron Diver <cameron@resin.io>
2018-09-04 12:52:22 -07:00
Heds Simons
f716624f89
network: Add MDNS support for .local domains
This requires the initialisation of both DBus and
Avahi in the `entry.sh` script to allow resolution
via libc.

Due to issues with Avahi's `init.d` script, the previous
PIDfile is explicitly removed.

Connects-to: #712
Change-type: minor
Signed-off-by: Heds Simons <heds@resin.io>
2018-08-23 18:41:55 +01:00
Heds Simons
d2442d107a Add ability to use self-signed CAs passed via config.json.
Connects-to: #601
Change-type: minor
2018-04-10 10:53:48 +01:00
Pablo Carranza Velez
348ff66cee
Replace the gosuper component with a node module that handles communication with systemd, and stop using an init system in the supervisor container
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-22 15:55:15 +00:00
Pablo Carranza Velez
4ca311edbd Ensure /var/run/resin exists before trying to mount it as tmpfs
Fixes issues on systems where mount files if the target doesn't exist (seems to happen on
boards that run docker on overlayfs).

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-08-18 13:45:42 -07:00
Pablo Carranza Velez
27690e0c30 Issue #20: Change the update lock to a temporary filesystem
The lock is now located at `/tmp/resin-supervisor/<appId>/` on the host, and `/tmp/resin/`
on the user container. The old lock location is supported only in Resin OS 1.X (and both locks are
taken in that case).

This fixes the race condition when the app is started before the supervisor, and takes a lock that is
cleared on supervisor startup.

Change-Type: major
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-03-10 01:19:35 +02:00
Petros Angelatos
eee400f39f integrate with busybox init system
busybox's init uses /etc/inittab for configuration just like sysvinit,
however it doesn't use any runlevels.

the tty part of inittab is appended to "/dev/", and it becomes connected
to the stdout of the spawned process

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-09-14 01:38:35 +00:00
Pagan Gazzard
07fdc55546 Fix entry.sh when DOCKER_ROOT isn't set 2016-06-23 11:37:59 -07:00
Petros Angelatos
af32a48db4 symlink docker root to default path if not already there
docker-delta uses the docker API to query the docker root location.
However, docker returns the path in the host, not the path that it
happens to be bind mounted in the supervisor container. So in order for
the deltas to work properly, these paths must be the same.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-06-09 05:50:51 +00:00
Kostas Lekkas
6193ebe1df Log useful supervisor info to stdout/stderr 2016-05-30 16:51:27 +03:00
Pagan Gazzard
f910ec11a8 Remove even more old terminal related stuff. 2016-04-18 18:13:23 +01:00
Praneeth Bodduluri
1bc53ebc8d Add protection for connman and openvpn every 5 minutes 2016-01-08 18:30:14 +05:30
Praneeth Bodduluri
396fe7d619 Initialize DOCKER_SOCKET in entry.sh 2016-01-08 18:30:14 +05:30
Pablo Carranza Vélez
8585ad718f Use go-systemd/login1 for Reboot/Shutdown 2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
685af77007 Reorganize files, and purge sends 404 when there's no directory.
* 404 when no directory
* fix go-supervisor.conf location
* Use /var/run/resin for gosuper socket
* Remove potential spurious gosuper binaries
2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
53668647c8 Integration test is now working.
* More work on the integration test
* Correctly get supervisor IP
* Use Fatal for test errors
* test-integration working separate from run-supervisor
* Use jenkins' JOB_NAME to identify and remove containers with their volumes
* Document testing procedure
* Document the assume-unchanged tip
* Use /mnt/root for data path
* Nicer secret assignment
2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
513cc24d1c Purge restarts app, and first attempt at integration testing
* Restart app when purging
* Use log.Fatal to exit with status 1
* Quotes in entry.sh
* Use JSON for request body
* Handle errors for parseJsonBody
* Better error printing in main
* First attempt at testing nodesuper from Go
* Cleaner build
* Use ARCH to differentiate concurrent tests/builds
* Use --rm to autoremove containers
2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
dd53bbd1db Call the gosuper from node via unix socket + http. 2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
30ce6f77c4 Gosuper Integration into supervisor image and Jenkins 2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
e3264effe3 Mount tmpfs for supervisor sockets 2015-10-13 13:43:36 -03:00
Praneeth Bodduluri
d300ec6baf User Supervisord for logging 2015-10-13 13:28:00 -03:00
Praneeth Bodduluri
497ecc90a8 Log Supervisor to file and mount the /var/log from host to the supervisor 2015-10-13 13:28:00 -03:00
Pagan Gazzard
fb18d1f3d9 Bash doesn't use set to set variables.. 2015-10-13 13:19:44 -03:00
Pagan Gazzard
0630d8051b Only try to copy the enter.sh if there is a /data directory. 2015-10-13 13:10:12 -03:00
Praneeth Bodduluri
7aa66b5cb6 x86 support + Change localImage variable to SUPERVISOR_IMAGE 2015-10-13 13:09:58 -03:00
Petros Angelatos
9325b258ae Combine scripts 2015-10-13 13:03:16 -03:00
Petros Angelatos
31e8e7c0c6 Use buildstep to build the supervisor just like a normal resin app 2015-10-13 13:02:49 -03:00