Commit Graph

516 Commits

Author SHA1 Message Date
Pablo Carranza Velez
4785437ba8 Fixes in app restart behavior:
* Compare config vars to trigger an app restart
* In delete-then-download, only delete when a download is needed
2016-10-05 19:45:18 +00:00
Pablo Carranza Velez
503e043c4c In cleanup, normalize all image tags for comparison 2016-10-04 17:48:11 -03:00
Pablo Carranza Velez
ddaa9f12db Use getRegistryAndName from docker-toolbelt 1.2.0 2016-10-04 14:43:45 -03:00
Pagan Gazzard
19db0e78e0 Switch to v2 api to be able to set is_online 2016-09-30 23:40:03 -03:00
Pablo Carranza Velez
a6f2ff074c Dependent devices, state endpoint, extra env vars and deviceConfig:
* Implement proxyvisor API with dependent device handling
* Use the state endpoint from the API to get the full device state
* Add a deviceConfig db table to store host config separately, and allow deleting config.txt entries
* Expose RESIN_APP_NAME, RESIN_APP_RELEASE, RESIN_DEVICE_NAME_AT_INIT, RESIN_DEVICE_TYPE and RESIN_HOST_OS_VERSION env vars
* Add missing error handler on a stream in docker-utils
2016-09-30 23:40:03 -03:00
Pablo Carranza Velez
e7acff0bcf On cleanup, force removal for images and containers, and remove container volumes 2016-09-29 19:34:19 -03:00
Pablo Carranza Velez
f385fe6bcc Add system logs for Shutdown, Reboot and Purge 2016-09-28 03:32:38 +00:00
Pablo Carranza Velez
4a99fd8803 Implement delete-then-download update strategy 2016-09-26 18:16:01 +00:00
Kostas Lekkas
05690a81dc typo: fix startAppError message 2016-09-20 11:35:28 +03:00
Pablo Carranza Velez
16e2ec286e DRY up calls to gosuper API, and use empty Host header 2016-09-13 16:52:25 -03:00
Praneeth Bodduluri
2cc4b0fb46 Add iptables rules to allow resin-vpn named interface to be used by VPN 2016-09-09 17:41:35 +05:30
Alexios Theodoros Brezas
12a4560518 Catch exec format error and provide friendlier message 2016-09-05 18:22:20 +00:00
Theodor Gherzan
32bf433af1 device.coffee: Remove hardcode of resin-boot partitions's mount point
Signed-off-by: Theodor Gherzan <theodor@gherzan.ro>
2016-09-02 19:55:01 +00:00
Pablo Carranza Velez
ec178f7a7f Use a more conservative message size, and properly account for URI encoding 2016-08-31 16:28:42 +00:00
Pablo Carranza Velez
78b4570b93 Allow storing several messages, will allow us to withstand log bursts better
Also, send a warning message when we start dropping logs.
2016-08-29 19:03:06 -03:00
Pablo Carranza Velez
a8dd29cd82 Change the logger to send at a specific interval and with a different message format
Log messages to PubNub are now an array instead of an object.
Each element of the array is an object with m (message), t (timestamp) and s (isSystem, optional) attributes.
Logs are sent at a specific interval (110ms, fit with some margin to PubNub's approximated 10 messages/s limit), and truncated to PubNub's 32KB limit.
2016-08-29 19:03:06 -03:00
Pablo Carranza Velez
1eb63366ee Allow using an HTTP header for auth 2016-08-16 20:39:55 +00:00
Pablo Carranza Velez
145d124410 Check if rules exist before adding them 2016-08-16 09:30:38 -03:00
Pablo Carranza Velez
c4ea2c77a0 Add iptables rules to block requests to the supervisor API from all interfaces except vpn, docker and local 2016-08-15 18:02:36 -03:00
Petros Angelatos
dd06f993ce bootstrap: if offlineMode is enabled, persist only the uuid
If we don't persist the uuid then every time the supervisor starts it
will think it's a new device. This triggers a wipe of the local state
and also a re-load of the preloaded apps. This in turn causes multiple
instances of the preloaded apps to be left running.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-08-02 23:48:13 -07:00
Petros Angelatos
5ee15e664e utils: allow specifying links in compose files
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-07-28 17:45:16 -07:00
Petros Angelatos
b708f05476 utils: sort compose options
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-07-28 17:43:26 -07:00
Petros Angelatos
eb09713391 Merge pull request #216 from resin-io/215-improve-containers-api
Improve containers API
2016-07-26 20:52:56 -07:00
Petros Angelatos
66fe7fc30c logger: empty the publish queue if in offline mode
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-07-26 14:04:51 -07:00
Pablo Carranza Velez
98d9aca92d Allow the supervisor to work in offline mode
A supervisorOfflineMode true-ish attribute in config.json will cause that:
* If unprovisioned, the supervisor won't try to provision on Resin
* The update cycle will not start as the device won't consider itself provisioned
* Logs will not be sent to pubnub
* Mixpanel events won't be tracked
* The device state won't be updated to the Resin API

This change will also make the Supervisor API work with an unprovisioned device.
2016-07-23 14:04:24 +00:00
Pablo Carranza Velez
02e111ff62 Allow only the options that we know can be supported 2016-07-22 23:28:28 -03:00
Pablo Carranza Velez
4db78b9743 Allow purging and deleting a container from the DB with a purge option 2016-07-22 23:17:25 -03:00
Pablo Carranza Velez
0b4f50d207 Avoid creating duplicate entries in the image table 2016-07-22 23:17:25 -03:00
Pablo Carranza Velez
1d16941a2d Fix cleanup of official images, and allow passing Name in container options 2016-07-22 23:17:25 -03:00
Pablo Carranza Velez
e41ebbb52b Add validation for options when creating and starting containers 2016-07-22 23:17:25 -03:00
Pablo Carranza Velez
54288f036a Improve the docker compose API
- Validate the options in the YAML file
- Define bind mounts for each service as in Resin apps
- Keep the modified compose file inside the supervisor's /data folder
- Fix error reporting in the first stage of "up"
2016-07-22 23:17:25 -03:00
Pablo Carranza Velez
b97fe634d5 Add default binds to containers created with API, add /v1/containers/update endpoint, and add a /data bind with an internal id 2016-07-22 23:17:25 -03:00
Kostas Lekkas
761a0cbd82 Fix double-printed logs after container restart 2016-07-21 22:39:19 +03:00
Pagan Gazzard
8715534d84 Run the linting automatically as part of the jenkins build. 2016-07-19 14:37:46 -07:00
Pablo Carranza Velez
0609619863 Do not bind mount /run/dbus to /run/dbus 2016-07-19 02:13:34 +00:00
Pablo Carranza Velez
f5b0a4e7e7 Default to not bind mounting kmod if container distro can't be found 2016-07-18 16:49:45 +00:00
Pablo Carranza Velez
102eb460db Use log-timestamp to add timestamps to logs 2016-07-18 14:01:16 +00:00
Pablo Carranza Velez
5f926faa70 Bind mount kmod if the container is debian or raspbian
Use docker-toolbelt module.
The bind mount is read-only.
2016-07-15 20:46:09 +00:00
Pablo Carranza Vélez
08d74b578b Fix preloaded apps by passing appId to extendEnvVars 2016-07-06 17:56:51 -03:00
Pagan Gazzard
6cb4b090c5 Rename pullImage to pullAndProtectImage to make it a bit clearer that it isn't a simple pull 2016-06-24 21:08:47 +00:00
Pagan Gazzard
707ed7e1f6 Deduplicate compose command running logic. 2016-06-24 21:08:47 +00:00
Pagan Gazzard
a371e35d5c Deduplicate knex app fetching logic. 2016-06-24 21:08:47 +00:00
Pablo Carranza Velez
4278b6baf1 Add endpoints for docker-compose up and down 2016-06-24 21:08:46 +00:00
Kostas Lekkas
d64d413838 Remove unused vars and fix linting issues 2016-06-16 18:47:12 +03:00
Pablo Carranza Velez
164d565283 Make the data path configurable 2016-06-14 13:50:50 -03:00
Pablo Carranza Velez
a8677a4401 Add listener for container events and reattach on restart 2016-06-11 11:55:22 -03:00
Pablo Carranza Velez
6e39128f3a fix deltas by not using the supervisor as source 2016-06-10 17:22:52 -03:00
Petros Angelatos
573cf31514 fix delta error handling by listening for the 'error' event
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-06-10 19:19:23 +00:00
Alexios Theodoros Brezas
e3f480c217 Container restart policy specificiation.
Allow users to set container restart policy using environment variables.

RESIN_APP_RESTART_POLICY sets the name of the policy, and
if policy is "on-failure", optionally, RESIN_APP_RESTART_RETRIES
sets the maximum number of retries.

More information on docker docs:
https://docs.docker.com/engine/reference/run/#restart-policies-restart

One major change we introduce here is that the default policy is set
to always while we used to have the default "no".

We validate the arguments and pass retries parameter only for the case
of "on-failure" as specified in Docker API as of v1.19.
We could let docker handle the arguments directly, gaining
forwards-compatibility with any new features, but I opted
for an implementation that is as well-defined as possible.
2016-06-07 12:49:30 -03:00
Petros Angelatos
20419bee3b Switch to docker-delta library to use deltas v2
This npm library implements the new delta format and also works with
docker 1.10.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-06-04 01:04:34 +00:00