Commit Graph

1602 Commits

Author SHA1 Message Date
Pablo Carranza Velez
f76aacc7fb Avoid trying to send a response to API calls after we've already sent an error
In some cases we were using early `return res.status(...).send(...)` to send 400 errors
but this happened inside a promise chain that later sent another status and response.

We fix this with the correct indentation of the success response so that an early return doesn't fall there.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-09 14:48:34 -08:00
Pablo Carranza Velez
79b4d39acd Fix passing a target service to start in /v1/apps/:appId/start, and getting the containerId
We weren't passing a "target" to serviceAction, which made the start action fail.
Plus we need to get the container again after starting to get the latest containerId.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-09 14:41:19 -08:00
resin-io-versionbot[bot]
f4e07e3ce8
Auto-merge for PR #577 via VersionBot
gosuper: Treat systemd unit states that are not "inactive" or "deacti…
2018-03-09 18:17:14 +00:00
resin-io-versionbot[bot]
0f7c9f66dc v7.1.7 2018-03-09 17:41:40 +00:00
Pablo Carranza Velez
58bb660758 gosuper: Treat systemd unit states that are not "inactive" or "deactivating" as enabled states
This should make the supervisor detect the VPN as enabled when it's starting up (or restarting because of an error).

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-09 09:19:54 -08:00
resin-io-versionbot[bot]
3b60065f12
Auto-merge for PR #575 via VersionBot
Fix bug in image management after update
2018-03-09 15:33:59 +00:00
resin-io-versionbot[bot]
affdcb1bc8 v7.1.6 2018-03-09 15:19:23 +00:00
Pablo Carranza Velez
f009e34293 migrations: Use the correct service name for legacy apps
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-09 06:54:16 -08:00
Pablo Carranza Velez
b6631b7367 ApplicationManager: only use dockerImageId to identify images for current apps, to avoid trying to delete an image that is in use
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-09 06:54:16 -08:00
resin-io-versionbot[bot]
bc153ffe5d
Auto-merge for PR #574 via VersionBot
Fix bug in require for migrations for legacy preload
2018-03-09 14:47:07 +00:00
resin-io-versionbot[bot]
bda308306d v7.1.5 2018-03-09 14:33:32 +00:00
Cameron Diver
d27c529ebe
Fix bug in require for migrations for legacy preload
Change-type: patch
Connects-to: #573
Signed-off-by: Cameron Diver <cameron@resin.io>
2018-03-09 14:10:11 +00:00
resin-io-versionbot[bot]
f6df2a3b96
Auto-merge for PR #571 via VersionBot
compose: fix type error, createVolume returns a promise
2018-03-09 08:26:23 +00:00
resin-io-versionbot[bot]
ae2a1acb14 v7.1.4 2018-03-09 08:13:11 +00:00
Petros Angelatos
4ba020a784
compose: fix type error, createVolume returns a promise
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Change-type: patch
2018-03-09 00:00:44 -08:00
resin-io-versionbot[bot]
d61c5fe640
Auto-merge for PR #570 via VersionBot
lib: add missing flag to openAsync()
2018-03-08 23:18:50 +00:00
resin-io-versionbot[bot]
feec2c0267 v7.1.3 2018-03-08 23:05:38 +00:00
Petros Angelatos
7d03de51f6
lib: add missing flag to openAsync()
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Change-type: patch
2018-03-08 14:59:07 -08:00
resin-io-versionbot[bot]
f273da4828
Auto-merge for PR #569 via VersionBot
compose: fix volume migration code
2018-03-08 22:37:07 +00:00
resin-io-versionbot[bot]
3c20663979 v7.1.2 2018-03-08 22:23:38 +00:00
Petros Angelatos
4b83a08512
compose: fix volume migration code
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Change-type: patch
2018-03-08 14:15:50 -08:00
resin-io-versionbot[bot]
615ee5df9a
Auto-merge for PR #568 via VersionBot
Convert object to array when normalising legacy target apps
2018-03-08 16:20:24 +00:00
resin-io-versionbot[bot]
f12882b3fd v7.1.1 2018-03-08 16:04:16 +00:00
Cameron Diver
a150dbf329
Convert object to array when normalising legacy target apps
Change-type: patch
Connects-to: #567
Signed-off-by: Cameron Diver <cameron@resin.io>
2018-03-08 15:48:03 +00:00
resin-io-versionbot[bot]
5320b92c98
Auto-merge for PR #566 via VersionBot
New base image and ipv6 support
2018-03-07 16:07:27 +00:00
resin-io-versionbot[bot]
1520f7f702 v7.1.0 2018-03-07 15:54:35 +00:00
Petros Angelatos
cda561f997 Introduce workaround for IPv6 DNS resolution until nodejs becomes RFC 3484 compliant
Change-Type: patch
2018-03-07 07:01:43 -08:00
Pablo Carranza Velez
2f0fcff8ef Start using an externally built resin/$ARCH-supervisor-base:v1.1.0 as base image, which adds the verbatim option to dns.lookup
Depends-on: https://github.com/resin-io/resin-supervisor-base/pull/5
Change-Type: minor
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-07 07:01:43 -08:00
resin-io-versionbot[bot]
a60f1a1077
Auto-merge for PR #482 via VersionBot
Multicontainer
2018-03-07 13:37:25 +00:00
resin-io-versionbot[bot]
80f06adb0f v7.0.0 2018-03-07 13:23:36 +00:00
Pablo Carranza Velez
1b043230a5 Send logs to the resin API by default
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 21:10:04 -08:00
Pablo Carranza Velez
15da221382 Implement a new logger that sends logs to the resin API, that can be used optionally instead of PubNub
Change-Type: minor
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 21:09:06 -08:00
Pablo Carranza Velez
16f12920c1 Fix the way commands and entrypoints in string form are parsed
Turns out shell-quote's parse function also replaces environment variables, which we don't want in this case. So we escape dollar signs
before calling shell-quote's parse function.

