Commit Graph

520 Commits

Author SHA1 Message Date
Pablo Carranza Vélez
b08a028d69 Use random secret for logs channel 2015-10-28 20:02:00 -03:00
Pablo Carranza Vélez
811e929955 Don't bind mount docker.sock. It doesn't exist on devices that use rce 2015-10-16 13:56:06 +00:00
Pablo Carranza Vélez
ee273f1ec7 Expose a RESIN_SUPERVISOR_VERSION env var to app 2015-10-15 23:08:21 +00:00
Pablo Carranza Vélez
4bcba5adf6 Refactor to use a different name for the env vars (otherwise resin-vars overrides it with a null value) 2015-10-14 18:50:26 -03:00
Pablo Carranza Vélez
33d402c3c0 Default PubNub and Mixpanel keys are now passed at build time 2015-10-14 16:53:33 -03:00
Pablo Carranza Vélez
7eb17bd79b Don't let the bootstrap delete apiSecret from DB 2015-10-13 13:45:08 -03:00
Pablo Carranza Vélez
b57dd10e81 Add API endpoint to expire and create new API key 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
4130df7771 Add Changelog and switch to using RESIN variables 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
96d4aebb76 Refactor api.go to use abstracted sendResponse and sendError - Also fix most go doc complaints 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
4413397103 Abstract update polling function and fix wrong comment for disabling logging 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
8fe516253a Modify the earlier logic of Interval instead of a timeout 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
50a804683d Use Promises for requests+ Add better console logs 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
9efcc59252 Reorganize callbacks to utils and check for status accepted from go supervisor 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
e43e11b3c1 Enable control of API poll interval through Device Variables 2015-10-13 13:45:08 -03:00
Praneeth Bodduluri
b91cb78eea Allow control of VPN + TCP check + Pub nub logs with Device Environment variables 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
3d7f5f3ced Fix getting API key from DB by returning its .value 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
e975f0f69f Do auth for localhost too 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
ec6fd6eb03 Pass api key to app, and keep it saved in the DB (do not regenerate on startup) 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
6ed2fddd37 Wrap all update errors as Errors 2015-10-13 13:45:07 -03:00
Petros Angelatos
2d891262a7 wait 5s after sending SIGTERM and before sending SIGKILL
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
0fd03054e8 Expose supervisor API to app by allowing all requests from 127.0.0.1 and passing address and port as env vars 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
7f7a550363 Only apply boot config or special actions when env vars have changed and within lock, and persist the new env to the DB 2015-10-13 13:45:07 -03:00
Pablo Carranza Vélez
8da8092104 Use a function in utils to extend env vars 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
65df89aab6 Give extra environment variables to preloaded apps. Ensures the app is not unnecessarily restarted as soon as we gain connectivity. 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
d25447d539 Promisify executeSpecialActionsAndBootConfig and remount /boot rw 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
c136793cdd Blacklist certain config.txt entries, Update node to 0.10.40 everywhere
Use board-specific images until we have new arch based ones
2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
39a07b8cd4 Remove the RPi /boot bind mount 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
0e283e8e72 Actually apply config.txt changes and reboot
Keep the original statements where possible. (to ensure same config keys under different filters are not overwritten with always the same value)
2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
8b4d1e9f75 Ensure special env vars are persistent and add placeholder for device.setBootConfig 2015-10-13 13:45:06 -03:00
Praneeth Bodduluri
38df4651cb Change to using _.has 2015-10-13 13:45:06 -03:00
Praneeth Bodduluri
173d5ee651 Execute the callback function associated with the specialActionVars only once and remove unused parts 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
941d3b15af Allow special env vars with a callback which don't cause an app restart 2015-10-13 13:45:06 -03:00
Praneeth Bodduluri
66a4bf4ab3 Remove unused config.supervisorContainer in config.coffee 2015-10-13 13:45:06 -03:00
Pablo Carranza Vélez
bd889e06a1 Bind mount /boot in RPi 2015-10-13 13:45:06 -03:00
Praneeth Bodduluri
391a141843 Change ipAddress to IPAddresses and add error message on unknown ip addr type 2015-10-13 13:45:05 -03:00
Praneeth Bodduluri
ea0b058721 Change APIResponse to a struct with a Data Interface 2015-10-13 13:45:05 -03:00
Praneeth Bodduluri
e1957def25 Address style fixes in app.coffee 2015-10-13 13:45:05 -03:00
Praneeth Bodduluri
f86f5881d9 Implement and use golang endpoint for getting ipaddress' of the device 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
8eb1c3ea7b Ensure we have the deviceId by GETting it from the Resin API 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
8de173f6c3 Use crypto.randomBytes for API secret 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
0373607c56 Refactor bootstrapper. Run preloaded supervisor dind. Change dind configs to be ignored and document how to populate them. 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
909e193cea Update resin-register-device to 2.0.0 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
9d2c142c36 Put preloaded apps in DB, and use promise for when boostrap is done 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
0bfd329ebc change the bootstrap process 2015-10-13 13:45:05 -03:00
Pablo Carranza Vélez
6f42fc2036 Try to do systemd calls in gosuper 2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
3da4dae190 Add systemd interface and reboot/shutdown endpoints 2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
53ed41a4e2 Allow lockfile force to be specified in the request body 2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
d5ddad914e Add /v1/restart API endpoint 2015-10-13 13:45:04 -03:00
Praneeth Bodduluri
a15c9e636e Add additional mount for the host's docker.sock 2015-10-13 13:45:04 -03:00
Praneeth Bodduluri
efc272533c Also mount the host dbus on host_run/dbus 2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
6e62366541 Always unlock the lockfile when killing the app.
Otherwise, we have a deadlock whenever the lock is forced: the app
will be restarted, and will find the lockfile is already there so it won't be
able to lock/unlock it. The supervisor will have the same problem.
So the solution is that, whenever we kill the app, that is the lock owner, we also unlock the file.
2015-10-13 13:45:04 -03:00
Pablo Carranza Vélez
233004d130 Download/update/remove/install all apps in a map 2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
4aea117330 Purge handles strings and numbers, and is tested with a table 2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
3da961d4fd Use env var for force, and don't touch lockfile on force
Also:

