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
Aleksis Brezas
df2066e4de
supervisor meta logs
2015-10-13 13:27:52 -03:00
Pagan Gazzard
5cf8e2c180
Silence the pubnub "Missing Message" errors.
2015-10-13 13:19:45 -03:00
Pagan Gazzard
85e1777a65
We can use mapSync as we don't need anything asynchronous, also we can return nothing as we're done with the stream data at that point.
2015-10-13 13:19:45 -03:00
Pagan Gazzard
7f38248cfa
Let the new supervisor handle tagging itself as a working supervisor, this means that the check that a supervisor update is a working update will not be nullified by a reboot.
2015-10-13 13:19:45 -03:00
Aleksis Brezas
4cf6ce657a
use promise.try to start promise chain
2015-10-13 13:19:45 -03:00
Aleksis Brezas
2d4c22d6eb
use resin-platform-api
2015-10-13 13:19:45 -03:00
Aleksis Brezas
9c9d520da7
multi device support
2015-10-13 13:19:45 -03:00
Aleksis Brezas
ffedae683d
early stage app
2015-10-13 13:19:44 -03:00
Pagan Gazzard
2d8df956a6
Move the starting timeout to a config var.
2015-10-13 13:19:44 -03:00
Pagan Gazzard
2210b1be29
Only wait for success if we're restarting due to an update attempt.
...
If we're restarting for binds/mounts then we're already in a non-working state, and starting the new supervisor may have to wait for bootstrap to complete (which takes an indefinite amount of time to complete, meaning the timeout was killing the new container before it could bootstrap in some cases)
2015-10-13 13:19:44 -03:00
Pagan Gazzard
5efcde7922
Start the supervisor update check ASAP, it allows us to push (and automatically update to) new supervisor images that fix issues in earlier stages.
2015-10-13 13:19:44 -03:00
Pagan Gazzard
5bb552f065
Make mixpanelTrack nicely handle errors being passed in and use it for logging bootstrapping errors.
2015-10-13 13:19:44 -03:00
Pagan Gazzard
f43afd4a95
Retry the bootstrap process if it fails - this means that we remove a point of failure (the previous connectivity check barrier merely reduced the chance of hitting that failure point)
2015-10-13 13:19:44 -03:00
Lorenzo Stoakes
7866d7a9f7
Use API endpoint var as heartbeat endpoint.
2015-10-13 13:19:44 -03:00
Lorenzo Stoakes
77f5c776f5
Allow configuration of heartbeat endpoint via env var.
2015-10-13 13:19:44 -03:00
Lorenzo Stoakes
8ce9c2448f
Spread is neater.
2015-10-13 13:19:44 -03:00
Lorenzo Stoakes
aa4ff76581
Avoid ICMP on connectivity check.
2015-10-13 13:19:44 -03:00
Petros Angelatos
d054ca7023
Use host networking for user containers
2015-10-13 13:19:44 -03:00
Aleksis Brezas
ff12b4b736
comment explaining why we dont throw on supervisor update
2015-10-13 13:19:44 -03:00
Aleksis Brezas
5a9f5bebc6
increase supervisor update timeout to 1 minute
2015-10-13 13:19:44 -03:00
Aleksis Brezas
81fbbab362
remove unnecessary catch
2015-10-13 13:19:44 -03:00
Aleksis Brezas
e65a0b9c66
do not throw update errors
2015-10-13 13:19:43 -03:00
Pagan Gazzard
58cbb3808e
Log the stack trace as well when catching an unhandled error.
2015-10-13 13:18:12 -03:00
Pagan Gazzard
4f431d36ed
Fix binding a folder using the wrong id.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
2746d875f7
Fix "undefined is not a function" error due to not passing a callback to container.stop
2015-10-13 13:10:12 -03:00
Pagan Gazzard
4734f8e834
Remove duplicate require.
2015-10-13 13:10:12 -03:00
Eugene Mirotin
31a48c75f5
pass the error message in despawn as well
2015-10-13 13:10:12 -03:00
Eugene Mirotin
378913862f
pass the proper error message
2015-10-13 13:10:12 -03:00
Lorenzo Stoakes
3810a394c9
Up max comment length to 120 chars.
2015-10-13 13:10:12 -03:00
Lorenzo Stoakes
f39b51885d
Syntax cleanup pass.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
70eef70be2
Log an error if failing to stop a tty session
2015-10-13 13:10:12 -03:00
Pagan Gazzard
a9672bd5af
Make sure that the command socket exists and is a socket.
...
This handles the case of running an updated supervisor on an old image which doesn't support host commands - printing out a nice message and waiting rather than exiting silently.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
33441c74e7
Silence the setting up of the socket.
...
This was appearing whenever you started a new tty.js terminal - leaking stuff that shouldn't really be.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
c1b1aba985
Make sure to stop any spawned tty sessions on container stop.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
ad107b30ae
Enable destroying a tty.js tunnel.
2015-10-13 13:10:12 -03:00
Pagan Gazzard
1b0e364322
Enable spawning a tty.js tunnel.
2015-10-13 13:10:12 -03:00
Aleksis Brezas
aab2a3b3d3
missing require
2015-10-13 13:10:12 -03:00
Aleksis Brezas
839b6ec7ca
get full container id from /proc/1/cgroup
2015-10-13 13:10:12 -03:00
Aleksis Brezas
69e2af5aa1
wait for an ok from next supervisor before exit
2015-10-13 13:10:11 -03:00
Praneeth Bodduluri
b790e4e304
Blink interval of 200ms was too slow to be seen - reverting to 400ms used in api.coffee
2015-10-13 13:10:11 -03:00
Petros Angelatos
a10f118ab9
Use the registry endpoint from config, not environment
2015-10-13 13:10:11 -03:00
Pagan Gazzard
3c5e856ef2
Mount a /data directory for containers, to allow persistent storage.
2015-10-13 13:10:11 -03:00
Pagan Gazzard
a9fe6f3414
Update the app info the moment we create the container, even if then starting the container fails.
...
This stops issues with constantly creating new containers for an image that fails to start.
2015-10-13 13:10:11 -03:00
Praneeth Bodduluri
e7216618ad
Make Blinkable LED configurable + Move blink to utils + Check connectivity before bootstrap + Blink LED on loss of connection
2015-10-13 13:10:11 -03:00
Pagan Gazzard
3975939181
Cleanup unneeded images after a successful update.
2015-10-13 13:10:11 -03:00
Pagan Gazzard
4cc3092b73
Remove /dev mount, privileged flag does it by default.
2015-10-13 13:10:11 -03:00
Pagan Gazzard
d07c6abe99
Store and make use of container ids.
...
This stores the container id for an app when creating that app, using it when it is necessary to stop/remove the app and when attempting to start it again (rather than creating a new container each time, eg restarting the pi does not create a new container any more)
2015-10-13 13:10:11 -03:00
Pagan Gazzard
51bfb69354
Treat the bluebird OperationalError wrapper correctly.
2015-10-13 13:10:11 -03:00
Pagan Gazzard
0fae904f1c
Make sure to use string comparisons for the status code, to avoid issues where the types are different.
2015-10-13 13:10:10 -03:00
Praneeth Bodduluri
7aa66b5cb6
x86 support + Change localImage variable to SUPERVISOR_IMAGE
2015-10-13 13:09:58 -03:00
Pagan Gazzard
e64e6e6dbe
Handle trying to remove already stopped/removed containers gracefully.
2015-10-13 13:08:24 -03:00
Pagan Gazzard
7072b1df96
On update failure schedule another attempt briefly in the future.
2015-10-13 13:08:24 -03:00
Praneeth Bodduluri
0f23ddded8
Change the data mount point to /resin-data
2015-10-13 13:08:23 -03:00
Petros Angelatos
d511d9df94
Set the 'RESIN' env var in user applications
2015-10-13 13:08:23 -03:00
Pagan Gazzard
5bd4ee7ee6
Fix event-stream usage.
2015-10-13 13:08:23 -03:00
Pagan Gazzard
f317927284
Move the restart check to the earliest possible stage, such that the only mount that we actually need in order to bootstrap the the docker.sock mounting.
2015-10-13 13:08:23 -03:00
Pagan Gazzard
2c11b34bdf
Have the supervisor update if it finds itself missing Volumes/Binds it expects to have (or has additional that it does not expect).
...
Conflicts:
src/config.coffee
src/supervisor-update.coffee
2015-10-13 13:08:23 -03:00
Pagan Gazzard
b7149bb266
Report the commit to the API as soon as the container is started.
2015-10-13 13:08:23 -03:00
Pagan Gazzard
3ef5a86344
Report the device status to the API
2015-10-13 13:08:23 -03:00
Pagan Gazzard
c436d8d5c0
Set default values for the config vars, which will be used in the case of an env var not being set, and copy all existing env vars in the case of an update.
2015-10-13 13:08:07 -03:00
Pagan Gazzard
c03a51d404
Make sure the fib_trie mount is propogated on an update.
2015-10-13 13:06:43 -03:00
Pagan Gazzard
a47022a0b4
Report the host ip address to the API on startup and every 5mins after.
2015-10-13 13:06:43 -03:00
Pagan Gazzard
6fb20a5dc5
Add support for exposing multiple ports.
2015-10-13 13:06:42 -03:00
Petros Angelatos
3ae3668221
Test for both 'id' and 'Id' when docker responds with image info
2015-10-13 13:06:42 -03:00
Pagan Gazzard
58035f8b24
Switch from "id" to "Id" to match a docker change..
2015-10-13 13:06:42 -03:00
Pagan Gazzard
597fefcb33
Fix reference error.
2015-10-13 13:06:42 -03:00
Pagan Gazzard
148d067ab9
Add a log entry that we're exiting on a supervisor update.
2015-10-13 13:06:42 -03:00
Petros Angelatos
3e1dd1f922
Log every mixpanel event and remove redundant logs
2015-10-13 13:06:42 -03:00
Petros Angelatos
d00372b5d2
Move mixpanel calls inside corresponding methods
2015-10-13 13:06:42 -03:00
Petros Angelatos
d06b5117f0
Keep method of loading JSON files consistent
2015-10-13 13:06:42 -03:00
Petros Angelatos
7b483e983d
Fix bug of using mixpanel module as the mixpanel client
2015-10-13 13:06:42 -03:00
Petros Angelatos
e622491f37
Add mixpanel events to the update process
2015-10-13 13:06:42 -03:00
Petros Angelatos
1501cf3122
Integrate mixpanel
2015-10-13 13:06:42 -03:00
Petros Angelatos
0772638d92
Supply USER environment variable to containers
2015-10-13 13:06:42 -03:00
Petros Angelatos
a5fa371f22
Bind mount /lib/modules to enable module loading from inside the container
2015-10-13 13:06:42 -03:00
Page
4cfcd39524
Enable periodic update checks, and add logic to only switch to the new image if it is different.
2015-10-13 13:06:42 -03:00
Page
0d2d372cb9
Share the docker socket via config.
2015-10-13 13:06:42 -03:00
Page
959da25c9f
Add all expected env vars to the new supervisor container.
2015-10-13 13:06:41 -03:00
Page
f78786b065
Rename the images more appropriately.
2015-10-13 13:06:41 -03:00
Page
599f8ae503
Remove trailing commas.
2015-10-13 13:06:41 -03:00
Page
96d1e48edd
Use a promise constructor so we can make the code a bit cleaner.
2015-10-13 13:06:41 -03:00
Page
a0f9219cb3
Initial version of self-updates, adds an "/v1/update-supervisor" endpoint that can be posted to in order to trigger a supervisor update, which it then fetches as the resin/rpi-supervisor repo of the registry endpoint.
2015-10-13 13:06:41 -03:00
Petros Angelatos
d47ba654b7
Pass the device uuid as an env var
2015-10-13 13:06:41 -03:00
Petros Angelatos
04ca3b3042
Clarify publish function definition
2015-10-13 13:06:41 -03:00
Petros Angelatos
7e5fe4802f
Don't filter out ANSI colours
2015-10-13 13:06:41 -03:00
Petros Angelatos
29f5c9b7e0
Use promise API
2015-10-13 13:06:41 -03:00
Petros Angelatos
604a05a21a
Style fixes
2015-10-13 13:06:41 -03:00
Petros Angelatos
94eeaaa510
Resolve variable collision
2015-10-13 13:06:41 -03:00
Petros Angelatos
39261f5d6b
Enclose publish queuing vars in their own closure
2015-10-13 13:06:41 -03:00
Petros Angelatos
7c33f28724
Queue publish calls while getting uuid from db
2015-10-13 13:06:41 -03:00
Petros Angelatos
ca736233e7
Move all configuration variables to a separate file
2015-10-13 13:06:39 -03:00
Petros Angelatos
5caace400f
Send logs through pubnub
2015-10-13 13:04:25 -03:00
Page
ff7d6c1f8a
Add missing paren.
2015-10-13 13:03:16 -03:00
Page
b3f9f9b1ef
Switch to using the Promise constructor rather than deferred, it allows for slightly nicer code. Also add some parens in appropriate places.
2015-10-13 13:03:16 -03:00
Page
4d5c18ec6f
Fetch the image using dockerode.
2015-10-13 13:03:16 -03:00
Page
7daebaf85e
Fix check if we already have the image.
2015-10-13 13:03:16 -03:00
Page
f47e7fbf2b
We have to manually stringify/parse the JSON column for knex - fixes containers restarting every 6 minutes.
2015-10-13 13:03:16 -03:00
Petros Angelatos
e9cbeea11e
Docker expects the port to be a string
2015-10-13 13:03:16 -03:00
Petros Angelatos
3c4318893a
Remove unused version
variable
2015-10-13 13:03:16 -03:00
Petros Angelatos
98870dcd16
Generate random UUID
...
Generate a random UUID when the device bootstraps instead of
deterministically calculating one from the CPU serial number. This means
that a specific device can be used with many applications and users
without problem.
2015-10-13 13:03:16 -03:00
Petros Angelatos
2b054123fe
Remove unused crypto module
2015-10-13 13:03:16 -03:00
Petros Angelatos
387ac995a4
Remove unmatched )
2015-10-13 13:03:16 -03:00
Page
ab642470ec
Make sure the PORT env var is a valid port number before trying to bind it.
2015-10-13 13:03:16 -03:00
Page
9ca8077daa
Use the PORT environment variable to choose what port to expose.
...
Conflicts:
src/application.coffee
2015-10-13 13:03:16 -03:00
Page
99849ad84c
Publish tcp ports 80 and 443 of the container.
...
Conflicts:
src/application.coffee
Conflicts:
src/application.coffee
2015-10-13 13:03:16 -03:00
Page
38481f524d
Make sure all apps are removed before adding new/updating existing, this is to make sure any ports they use have been freed in case they're needed by the new/updated apps.
...
Conflicts:
src/application.coffee
2015-10-13 13:03:15 -03:00
Page
97d2771826
Change automatic update check to every 5 mins instead of 15.
2015-10-13 13:03:15 -03:00
Vasilis Souleles
502fa105b1
removed unnecessary changes part 2
2015-10-13 13:03:15 -03:00
Vasilis Souleles
34cbb1e699
removed unnecessary changes
2015-10-13 13:03:15 -03:00
Vasilis Souleles
e0aa5e3929
fixed dumb bug
2015-10-13 13:03:15 -03:00
Vasilis Souleles
9a87a8fbf5
fixed tabs over spaces
2015-10-13 13:03:15 -03:00
Vasilis Souleles
1c3e173bd3
added resin-supervisor version as a field of config object. added some notes on posting version using resinAPI
2015-10-13 13:03:15 -03:00
Page
5e620cbf03
Fix typo.
2015-10-13 13:03:15 -03:00
Page
5d89b74bab
Use __dirname to make sure the relative path is relative to where we expect.
2015-10-13 13:03:15 -03:00
Page
791cbda490
Fix typo.
2015-10-13 13:03:15 -03:00
Page
06ef69f87e
Only allow one update to be occurring at a time, and if another is triggered whilst one is in progress then simply schedule it for after the current one finishes.
2015-10-13 13:03:15 -03:00
Page
9c9288e179
Move the REGISTRY_ENDPOINT into an env var.
2015-10-13 13:03:15 -03:00
Page
b4756db23b
The apps to update are the ones that aren't equal!
2015-10-13 13:03:15 -03:00
Page
1b74e0cca5
Pass the env vars in the way docker expects.
2015-10-13 13:03:15 -03:00
Vasilis Souleles
a51a648267
read utf-8 data. fixed Promises bug
2015-10-13 13:03:15 -03:00
Vasilis Souleles
10451fd27d
added getSupevisorVersion
2015-10-13 13:03:15 -03:00
Page
b435116207
env is a property, not a var of its own.
2015-10-13 13:03:15 -03:00
Petros Angelatos
1b0a27f19d
Remove assumption of supervisor path
2015-10-13 13:01:25 -03:00
Petros Angelatos
c7ce76c436
Use /data instead of /supervisor/data
2015-10-13 13:01:25 -03:00
Petros Angelatos
1654e26245
Drop legacy parameter used in Procfiles
2015-10-13 13:01:25 -03:00
Page
16fb88fab0
We can now use coffee-script for the main file, since it will be compiled before being run anyway.
2015-10-13 13:01:25 -03:00
Page
1c209fa827
Compile all the coffee-script files once after installing, rather than on each run.
2015-10-13 13:01:25 -03:00
Page
7e25bfe91a
Expose the docker socket of master that we would need to launch a new resin-supervisor container.
2015-10-13 13:01:25 -03:00
Page
e336eaad6e
Increase the blink duration to 15s
2015-10-13 13:01:25 -03:00
Page
b47e8a18dd
Get the app object from the local apps - that's the only place it exists!
2015-10-13 13:01:24 -03:00
Page
5482b9208d
Properly stop and remove containers.
2015-10-13 12:58:58 -03:00
Page
238768e7d4
Add support for environment variables.
...
Conflicts:
src/application.coffee
Conflicts:
src/application.coffee
2015-10-13 12:58:58 -03:00
Page
4157ab036c
Extract out the docker socket and registry endpoint to constants, so they are easier to change/update.
2015-10-13 12:58:58 -03:00
Page
bc0d981610
Use an app object throughout, rather than relying upon just the imageId, this is very useful for adding extra properties to the app when starting/etc (eg env vars/ports/etc)
2015-10-13 12:58:58 -03:00
Page
4d4b633fde
Improve feedback for starting an app
2015-10-13 12:58:58 -03:00
Page
eaa16ccd31
Separate the url resolve onto a new line.
2015-10-13 12:58:58 -03:00
Page
a5aaee107d
Use the resin-platform-api to access the platform.
2015-10-13 12:58:57 -03:00
Page
c8d8ca9736
Use /run/docker.sock for docker, since it will work when run on a host (and can now be used in a container to access the host docker as well)
2015-10-13 12:58:57 -03:00
Page
c229e8fd49
If bootstrapping fails, then actually fail, rather than covering up the error (the error will still get logged by bluebird if the promise rejection isn't handled - but the returned promise will actually be rejected now)
2015-10-13 12:58:57 -03:00
Page
795b8b4299
And actually remove the now-unused delay function.
2015-10-13 12:58:57 -03:00
Page
2d6f0a7e6d
Update bluebird and use the delay helper.
2015-10-13 12:58:57 -03:00
Page
b65e3fd3f9
Remove some more unnecessary parens.
2015-10-13 12:58:57 -03:00
Page
e8e6490dd2
Update to coffee-script 1.7.1
2015-10-13 12:58:57 -03:00
Page
37212cedbe
Remove a load of unnecessary parens.
2015-10-13 12:58:57 -03:00
Page
3c3e81a892
Install apps in parallel to deleting them - also fixes SQL errors when there are no apps to install.
2015-10-13 12:58:57 -03:00
Petros Aggelatos
87534cb15e
Expose the whole /dev directory in the container
2015-10-13 12:58:57 -03:00
Petros Aggelatos
31a9632fe3
Bug fix. Needed to declade a volume to use bind mounts
2015-10-13 12:58:57 -03:00
Petros Aggelatos
0e360b56ac
Bind mount /dev/snd so that containers can play sound
2015-10-13 12:58:57 -03:00
Petros Aggelatos
c0bfbc582d
Print helpful message instead of caught error
2015-10-13 12:58:57 -03:00
Petros Aggelatos
3aed83fe04
Removed unsed variables
2015-10-13 12:58:57 -03:00
Petros Aggelatos
94395c7e12
Bugfix. .then() expects a function
2015-10-13 12:58:56 -03:00
Petros Aggelatos
117251bbc1
Only start an application when there is a commit
2015-10-13 12:58:56 -03:00
Petros Aggelatos
57e8b10928
Make all applications privileged
2015-10-13 12:58:56 -03:00
Petros Aggelatos
cec5347c6c
Print the application Id
2015-10-13 12:58:56 -03:00
Petros Aggelatos
637d68921f
Application management code in its own module
2015-10-13 12:58:56 -03:00
Petros Aggelatos
614b24c796
Fix output format of VPN logs
2015-10-13 12:58:56 -03:00
Petros Aggelatos
12b3e194b5
Run application when supervisor starts
2015-10-13 12:58:56 -03:00
Petros Aggelatos
563df5386d
On update get application info from the API
2015-10-13 12:58:56 -03:00
Petros Aggelatos
f10fb532c6
Use versioned API endpoints
2015-10-13 12:58:56 -03:00
Petros Aggelatos
91b59abd42
Save parameters in SQLite on successful bootstrapping
2015-10-13 12:58:56 -03:00
Petros Aggelatos
1dc26396a2
Elegant require calls
2015-10-13 12:58:56 -03:00
Petros Aggelatos
469777c232
Don't crash on uncaught exceptions
2015-10-13 12:58:56 -03:00
Petros Aggelatos
dc3708d14f
Wait for db initialisation before starting app
2015-10-13 12:58:56 -03:00
Petros Aggelatos
e5684a1c3a
Promisify blink
2015-10-13 12:58:56 -03:00
Petros Aggelatos
a8846b37b6
Minor log change
2015-10-13 12:58:56 -03:00
Petros Aggelatos
ef970712a8
Table config should have key
as primary key
2015-10-13 12:58:56 -03:00
Petros Aggelatos
c98a274bde
Fixed syntax errors
2015-10-13 12:58:55 -03:00
Petros Aggelatos
48c5766f3d
Cleanup unneeded files
2015-10-13 12:58:55 -03:00
Petros Aggelatos
309da94028
OCD
2015-10-13 12:58:55 -03:00
Petros Aggelatos
de342a9209
Revamp/rewrite of supervisor as a docker application
2015-10-13 12:58:55 -03:00