Also shell-quote takes some characters like `>` and globs and returns an object - so we return those objects to string form.

This should still be simpler/better than writing our own shlex.split, I hope...

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
dc62418db4 Some fixes in current state reporting, error handling for "container not found", plus more style improvements
Also, ensure the properties argument to eventTracker.track is an object

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
bb57bcc37c Fix default volume name in migrations, and do not use the legacy-container flag on containers from older supervisors (they'll be restarted anyways)
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
58fede2976 Only report initial config variables when they're different from the default
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
58b167b43d Various bugfixes and sytlistic improvements
* Use the correct defaults for the delta config variables that have them

* Only mount /lib/firmware and /lib/modules if they exist on the host

* hardcode-migrations.js: Nicer line separation

* APIBinder: switch to using a header for authentication, and keep credentials saved in the API clients

* Fix hrtime measurements in milliseconds

* Do not uses classes for routers

* compose: properly initialize networkMode to the first entry in networks if there is one

* Fix some details regarding defaults in validation and service

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
ec22bfcb29 Support for several compose features
Plus a few bugfixes.

* Add support for cgroup_parent

* Add support for specifying a single value in tmpfs

* Fix support for extra_hosts

* Add support for group_add

* Add support for pid mode (only host and empty value are supported for now)

* Add support for pids_limit

* Add support for security_opt

* Add support for storage_opt

* Add support for userns_mode

* Add support for ipc (except for another container's)

* Add support for mac_address

* Add support for oom_kill_disable

* Add support for 'user' compose option

* Add support for working_dir and fix support for user when image specifies it

* Add support for bind-mounting the balena socket using a label

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
38c3a8bdf3 Avoid starting services that exit repeatedly
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
ba829412e1 Various bugfixes
* Get imageId when normalising a dep. app from the DB

* Fix the appId in migrations when updating the supervisor

* Use the update lock to update a service's metadata

* Restart clears volatile target state

* Fix function definition for updateMetadata

* Improve backwards compatibility of /v1/apps/:appId endpoint

* Fix multicontainer deltas to work with resumable-request 2.0

* Fix dependent target normalisation logic

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Lucian Buzzo
da2359e224 Fix API payload when provisioning a dependent device 2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
7ed27ea203 Some fixes on migrations, dependent devices and deltas
* Switch default dependent device type to generic

* Reduce noise in logs

* Limit to 3 simultaneous delta downloads

* Better check for deltaSource

* When checking volume dependencies, do not compare regular (non-named) volumes

* Store imageId for dependent apps, and don't report dependent images with invalid imageIds

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
e43c9052dd Improve backwards-compatible response of GET /v1/device
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
3fd52bb0c7 Simplify the update logic by making fetch and kill (the only long-running actions) happen in the background, and always waiting for all actions before continuing
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:29 -08:00
Pablo Carranza Velez
c0ac2c21a4 Do not override stop_grace_period
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
ef849f8d82 When exiting, try to clean up any taken update locks
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
2ed3c832ac Do a regular pull instead of delta from scratch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
484a688dbd Pause updates while purging or restarting apps, and ensure an applyTarget is triggered after the actions run
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
82d5a16c8c Add change events when services exit and restart, and add stop-service and start-service endpoints
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
8548222a00 Several bugfixes:
* Ensure commit is only reported when update has finished

* Change default delay between actions to 100ms

* Fix envArrayToObject for cases where the env var has an equal sign

* Use shell-quote to properly parse string command and entrypoint

* Fix preloading with a legacy apps.json

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00