* Force lock when purging

* Use updateStatus object to keep update state
2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
c7c4aed746 Use rwlock together with lockfile
Select app to kill from DB within lock (otherwise, if some other part kills and restarts the app, the
containerId will have changed and the real container will not be removed).
2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
d1b317399e Updates by appId and use Promise.using for lock
Change the update cycle to go by appId instead of imageId.
Use Promise.using for lockFile locks and unlocks.
Now updates shouldn't stop if one of the apps fails to update
(it's a step towards better supporting multiple apps).

Forcing the lock now works.

Remove unnecessary require fs

Nicer assignment for s in joinErrorMessages
2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
1eb31ce5f6 Apply coffeelint everywhere 2015-10-13 13:45:03 -03:00
Pablo Carranza Vélez
c52c2c0bd9 First attempt at locking updates with files 2015-10-13 13:45:03 -03:00
Praneeth Bodduluri
a8e1d476e3 Change to use 204 for API, Remove extra space in upscript.sh and Make fswatch start only on EEXIST error 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
7b8ca9fd73 Start the fs watch after the VPN directory has been created - Use finally and not then 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
ac545ccc52 Change the EEXIST to a function 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
a57c723e8a Remove inotify and lint changes 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
a4966a798a Change the fs functions to promise 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
0213916b90 Style changes 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
8642371094 Pause TCP Pings on VPN connection 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
d6b6d2d73b Distinguish betweek - permanent TCP check disable and pausing tcp check 2015-10-13 13:43:37 -03:00
Praneeth Bodduluri
03299d77f5 API to pause TCP checks 2015-10-13 13:43:37 -03:00
Pablo Carranza Vélez
c250ff483c Fix double app start (app.id = null after kill) 2015-10-13 13:43:37 -03:00
Pablo Carranza Vélez
c2496d30c2 Use Promise Disposer for lock, + cleanup 2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
6d54e6663e Lock app restart, cleanup and better testing 2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
9bc2f6212d Handle App not found in purge, + cleanup
* gosuper in dockerignored folder
* correctly handle app not found in purge
* test formatting in test-gosuper
* Fix test-gosuper
* DRY up test-integration
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
5d5f38ea69 Add /lib/firmware to the app bind mounts 2015-10-13 13:43:36 -03:00
Pablo Carranza Vélez
1e340f4fac Return when no appId 2015-10-13 13:43:35 -03:00
Praneeth Bodduluri
418d838dec Make resolv.conf writable from a User container 2015-10-13 13:43:35 -03:00
Pagan Gazzard
b8ecdb3ce2 Rename state module to device and use sensible function names for the new module name. 2015-10-13 13:43:35 -03:00
Pagan Gazzard
0917a46a2d Separate the device state updating into its own module. 2015-10-13 13:43:35 -03:00
Pagan Gazzard
3ad47adce4 Fix an issue where an image would not be cleaned up if it was tagged in multiple repos. 2015-10-13 13:43:35 -03:00
Juan Cruz Viotti
aead4c7531 Make use of resin-register-device 2015-10-13 13:42:25 -03:00
Pagan Gazzard
4003bd4828 Write the registered_at time to config.json as well, in case there is a failure between writing to config.json and writing to knex [Page] 2015-10-13 13:39:39 -03:00
Pagan Gazzard
1ee3072c75 Force a newer bluebird so that we can rely on error properties also being available on the root error. 2015-10-13 13:39:39 -03:00
Pagan Gazzard
52d4cfb9d9 Fix an error where mixpanel events would have the wrong uuid set on first provision. 2015-10-13 13:39:39 -03:00
Pagan Gazzard
ab26c6a401 Don't cache config.json 2015-10-13 13:39:38 -03:00
Praneeth Bodduluri
cb24f338af Add /etc/resolv.conf bind mounts 2015-10-13 13:39:38 -03:00
Pagan Gazzard
e56d9b678e Stop displaying an error message when trying to start a container that is already started. 2015-10-13 13:39:38 -03:00
Pagan Gazzard
a959660f90 Improve error messages reported to the user in the case of finding an empty string. 2015-10-13 13:39:38 -03:00
Pagan Gazzard
e38796e92a Fix trying to delete supervisor container when it reports an alternate tag instead of the primary tag. 2015-10-13 13:39:38 -03:00
Pagan Gazzard
099c13446a Switch to using the dockerode pull progress mechanism. 2015-10-13 13:39:38 -03:00
Pagan Gazzard
b6a1388c56 mixpanelTrack expects the error property to be called error 2015-10-13 13:39:38 -03:00
Pagan Gazzard
4d3a179fcb Nicer error when image tag isn't found 2015-10-13 13:39:38 -03:00
Pagan Gazzard
0063eaf7e7 Reset download progress to null when starting up the supervisor. 2015-10-13 13:39:38 -03:00
Pagan Gazzard
b4306e85db Fix reporting errors without a "cause" 2015-10-13 13:39:37 -03:00
Pagan Gazzard
1b0cdfe094 Remove some logging from supervisor that wasn't that useful (and caused a lot of noise when looking for issues). 2015-10-13 13:39:37 -03:00
Eugene Mirotin
0cb3316ad9 use pinejs request for env vars retrieval 2015-10-13 13:39:37 -03:00
Eugene Mirotin
9b14babc78 use API endpoint to get merged env vars 2015-10-13 13:39:37 -03:00
Pagan Gazzard
98ae03cf67 Add success/failure messages for better user info when there are issues. 2015-10-13 13:39:09 -03:00
Pagan Gazzard
368a23b823 Centralise the logging logic. 2015-10-13 13:39:09 -03:00
Pagan Gazzard
7a3d5b06c2 Report failures to start the container (eg bad CMD in a Dockerfile) 2015-10-13 13:39:09 -03:00
Pagan Gazzard
84b5746111 Share request settings between request and pinejs-client, and make sure a 30s timeout is used. 2015-10-13 13:39:09 -03:00
Pagan Gazzard
c29e0720c6 Switch to monitoring if the host is reachable via tcp, rather than a using a full http request. 2015-10-13 13:39:09 -03:00
Pagan Gazzard
a97cd40b44 Close the tty.js server as well as the ngrok listener. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
5f5b6f5be1 Fix stopping a tty session via the api using the wrong app id. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
cd6dbedfa2 Be very careful about marking an update attempt finished 2015-10-13 13:39:08 -03:00
Pagan Gazzard
c8df0b2f9e Make use of the new cache feature of the request backend for pinejs-client 1.2.0 to make use of an ETags based cache for requests to the api. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
82873d2ef2 Add a comment about updateDeviceState 2015-10-13 13:39:08 -03:00
Pagan Gazzard
48c21e9275 Keep track of target and actual device state, and make sure we keep updating the api with any differences until the two match. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
7765bc6a59 Just consume the stream for publish, avoiding any chance of it returning a value and getting stored up in the stream. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
2c94ea57a2 Only load ngrok/tty on demand. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
d578bbfba3 Use the new status/send/sendStatus style. 2015-10-13 13:39:08 -03:00
Pagan Gazzard
6144ea3aeb Update to express ^4.0.0 2015-10-13 13:39:08 -03:00
Pagan Gazzard
933cbdedad Be more frugal with the bandwidth used for device updates. 2015-10-13 13:37:56 -03:00
Pagan Gazzard
5b82667b3b Remove unused require. 2015-10-13 13:37:56 -03:00
Pagan Gazzard
73c7f29c65 Update pinejs-client to ^1.0.0 2015-10-13 13:37:53 -03:00
Pagan Gazzard
8ca8f96f46 Switch to npm deps for blinking and network-checker 2015-10-13 13:37:08 -03:00
Eugene Mirotin
433d0bc0f0 shorter defaults setting, also allows manual timestamps should someone need them 2015-10-13 13:36:13 -03:00
Eugene Mirotin
d47fdf8a3c log compound messages with timestamp and proper system flag 2015-10-13 13:36:13 -03:00
Pagan Gazzard
3d83c03868 The SUPERVISOR_IMAGE is now the fully qualified image (since it can be on another registry) - update to work with this and stop attempting to delete the actual supervisor image. 2015-10-13 13:36:13 -03:00
Pagan Gazzard
16dea4efcc Download the new version of an application before stopping/deleting the old. 2015-10-13 13:36:13 -03:00
Aleksis Brezas
af89179886 reset provisioning progress to null when supervisor starts 2015-10-13 13:36:12 -03:00
Pagan Gazzard
2d5dca2171 Make sure the supervisor version update is also retried until succeeding. 2015-10-13 13:36:12 -03:00
Pagan Gazzard
1784c75c57 Add secret/apikey based authentication to the supervisor. 2015-10-13 13:36:12 -03:00
Pagan Gazzard
fafef6cc6f Post the supervisor api port to the resin api. 2015-10-13 13:36:12 -03:00
Pagan Gazzard
c8023e0780 Add a config var to determine what port for the api to listen on. 2015-10-13 13:36:12 -03:00
Pagan Gazzard
644ad14295 Use the api to do the filtering, avoiding fetching unnecessary data. 2015-10-13 13:36:12 -03:00
Eugene Mirotin
3c9be7e2ed update Open terminal button styles 2015-10-13 13:36:12 -03:00
Aleksis Brezas
7161c04123 update config.json on device registration 2015-10-13 13:36:12 -03:00
Pagan Gazzard
3f94b353f5 Remove VPN from the supervisor 2015-10-13 13:36:12 -03:00
Aleksis Brezas
c667b55025 move uncaught exception to the top of app.coffee 2015-10-13 13:36:12 -03:00
Aleksis Brezas
0665054a79 no updates 2015-10-13 13:34:23 -03:00
Pagan Gazzard
f216a691a1 Add missing import to logger module. 2015-10-13 13:29:42 -03:00
Pagan Gazzard
ab44c79f62 Switch to using a separate module for network checking. 2015-10-13 13:29:42 -03:00
Pagan Gazzard
f0682b162a Switch to using a separate module for blinking. 2015-10-13 13:29:42 -03:00
Pagan Gazzard
b1d16da9fa Separate out the pubnub logging functionality. 2015-10-13 13:29:40 -03:00
Pagan Gazzard
56f54331a5 Fix TypeError: Cannot read property 'Running' of undefined 2015-10-13 13:28:00 -03:00
Pagan Gazzard
848aa66494 Fix reference error. 2015-10-13 13:28:00 -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
Aleksis Brezas
b584c6b705 improve code flow 2015-10-13 13:28:00 -03:00
Aleksis Brezas
528bf39a66 use docker inspect output 2015-10-13 13:28:00 -03:00
Aleksis Brezas
85626a4157 Exited containers do not have empty status 2015-10-13 13:28:00 -03:00
Pagan Gazzard
df536f672f Update to pinejs-client-js v0.3.1 2015-10-13 13:28:00 -03:00
Pagan Gazzard
fe05824429 Extract out a duplicate function. 2015-10-13 13:28:00 -03:00
Pagan Gazzard
9673ae40d9 Remove some unneeded dependencies. 2015-10-13 13:28:00 -03:00
Pagan Gazzard
c5506d4566 Separate vpn connecting. 2015-10-13 13:28:00 -03:00
Pagan Gazzard
a7f5689873 Separate vpn bootstrapping. 2015-10-13 13:28:00 -03:00
Pagan Gazzard
6aa6ff5773 Specify the tty app to stop. 2015-10-13 13:28:00 -03:00
Pagan Gazzard
e25563f85c Add a dummy user.js 2015-10-13 13:28:00 -03:00
Pagan Gazzard
f0afcb706a Separate out tty.js 2015-10-13 13:28:00 -03:00
Pagan Gazzard
0b93c1ce2c Use typed-error for the disconnected error. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
e054b36d58 Use sensible defaults for the blink patterns, and make use of it for the API blink. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
b63e7fd595 Accept the pattern as an argument for the blink module. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
cd2603f228 Change the blink pattern to use a pattern specified by an object. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
c218adb09e Separate the blinking out, ready to move to a separate module. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
1c46e1e2a4 Separate the network polling out, ready to move to a separate module. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
e67de4b279 Simplify the state checking logic. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
49d6e3142c Use a 10s timeout for the connectivity check to make the internet connectivity check more responsive. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
bf0b38354f Use a repeating blink pattern that starts on the first failed internet check, and is consistent until we get internet again.
Previously it would pause whilst waiting for the next check (potentially a very very long time, as request doesn't have a timeout by default)
2015-10-13 13:27:59 -03:00
Pagan Gazzard
5e380fb66a Turn the connectivity check into a singleton, so we only have one running. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
2557ebcfc2 Move the connectivity check into utils. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
63f1d66402 Fix trying to delete supervisor images. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
58b9040a36 Use read -p to wait for enter. 2015-10-13 13:27:59 -03:00
Aleksis Brezas
32e1712df7 register device fallback fix 2015-10-13 13:27:59 -03:00
Pagan Gazzard
53196208b0 Start the connectivity check straight away, rather than waiting for bootstrapping to succeed. 2015-10-13 13:27:59 -03:00
Aleksis Brezas
460768d366 do not override dockerfile cmd 2015-10-13 13:27:59 -03:00
Pagan Gazzard
fcc6d1375d Fix the default device type. 2015-10-13 13:27:59 -03:00
Pagan Gazzard
b9675de9e0 Change IP address update interval from 5m to 30s 2015-10-13 13:27:58 -03:00
Petros Angelatos
7ffb65d3fa Expose host dbus to containers. This enables control of host connman 2015-10-13 13:27:58 -03:00
Aleksis Brezas
433f0920c8 remove exited supervisors 2015-10-13 13:27:58 -03:00
Aleksis Brezas
86c2e1280e delete exited containers 2015-10-13 13:27:58 -03:00
Pagan Gazzard
f5f6ee3a61 Enable compression for all of our custom requests. 2015-10-13 13:27:58 -03:00
Pagan Gazzard
26c8b140ce Only get the device id once, rather than for every request to updateDeviceInfo 2015-10-13 13:27:58 -03:00
Pagan Gazzard
6a50889086 Only select the fields we need to compare/update apps. 2015-10-13 13:27:58 -03:00
Pagan Gazzard
de6de9d397 Select just the id as it's all we need, and reduces network traffic. 2015-10-13 13:27:58 -03:00
Aleksis Brezas
e6e42d6631 improved getregistryandname 2015-10-13 13:27:58 -03:00
Aleksis Brezas
4185fb56c8 comment docker utility functions 2015-10-13 13:27:58 -03:00
Aleksis Brezas
a5ee91ceaf calculate progress in a transform stream and expose a callback for progress events 2015-10-13 13:27:58 -03:00
Aleksis Brezas
6b496693ad download progress bars 2015-10-13 13:27:58 -03:00
Aleksis Brezas
cdca01eed1 Use require to parse package.json for supervisor version 2015-10-13 13:27:58 -03:00
Aleksis Brezas
523a8b5637 update device supervisor_version 2015-10-13 13:27:58 -03:00
Pagan Gazzard
3b2b75998e Tell startNewSupervisor which image to start, we need to start the working image on a restart, and the new (possibly broken) image on update. 2015-10-13 13:27:58 -03:00
Pagan Gazzard
c8a7c49cd5 Move the application update poll interval to an env var and reduce to 60s. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
c7c1c45f38 Deal with int env vars more nicely (actually parse them and check they're valid ints) 2015-10-13 13:27:57 -03:00
Praneeth Bodduluri
10012a48cf Enforce a TLS check while connecting to the server - Prevents MITM 2015-10-13 13:27:57 -03:00
Pagan Gazzard
ffc05f9d84 Use .constructor.prototype for promisifying instead of __proto__. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
00d725cfac Move the cleanupContainersAndImages code into the docker utils, and make use of a count of currently fetching images to only clean up images if we aren't fetching any. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
07a4df1d05 Share the code for fetching an image. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
67c9db9fce Move the docker promisification/creation to a util lib. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
73c62cb5be Make sure the responses are at least non-empty, otherwise we're going to get into a broken vpn situation. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
4c257c8e7d Log the body of the sign_certificate response, it'd be very useful for debugging. 2015-10-13 13:27:57 -03:00
Pagan Gazzard
19e066bf24 Log errors when updating device info. 2015-10-13 13:27:56 -03:00
Pagan Gazzard
0240f74f47 Fix reference error when failing to delete containers. 2015-10-13 13:27:56 -03:00
Aleksis Brezas
c4f9fd853d require config is needed to retry bootstrap 2015-10-13 13:27:56 -03:00
Pagan Gazzard
2a28046533 Use Promise suffix for promise to make it a little clearer. 2015-10-13 13:27:56 -03:00
Pagan Gazzard
6c9ccfcb8c Make the supervisor container remove itself rather than just exiting when launching a new supervisor. 2015-10-13 13:27:56 -03:00
Pagan Gazzard
cd7ee9b82f There is no need to resolve currentSupervisor again as we have already resolved it. 2015-10-13 13:27:56 -03:00
Pagan Gazzard
7e3c9707cb Cleanup containers as well as images, this stops issues with having containers hanging around on an old image, stopping that image from being deleted. 2015-10-13 13:27:56 -03:00
Aleksis Brezas
01f6794ccd meta logs system prefix 2015-10-13 13:27:56 -03:00
Aleksis Brezas
b24a06a935 use channel prefix for differentiating with app logs 2015-10-13 13:27:56 -03:00