Pablo Carranza Vélez
1a5a9b0e23
findSimilarImage should always return an array, and test the repoTag[0]
2016-01-28 11:08:42 -03:00
Pablo Carranza Vélez
8e4e844cfa
JSON.parse env before checking for delta, and use progress.percentage
2016-01-28 11:08:42 -03:00
Petros Angelatos
1bc149866d
deltas: sync() after running rsync on the new subvolume
2016-01-28 11:08:42 -03:00
Petros Angelatos
f7a2668c4f
config: change default delta endpoint to https and production
...
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-01-28 11:08:42 -03:00
Petros Angelatos
f6f88941eb
delta: only use deltas when RESIN_DELTA is set
...
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2016-01-28 11:08:42 -03:00
Petros Angelatos
582e3322ec
Set a 5 min timeout to delta requests
2016-01-28 11:08:42 -03:00
Petros Angelatos
88f0e4e229
Fix typo
2016-01-28 11:08:42 -03:00
Petros Angelatos
a12ebf884b
Increase rsync timeout to 5 mins
2016-01-28 11:08:42 -03:00
Petros Angelatos
83931a0915
Add timeout to prevent rsync from hanging
2016-01-28 11:08:42 -03:00
Petros Angelatos
071ee3dcf4
Ignore output from dockersync.sh
2016-01-28 11:08:42 -03:00
Petros Angelatos
79d638f4f5
Pass the --delete parameter to rsync
2016-01-28 11:08:42 -03:00
Petros Angelatos
f6eafb7b96
Always send the final progress event
2016-01-28 11:08:42 -03:00
Petros Angelatos
004286a07e
Tag the target image at the last step
2016-01-28 11:08:42 -03:00
Petros Angelatos
595f80e031
Fix rsync stream resumption
2016-01-28 11:08:42 -03:00
Petros Angelatos
7eefee77d0
Fix config var typo
2016-01-28 11:08:42 -03:00
Petros Angelatos
8c7964684a
Return the supervisor tag containing the git commit
2016-01-28 11:08:42 -03:00
Petros Angelatos
d0b6ba1721
Switch to http default transport
2016-01-28 11:08:42 -03:00
Petros Angelatos
bd2f31624b
Delete unused functions
2016-01-28 11:08:42 -03:00
Petros Angelatos
10e166020e
Speed up rsync diff application
2016-01-28 11:08:42 -03:00
Petros Angelatos
c13e16c96a
Remove fallback to docker pull
2016-01-28 11:08:42 -03:00
Petros Angelatos
9adbd81bc0
Avoid shadowing the config variable
2016-01-28 11:08:42 -03:00
Petros Angelatos
11dfbd1687
Don't timeout while waiting for delta
2016-01-28 11:08:42 -03:00
Petros Angelatos
cbde944565
Implement rsync diff fetching method
2016-01-28 11:08:42 -03:00
Pablo Carranza Velez
3e3e2a8d99
Quickfix again: Cast buffer to string when getting OS version. (Sorry)
2016-01-27 17:17:53 +00:00
Pablo Carranza Vélez
94e34ee990
Quickfix: use String .split instead of _.split
...
lodash 3 doesn't have the _.split function :S
2016-01-26 20:56:19 -03:00
Pablo Carranza Velez
8a4514ac00
Report Host OS version to the API
2016-01-26 10:20:04 -03:00
Pablo Carranza Velez
0f20251a8b
Use _.defaults instead of _.extend to ensure internal env vars are not overwritten
2016-01-22 12:40:41 -03:00
Pablo Carranza Velez
11b5e0abc9
Expose resin API key to apps
2016-01-21 17:50:47 -03:00
Pablo Carranza Velez
5961be6ffb
Set status to Idle when download is over
2016-01-21 10:52:36 -03:00
Pablo Carranza Velez
7d31ae9b24
Set download_progress to 0 when beginning download
2016-01-15 16:59:55 +00:00
Praneeth Bodduluri
fb47f73907
Add missing container filtering + Address PR Comments by removing regexp and making more idiomatic choices
2016-01-12 17:58:07 +05:30
Praneeth Bodduluri
396fe7d619
Initialize DOCKER_SOCKET in entry.sh
2016-01-08 18:30:14 +05:30
Pablo Carranza Vélez
17deb53c7c
Revert "Make config.json writes atomic"
2016-01-07 21:01:12 -03:00
Pablo Carranza Velez
c29f54b08c
Make config.json writes atomic
2015-12-19 02:14:07 +00:00
Praneeth Bodduluri
89abff57f6
Fix: Duplicated exports.connectivityCheck in utils.coffee
2015-12-10 20:30:04 +05:30
Pablo Carranza Velez
50137c163d
Bugfix: assign app.containerId before attaching logger
2015-12-04 23:27:45 +00:00
Pablo Carranza Velez
f0afdb9b2a
Only save the app if starting the container was successful
2015-12-02 11:37:47 -08:00
Pablo Carranza Velez
ac0917b114
Quick-fix: knex.select doesn't have .get()
2015-12-01 09:51:06 -08:00
Pablo Carranza Velez
10350c3d4a
Remove volumes when removing a container
2015-11-25 15:00:45 -08:00
Pablo Carranza Vélez
cbb3e2f461
Improve the update strategies:
...
* On handover, fetch old app from DB before starting the new app (and overwriting the DB record)
* Tidy up the logging
* Fix waitToKill so that it actually works
* Several other fixups
2015-11-23 10:02:19 -08:00
Pablo Carranza Vélez
1d6811a423
Implement waitToKill, keep RESIN_OVERRIDE_LOCK, and changelog for update strategies
2015-11-16 19:03:37 +00:00
Pablo Carranza Vélez
13dce75a21
Implement several update strategies
...
* Break up the update function into manageable parts
* Refactor the special variables into the RESIN_SUPERVISOR_ namespace
* Use three update strategies: normal, kill before download, hand over
TO-DO: implement waitToKill in the hand over case.
2015-11-16 19:03:36 +00:00
Praneeth Bodduluri
51ee79b7a2
Fix the error that comes up when no ip addresses are returned by gosuper
2015-11-12 20:33:18 +05:30
Pagan Gazzard
16a9cfa365
Switch to docker-progress for pull progress.
2015-11-10 17:29:22 +00:00
Praneeth Bodduluri
6bc92b4276
Fix semvar versioning in tcp-ping endpoint
2015-11-09 19:50:49 +05:30
Pablo Carranza Vélez
0605a9f4ee
Use generic config.forceSecret[name] and allow forcing logsChannel
2015-11-03 13:49:24 -03:00
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