Merge pull request #320 from resin-io/255-aufs-support

AUFS support and dependent app assets improvement
This commit is contained in:
Pablo Carranza Vélez 2016-10-21 18:37:01 -03:00 committed by GitHub
commit d505a5f3cc
4 changed files with 11 additions and 14 deletions

View File

@ -1,3 +1,5 @@
* Use appId in dependent app assets tar path, and only create the tar if it doesn't exist [Pablo]
* Support AUFS by upgrading node-docker-delta to 1.0.0 and docker-toolbelt to 1.3.0 [Pablo]
* Send the uuid as distinct_id for mixpanel events [Pablo]
* gosuper: support i386 platforms without MMX instructions [petrosagg]

View File

@ -12,9 +12,9 @@
"bluebird": "^3.0.0",
"body-parser": "^1.12.0",
"buffer-equal-constant-time": "^1.0.1",
"docker-delta": "0.0.12",
"docker-delta": "1.0.0",
"docker-progress": "^2.1.0",
"docker-toolbelt": "^1.2.0",
"docker-toolbelt": "^1.3.0",
"dockerode": "~2.2.9",
"event-stream": "^3.0.20",
"express": "^4.0.0",

View File

@ -202,8 +202,7 @@ fetch = (app, setDeviceUpdateState = true) ->
throw err
shouldMountKmod = (image) ->
docker.imageRootDir(image)
.then (rootDir) ->
Promise.using docker.imageRootDirMounted(image), (rootDir) ->
utils.getOSVersion(rootDir + '/etc/os-release')
.then (version) ->
return version? and (version.match(/^Debian/i) or version.match(/^Raspbian/i))

View File

@ -18,11 +18,6 @@ url = require 'url'
pubnub = PUBNUB.init(appConfig.pubnub)
getAssetsPath = (image) ->
docker.imageRootDir(image)
.then (rootDir) ->
return rootDir + '/assets'
isDefined = _.negate(_.isUndefined)
exports.router = router = express.Router()
@ -182,17 +177,18 @@ router.put '/v1/devices/:uuid', (req, res) ->
console.error("Error on #{req.method} #{url.parse(req.url).pathname}", err, err.stack)
res.status(503).send(err?.message or err or 'Unknown error')
tarPath = ({ commit }) ->
return '/tmp/' + commit + '.tar'
tarPath = ({ appId, commit }) ->
return '/tmp/' + appId + '-' + commit + '.tar'
router.get '/v1/dependent-apps/:appId/assets/:commit', (req, res) ->
knex('dependentApp').select().where(_.pick(req.params, 'appId', 'commit'))
.then ([ app ]) ->
return res.status(404).send('Not found') if !app
dest = tarPath(app)
getAssetsPath(app.imageId)
.then (path) ->
getTarArchive(path, dest)
fs.lstatAsync(dest)
.catch ->
Promise.using docker.imageRootDirMounted(app.imageId), (rootDir) ->
getTarArchive(rootDir + '/assets', dest)
.then ->
res.sendFile(dest)
.catch (err) ->