Make the data path configurable

This commit is contained in:
Pablo Carranza Velez 2016-06-14 13:50:50 -03:00
parent d88e7d7d36
commit 164d565283
4 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,5 @@
* Make the data path configurable [Pablo]
# v1.11.3
* Add listener for container events and reattach on restart [Pablo]

View File

@ -67,6 +67,9 @@ func main() {
// Start OOMProtectionTimer for protecting Openvpn/Connman
dockerSocket := os.Getenv("DOCKER_SOCKET")
hostproc := os.Getenv("HOST_PROC")
if dataPathEnv := os.Getenv("RESIN_DATA_PATH"); dataPathEnv != "" {
ResinDataPath = "/mnt/root" + dataPathEnv
}
defer startOOMProtectionTimer(hostproc, dockerSocket).Stop()
listenAddress := os.Getenv("GOSUPER_SOCKET")

View File

@ -174,7 +174,7 @@ application.start = start = (app) ->
'/host/var/lib/connman': {}
'/host/run/dbus': {}
binds = [
'/resin-data/' + app.appId + ':/data'
config.dataPath + '/' + app.appId + ':/data'
'/lib/modules:/lib/modules'
'/lib/firmware:/lib/firmware'
'/run/dbus:/run/dbus'
@ -305,11 +305,11 @@ getEnvironment = do ->
lockPath = (app) ->
appId = app.appId ? app
return "/mnt/root/resin-data/#{appId}/resin-updates.lock"
return "/mnt/root#{config.dataPath}/#{appId}/resin-updates.lock"
killmePath = (app) ->
appId = app.appId ? app
return "/mnt/root/resin-data/#{appId}/resin-kill-me"
return "/mnt/root#{config.dataPath}/#{appId}/resin-kill-me"
# At boot, all apps should be unlocked *before* start to prevent a deadlock
application.unlockAndStart = unlockAndStart = (app) ->

View File

@ -48,3 +48,4 @@ module.exports = config =
'RESIN_SUPERVISOR_API_KEY'
'RESIN_API_KEY'
]
dataPath: checkString(process.env.RESIN_DATA_PATH) ? "/resin-data"