Commit Graph

505 Commits

Author SHA1 Message Date
12a4560518 Catch exec format error and provide friendlier message 2016-09-05 18:22:20 +00:00
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
ec178f7a7f Use a more conservative message size, and properly account for URI encoding 2016-08-31 16:28:42 +00:00
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
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
1eb63366ee Allow using an HTTP header for auth 2016-08-16 20:39:55 +00:00
145d124410 Check if rules exist before adding them 2016-08-16 09:30:38 -03:00
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
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
5ee15e664e utils: allow specifying links in compose files
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-07-28 17:45:16 -07:00
b708f05476 utils: sort compose options
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-07-28 17:43:26 -07:00
eb09713391 Merge pull request #216 from resin-io/215-improve-containers-api
Improve containers API
2016-07-26 20:52:56 -07:00
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
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
02e111ff62 Allow only the options that we know can be supported 2016-07-22 23:28:28 -03:00
4db78b9743 Allow purging and deleting a container from the DB with a purge option 2016-07-22 23:17:25 -03:00
0b4f50d207 Avoid creating duplicate entries in the image table 2016-07-22 23:17:25 -03:00
1d16941a2d Fix cleanup of official images, and allow passing Name in container options 2016-07-22 23:17:25 -03:00
e41ebbb52b Add validation for options when creating and starting containers 2016-07-22 23:17:25 -03:00
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
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
761a0cbd82 Fix double-printed logs after container restart 2016-07-21 22:39:19 +03:00
8715534d84 Run the linting automatically as part of the jenkins build. 2016-07-19 14:37:46 -07:00
0609619863 Do not bind mount /run/dbus to /run/dbus 2016-07-19 02:13:34 +00:00
f5b0a4e7e7 Default to not bind mounting kmod if container distro can't be found 2016-07-18 16:49:45 +00:00
102eb460db Use log-timestamp to add timestamps to logs 2016-07-18 14:01:16 +00:00
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
08d74b578b Fix preloaded apps by passing appId to extendEnvVars 2016-07-06 17:56:51 -03:00
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
707ed7e1f6 Deduplicate compose command running logic. 2016-06-24 21:08:47 +00:00
a371e35d5c Deduplicate knex app fetching logic. 2016-06-24 21:08:47 +00:00
4278b6baf1 Add endpoints for docker-compose up and down 2016-06-24 21:08:46 +00:00
d64d413838 Remove unused vars and fix linting issues 2016-06-16 18:47:12 +03:00
164d565283 Make the data path configurable 2016-06-14 13:50:50 -03:00
a8677a4401 Add listener for container events and reattach on restart 2016-06-11 11:55:22 -03:00
6e39128f3a fix deltas by not using the supervisor as source 2016-06-10 17:22:52 -03:00
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
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
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
7104806ad1 Correctly compare container image name on cleanup
Docker 1.10 sends containerInfo.Image without the ":latest", so
the image name doesn't match the app's imageId.
This fix first splits the image name into repo and tag and then rebuilds
it to include ":latest" when appropriate. Should avoid removing containers
when using resin-sync.
2016-06-02 14:55:12 -03:00
383be0946e bugfix: do not mutate original env vars object 2016-06-01 00:02:53 +03:00
6193ebe1df Log useful supervisor info to stdout/stderr 2016-05-30 16:51:27 +03:00
ed7b936fee Use buffer-equal-constant-time to evaluate apikey 2016-05-23 23:59:45 -03:00
25be1176d2 Add changelog for alpine super and fix version reporting 2016-05-19 16:25:49 +00:00
d58517f32d Use rwlock to block when images are being pulled 2016-05-19 13:24:23 +00:00
95f4fdb97f Add /v1/images/load endpoint 2016-05-18 13:47:54 -03:00
951bd2888f Fix routing for deleting images with a slash in the name 2016-05-17 19:18:39 +00:00
7b9eaeea3a Add some protections to avoid deleting supervisor or app containers 2016-05-17 00:03:23 +00:00
3a77c2ec4b Allow passing tag when using fromImage in /v1/images/create 2016-05-13 10:35:03 -03:00
dcc3717949 Use Routers to separate endpoints with bodyParser 2016-05-13 10:35:03 -03:00