Commit Graph

489 Commits

Author SHA1 Message Date
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