Commit Graph

30 Commits

Author SHA1 Message Date
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
Pablo Carranza Velez
b003f48d7b Switch to using knex migrations to set up the database, and change the database format to use integers for ids instead of strings.
Also includes various improvements and bugfixes to services and the migration from legacy /data to volumes.

The switch ti migrations involves a dirty hack for webpack to properly resolve the paths to the migrations js files - it uses an expression
that webpack can't resolve, so we hardcode it to a value and use the ContextReplacementPlugin to make that value resolve to the migrations folder.

The downsides to this approach are:
- a change in knex code would break this
- the migration code is added twice to the supervisor image: once in the migrations folder (because knex needs to loop through the directory to find the files),
and once inside app.js (because I can't make webpack treat them as external)

Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-03-06 10:32:28 -08:00
Pablo Carranza Velez
c463f7fa5b Since armel builds are disabled, do not pull an armel node base image, and ensure we never deploy an armel supervisor
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2018-02-27 08:40:43 -08:00
Pablo Carranza Velez
64372e9cc9 Do the webpack build in an amd64 image to improve build times
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-12-14 03:06:19 -08:00
Pablo Carranza Velez
12ab5c16ea Dockerfile: improve caching by installing devDependencies before copying the code
This should help avoid having to run the npm install for devDependencies (which are actually most of the modules)
every time there's a change in the code.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-12-11 12:44:08 -08:00
Pablo Carranza Velez
a118609256 Add interval and options for the healthcheck
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-12-11 00:11:56 -08:00
Pablo Carranza Velez
95bbe6ea49 Add a /v1/healthy endpoint that fails if the supervisor is unhealthy, and a HEALTHCHECK command to the Dockerfile that uses it
We add an endpoint to the supervisor API that checks the following conditions to determine whether the supervisor is healthy:
* That the update cycle has run fully, in a time that's less than twice the poll interval. Unless we're downloading an image, in which case
we assume it's healthy (otherwise we'd get into the issue of determining a reasonable timeout for the image download, which is already done in a configurable way with delta options and the like).
* That the current state report to the Resin API hasn't failed more than 3 times. Unless the device has no connectivity, or the connectivity check is disabled, in which case we don't know
if the report failed simply because there's no network.
* That the gosuper component is working (since we periodically hit its API to get the IP addresses, we mark it as not working if this API call fails).

We need this endpoint to be unauthenticated for the docker daemon to be able to hit it (though, as the rest of the API, it is protected with iptables rules).

Change-Type: minor
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-12-11 00:11:56 -08:00
Pablo Carranza Velez
ab1be2c12d Improve caching when building gosuper
It seems that the ARG ARCH causes a cache miss in the next RUN statement (for some reason our use of cache-from in the other stages of the build works better, but here it always causes a miss).
We move the ARG statement to later in the Dockerfile, just before actually using it. Hopefully this will improve caching for most supervisor builds.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-11-01 19:04:10 -07:00
Trong Nghia Nguyen
01c39f33b5 Fixes #511, add support for new supervisor image for x86 with quark cpu
boards.

Change-Type: minor
Signed-off-by: Trong Nghia Nguyen <nghiant2710@gmail.com>
2017-11-01 03:33:43 -07:00
Pablo Carranza Velez
c422c91b66 Use a custom webpack loader to avoid uncaught exceptions from JSONStream
JSONStream is a hybrid executable-library that doesn't get along well with webpack: it tries to run its binary code
which can throw uncaught exceptions. So we use a custom loader for it - which replaces remove-hashbang-loader, as it only
affected JSONStream too.

(I tried replacing JSONStream altogether, but turns out dockerode uses it too)

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-10-31 13:29:59 -07:00
Pablo Carranza Velez
9cc2e47e70 Add a sync.js script to allow syncing a running supervisor container on a local device
This handy tool uses the resin-sync module to rsync javascript changes into the running container
on a device in the local network. It allows rapid iterations when testing the supervisor on a real device.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-08-29 08:24:46 -07:00
Pablo Carranza Velez
225f2318ba Remove an unnecessary directory from sqlite3 that took 30MB
node.dtps was big and useless.

See https://github.com/mapbox/node-sqlite3/issues/861

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-08-25 11:19:10 -07:00
Pablo Carranza Velez
7746d6be99 Use a pinned build of the debian image to build base and gosuper, to avoid unnecessary rebuilds
Up to now, a new debian:jessie build would invalidate the cache for the base and gosuper images, slowing down Circle builds.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-07-25 10:52:40 -03:00
Pablo Carranza Velez
8d84facff5 Add a single Dockerfile to build the supervisor as a multi-stage build
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-07-20 21:22:25 -03:00
Praneeth Bodduluri
dba752f6b3 Use ARCH= to define the architecture to build. Embedd version into builds 2015-10-13 13:27:57 -03:00
Pagan Gazzard
5e869f50a3 Switch the supervisor-base image to include the deps we require, allowing make builds to work correctly (and faster, caching more) now that the deps have been removed from deps.sh 2015-10-13 13:27:56 -03:00
Aleksis Brezas
3cb5cb9571 one line apt-get 2015-10-13 13:19:45 -03:00
Aleksis Brezas
712647b69e move package installations to dockerfiles 2015-10-13 13:19:45 -03:00
Praneeth Bodduluri
05a3cba65f apt-get clean everywhere. 2015-10-13 13:19:43 -03:00
Praneeth Bodduluri
2f861fc4d8 Change the Dockerfile base to something that is unique - Allows to simply change a variable to point to a different base 2015-10-13 13:06:43 -03:00
Praneeth Bodduluri
451cb06faf Create a variable for BUILDSTEP_REPO 2015-10-13 13:06:43 -03:00
Praneeth Bodduluri
53f3303abc Use the buildstep pushed to staging & Remove deploy_key 2015-10-13 13:06:42 -03:00
Petros Angelatos
272daea89c Make supervisor deployable with resin 2015-10-13 13:03:16 -03:00
Petros Angelatos
60c863eeac Update buildstep version to v0.0.7 2015-10-13 13:03:16 -03:00
Petros Angelatos
4295a8d96e Update buildstep to v0.0.5 2015-10-13 13:03:14 -03:00
Petros Angelatos
bb2bf83a93 Correct permissions for deploy key 2015-10-13 13:03:14 -03:00
Petros Angelatos
aa6595a767 Use a specific version of buildstep 2015-10-13 13:03:14 -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
Petros Aggelatos
742c6222c9 Base the image on rpi-buildstep 2015-10-13 12:58:56 -03:00
Petros Aggelatos
de342a9209 Revamp/rewrite of supervisor as a docker application 2015-10-13 12:58:55 -03:00