cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2257
Views
5
Helpful
4
Replies

IOx and the /data partition

silla
Level 1
Level 1

Hello,

is there a way to pre-populate the /data partition with files while building the app bundle? I'd like to put a configuration file there or client certificates to authenticate and/or authorize the app with a remote server and be able to modify them without re-deploying the whole app.

 

Thanks!

 

Silla Rizzoli

4 Replies 4

Emmanuel Tychon
Cisco Employee
Cisco Employee

 

The directory defined by the environement variable ${CAF_APP_APPDATA_DIR} can be used to upload and download files with the IOx application. This is typically used to configuration files and certificates which I believe is also your question.

 

https://developer.cisco.com/docs/iox/#!application-development-concepts/application-development-concepts

 

You can upload (or download - for example to backup) files to/from this directory using Cisco IOx Local Manager or the ioxclient utility. This space also persists when you upgrade the IOx application.

Hello,
Thanks for your answer, but that wasn't my question; the /data partition becomes available to the app after starting the app itself. I want to be able to put files in there while building the container, BEFORE deployment to the router/switch/whatever, if at all possible.

Thanks
Silla Rizzoli

Hello Silla - 

 

You are right that "/data" is a Docker volume that becomes active only after the application activation. Therefore writing to that volume before deployment or activation is not an option. I see at least two ways you can address your problem as I understand it:

 

a) You can store your files as part of your application, and when your app starts a script will check if "/data" has been populated yet with those files. If not, copy the files from your IOx application to /data. If yes, continue.

 

b) In IOx there is a concept of bootstrapping: those are variables that can be passed to the application before it is running. They are part of your main IOx application in a file called 'package_config.ini' and those variables can be changed at activation time. This is an ideal place for the hostname of an MQTT server, admin password and so on. Check here for an example: https://github.com/etychon/iox-dumpenvvariables-aarch64

 

Emmanuel

 

Hello @Emmanuel Tychon,

thank you for your answer, helpful as always.

I'll explore the two options you described.

 

By the way, I'm playing with a IR1101 IOS-XE version 17.02.01, which has some support for docker, and I managed to run node-red for aarch64 unmodified on it (this image, to be precise - https://hub.docker.com/layers/nodered/node-red/latest/images/sha256-069bf5081169ca9806c9bf96a84e3998907ea8e331c844e6486f016e432a2c5b?context=explore), using the following "docker run" command line switches (--user node-red:node-red --expose 1880 --workdir /usr/src/node-red). I opted not to delete the container every time and when I restart it I know that my work has been saved on /data, because my flows are still there and node-red is configured to save them on /data (ENTRYPOINT ["npm" "start" "--cache" "/data/.npm" "--" "--userDir" "/data"] - I specified the same entrypoint on package.yaml too); however, I cannot see any files on /data when I browse it using the https interface.

Maybe it has something to do with the fact that /data is specified as a separate volume in the docker image; do you have any docs on how exactly docker and IOx interact?

 

Thanks again!

 

Best regards

Silla Rizzoli