 			else
 				knex('app').insert(app)
 		.tap (container) ->
-			console.log('Starting container:', app.imageId)
+			utils.mixpanelTrack('Application start', app)
+			logSystemEvent('Starting application ' + app.imageId)
+			updateDeviceInfo(status: 'Starting')
 			ports = {}
 			if portList?
 				portList.forEach (port) ->

	maybePort = parseInt(port, 10)
	return parseFloat(port) is maybePort and maybePort > 0 and maybePort < 65535

exports.start = start = (app) ->
	Promise.try ->
		# Parse the env vars before trying to access them, that's because they have to be stringified for knex..


		# If there is no existing container then create one instead.
		containerPromise.catch ->
			fetch(app)
			.then (imageInfo) ->
				utils.mixpanelTrack('Application install', app)
				logSystemEvent('Installing application ' + app.imageId)
				updateDeviceInfo(status: 'Installing')

				ports = {}
				if portList?
					portList.forEach (port) ->
