Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » configure kura from the command line(what is the best way to set default configuration settings (such as mqtt host etc) before first startup of kura?)
configure kura from the command line [message #1733995] Thu, 02 June 2016 17:56 Go to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
I can't think of a more trusted source than the OS of the box running kura - yet I can't seem to find how to interact with kura's configuration via the command line.

Is it possible to set configuration items such as those exposed via the web ui from the command line?
Re: configure kura from the command line [message #1734012 is a reply to message #1733995] Fri, 03 June 2016 02:13 Go to previous messageGo to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
is it possible via the osgi console?
Re: configure kura from the command line [message #1734017 is a reply to message #1734012] Fri, 03 June 2016 06:02 Go to previous messageGo to next message
Shiao Jon is currently offline Shiao JonFriend
Messages: 13
Registered: May 2016
Junior Member
Try to put configuration in your Kura source then rebuild Kura's deb file.
Re: configure kura from the command line [message #1734029 is a reply to message #1734017] Fri, 03 June 2016 07:57 Go to previous messageGo to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
Shiao Jon,

That doesn't sound very user friendly - Kura at this point is unpacked and ready to run. We would like to apply some default configuration to configurable components without much complication.

Regards, Paul.
Re: configure kura from the command line [message #1734087 is a reply to message #1734029] Fri, 03 June 2016 16:12 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hi Paul,

Several things to consider:

1. The configuration for all the service components within Kura are managed in snapshot files (/opt/eclipse/kura/data/snapshots/). These are XML files that contain the properties for each component. You could manually edit the last of these files (ordered by timestamp) and restart Kura. Obviously this requires a restart.

2. Use the OSGi console. This would require extending the console (i.e. implementing the CommandProvider), but is not difficult to do. You could create your own commands to control the elements of Kura that you need. An example of this is in our LoggerCommandProvider [1].

3. Add an API layer. This is not built into Kura (though we are considering it), but again, it is not too difficult. You would need to add JAX-RS to the platform, then write your own API endpoints. Then you could use any tool that supports REST to communicate with Kura (i.e. Node.js).

Let me know if you need more information on any of these options.

[1] https://github.com/eclipse/kura/tree/develop/kura/org.eclipse.kura.core.log

Thanks,
--Dave
Re: configure kura from the command line [message #1734109 is a reply to message #1734087] Fri, 03 June 2016 22:42 Go to previous messageGo to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
Thanks dave, Good to know what is possible.

The first of which looks most hopeful however the xml files are encoded - looks like AES. so not so easy to do from a shell script. As an aside, why is the config encoded? So I need to decrypt this, modify and then re-encrypt using a shell equivalent of what is in "CryptoServiceImpl". Also, openssl is not available on the OS.

The second two both require installing a package in kura prior to startup, and then are only usable once kura is already running... while this is not out of the question, I'm hoping for a solution allowing us to pre-configure entirely; prior to startup.

I'm currently finishing off a hack of a solution which does just this - a new 'dp' which uses the ConfigurationService to check the system and configure if not already configured. I need to install this during the rollout, by writing to 'dpa.properties' so that it starts at first run.

[Updated on: Fri, 03 June 2016 22:42]

Report message to a moderator

Re: configure kura from the command line [message #1734111 is a reply to message #1734109] Fri, 03 June 2016 23:14 Go to previous messageGo to next message
paul stanton is currently offline paul stantonFriend
Messages: 87
Registered: July 2009
Member
david, also, is it possible to install a dp from the command line while kura is running? the only way i've found is to modify dpa.properties which seems to need a restart to take effect...... thanks.
Re: configure kura from the command line [message #1734480 is a reply to message #1734111] Wed, 08 June 2016 15:47 Go to previous message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hi Paul,

Encrypting the config file is a security mechanism. If someone gains access to your Kura system, they would not be able to modify your configuration. The key used for encryption is available in the Kura source code, but you may want to change this if you decide to go this route. Also important, the config file is encrypted after Kura starts for the first time. So, if you are looking to seed a configuration, you can modify the config file in plain text before Kura starts for the first time.

For the second option, you could add the bundles to Kura before startup. The bundles (Jar files) are located in /opt/eclipse/kura/plugins and /opt/eclipse/kura/kura/plugins. You would also need to add the new bundles to /opt/eclipse/kura/kura/config.ini. These bundles could be added via a script or through a custom build of Kura.

Currently there is not way to install a DP via the command line. I would like to add an OSGi command to allow this, but it is still on the wish list.

--Dave
Previous Topic:Support for linux arm x86_64 (RPi 2, odroid c2)
Next Topic:Implementing DataServiceListener
Goto Forum:
  


Current Time: Fri Mar 29 11:42:06 GMT 2024

Powered by FUDForum. Page generated in 0.02394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top