Purpose of settings.json in iocage plugins?

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
Hello there...

I'm playing around with iocage plugins, and have it mostly working. However, I can't figure out how settings.json is used? I see no options reflecting the file being presented to the user. I have installed installed official plugin readmine, but the parameters in its settings.json are not beeing presented during the install. I was expecting settings.json to create a GUI for manipulation the software runing in the jail.

So, how is settings.json supposed to work?

Thanks,
Tobias
 
Joined
Jul 10, 2016
Messages
521
Hi Tobias,
The main purpose of these is indeed to expose some of the jail's settings to the UI. The old warden-based jails offered a pop-up somewhere in the left tool bar for this purpose, but this functionality is not yet complete in the new UI.
This is tracked in this feature request: https://redmine.ixsystems.com/issues/51180

Depending on what version of iocage (dictated by the FreeNAS version) you're running, this is already mostly supported from the CLI using the commands e.g. iocage get -P <option> <jail> and iocage set -P <option=value> <jail>

These commands are simply transformed to they will call the corresponding serviceget and serviceset shell scripts, e.g. /usr/local/bin/mineosset option value. It's really up to the plugin developer what to do with them.

A working example is the experimental branch of the mineos plugin that allows one to change the port and the scheme of the admin url. In this case, the set/get scripts will resp. change/read the configuration file.
 

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
The main purpose of these is indeed to expose some of the jail's settings to the UI. The old warden-based jails offered a pop-up somewhere in the left tool bar for this purpose, but this functionality is not yet complete in the new UI.

Ah... That explains it. A rather severe regression IMHO.

Depending on what version of iocage (dictated by the FreeNAS version) you're running, this is already mostly supported from the CLI using the commands e.g. iocage get -P <option> <jail> and iocage set -P <option=value> <jail>

Great,then I can test my options to make sure they work.

A working example is the experimental branch of the mineos plugin that allows one to change the port and the scheme of the admin url. In this case, the set/get scripts will resp. change/read the configuration file.

Is there no documentation of the syntax/options in settings.json? I see a lot of different options being used when looking at different examples in the FreeNAS repository.
 

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
A working example is the experimental branch of the mineos plugin that allows one to change the port and the scheme of the admin url. In this case, the set/get scripts will resp. change/read the configuration file.

Loooking at the settings.json in the mineos repo, values have a default. Does that mean that /usr/local/bin/mineosset will be called to set the values to their defaults when installing the plugin?

Code:
{
    "servicerestart":"service mineos restart",
    "serviceget": "/usr/local/bin/mineosget",
    "serviceset": "/usr/local/bin/mineosset",
    "options":
    {
        "port": {
            "type": "int",
            "name": "WebUI Port",
            "description": "Port for MineOS web admin portal",
            "range": "1024-32000",
            "default": "8443",
            "requirerestart": true
        },
        "sslmode": {
            "type": "bool",
            "name": "Use SSL",
            "description": "Use HTTPS to connect to web admin portal",
            "default": false,
            "requirerestart": true
        }
    }
}
 

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
Depending on what version of iocage (dictated by the FreeNAS version) you're running, this is already mostly supported from the CLI using the commands e.g. iocage get -P <option> <jail> and iocage set -P <option=value> <jail>

I'd like to create a "hook" to add users to a service in my jail. How would i parse to related parameters? Maybe something like this?

iocage set -P adduser.name=thename -P adduser.passwd=thepass <jail>

But, I want both parameters, in the example above, one could be left out. Any suggestions? How would somethink like that be represented in settings.json?

Thanks,
Tobias
 
Joined
Jul 10, 2016
Messages
521
Have you seen the example/template below that seems to implement an "adduser" command?
https://github.com/freenas/iocage-ix-plugins/tree/master/template

In that example, the quasselset script takes two arguments for the adduser subcommand. For that reason, I expect the iocage CLI command to look like this: iocage set -P adduser=thename,thepass <jail>

That being said, until this is fully implemented, the current examples are likely more a guideline subject to change than the official technical documentation. :)
 

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
In that example, the quasselset script takes two arguments for the adduser subcommand. For that reason, I expect the iocage CLI command to look like this: iocage set -P adduser=thename,thepass <jail>

Works great in my plugin. The only thing I have updated, is the set command in the jail. The field definitions in settings.json makes no difference it seems. Maybe they are only for the missing FreeNAS GUI?
 
Joined
Jul 10, 2016
Messages
521
Works great in my plugin. The only thing I have updated, is the set command in the jail. The field definitions in settings.json makes no difference it seems. Maybe they are only for the missing FreeNAS GUI?

Nice to hear you're making progress! :smile:
When I browsed the iocage code, the only attributes that seem to be handled are requirerestart and readonly. I suspect the other ones are intended to drive the labels and menus once that gets implemented.
 

tobiasbp

Patron
Joined
Dec 2, 2015
Messages
238
Nice to hear you're making progress! :)
When I browsed the iocage code, the only attributes that seem to be handled are requirerestart and readonly. I suspect the other ones are intended to drive the labels and menus once that gets implemented.

You make it sound a bit like iocage is a project from IX Systems. Is it? Or, is it more like IX Systems are extending the JSON manifest (Where is the definition of it?) in iocage for the purpose if linking iocage with/to the FreeNAS GUI?
 
Joined
Jul 10, 2016
Messages
521
The iocage project is sponsored by iXsystems. It was rewritten in Python to allow for a better integration with FreeNAS.
Here is some background.

Of course, since both iocage and FreeNAS are Open Source projects, everybody can contribute.
 
Top