upgrade config migration of snaps

Oliver Grawert ogra at ubuntu.com
Mon Feb 2 10:29:06 UTC 2015


i have an app that ships with a cfg file the user can edit via a web
interface ... the cfg file needs some paths set to point to log dirs,
plugin dirs etc.

unlike the install dir the writable dir in /var/lib/apps/<app>/ is
versioned ...

if i want to run my app from the install dir in /apps/<app>/ i need to
use absolute paths in the config which means the config  ends up with
something like:


now, on upgrades this whole writable dir gets copied forward to the new
versioned dir, which means my config points to the wrong working dir.

the app flushes the environment on startup so i can not use environment
variables inside the config to override that path either. 

i currently see two options here ... 

- either copy the whole install into the working dir and cd into it from
a shell wrapper before starting the service that way i could use
relative paths in the config. 

- parse the config on every startup from a wrapper, match against
$SNAPP_APP_DATA_PATH and sed it ... 

both solutions seem pretty suboptimal to me and i imagine my  snap wont
be the only one hitting such an issue. do we have any planning in the
pipe (or even some magic implementation that i haven't found documented)
to solve this issue ?  


More information about the snappy-devel mailing list