How does the plugin system work? Documentation Added - WIP


dlandon

Recommended Posts

unRAID V6 Plugins

 

I started out asking how the plugin system works, and while implementing some plugins, I learned a lot about how it works.

 

V6b8 has brought in a totally new plugin system compared to V5 that is more flexible, easier to use, and helps sort out the "What plugins do I have installed and what versions are they?" questions.  While I don't profess to be an expert at the plugin system, I wanted to start a post to help those wanting to convert V5 plugins or author new plugins.

 

If the plugins follow the proper structure, the plugin manager (plgman) can check for the latest version, update, and remove plugins cleanly while unRAID is on-line.

 

There are some best practices to be followed with the new plgman.

  • Install plugins in the "Install Extensions" field in the "Extensions" tab.  Don't install plugins by putting then in the flash drive.  Plgman needs to manage the plugin for proper operation.  You can enter a URL or a plugin file on unRAID to install.
  • Remove plugins through the plgman webpage.
  • Use plgman to update plugins.

 

I will use the ntfs-3g plugin I wrote for V6 as an example.  It does not have a webpage in unRAID, but I'll go through what needs to be done so unRAID will understand how to use the webpage.

 

Start off in your plug in with:

 

<?xml version='1.0' standalone='yes'?>

<!DOCTYPE PLUGIN [
<!ENTITY name      "ntfs-3g">
<!ENTITY author    "dlandon">
<!ENTITY version   "2014.09.05">
<!ENTITY pluginURL "https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g-x86_64.plg">
]>

<PLUGIN  name="&name;"
         author="&author;"
         version="&version;"
         pluginURL="&pluginURL;">

 

The describes your plugin to the unRAID plgman.

  • name - this is the name of you plugin.  This name should be the sub-directory for you plugin off the /usr/local/emhttp/plugins/ directory and is where your plugin files are located.  Plgman uses the name to find your plugin, and the icon associated with the plugin.  The icon should be named 'name.png'.  Plgman uses this information to display information about your plugin.
  • author - Information field for plgman to display.
  • version - Plgman displays the version and uses this version to check for an updated version in your repository.  The convention is year.month.day.  If several releases occur in the same day, use the convention year.month.day-x, where x-=1,2,...
  • pluginURL - The is the web URL to the repository where your plugin is stored.  Plgman uses it to look for the latest version of your plugin.  It is best to use a generic name for your plugin and not have the name include a version.  The versioning is done inside the plugin.

 

<!--
2013-10-19 - first release
2014-01-24 - Modified for unRAID 6 (64 bit)

The plugin provides ntfs-3g support for unRAID systems.

-->

 

It is a good idea to include some comments or further information about the plugin.  This would be a good place for a license.

 

<FILE Name="/boot/packages/ntfs-3g-2013.1.13-x86_64-1.txz" Run="upgradepkg --install-new">
<URL>http://slackware.oregonstate.edu/slackware64-14.1/slackware64/a/ntfs-3g-2013.1.13-x86_64-1.txz</URL>
<MD5>de646f44d881b6c4292e353b717792cd</MD5>
</FILE>

 

This is the ntfs-3g package that is installed.  This could be a tar bundle that you expand into the the /usr/local/enhttp/plugins/name.  If you download a tar bundle, store a copy on the flash at /boot/config/plugins/name so it doesn't have to be downloaded each time the plugin is installed.  Packages are stored on the flash at /boot/packages.

 

<FILE Name="/boot/config/plugins/&name;/ntfs-3g.png">
<URL>https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g.png</URL>
</FILE>

 

This is the icon used for the ntfs-3g plugin.  I would recommend that you put this into the bundle for the plugin structure you download if possible.

 

<FILE Name="/usr/local/emhttp/plugins/&name;/ntfs-3g.png">
<LOCAL>/boot/config/plugins/&name;/ntfs-3g.png</LOCAL>
</FILE>

 

This does nothing more than make a copy of the stored ntfs-3fg icon on the flash drive into the plugin file structure.

 

<!--
Page file
-->
<FILE Name="/usr/local/emhttp/plugins/&name;/Apcupsd.page">
<INLINE>
<![CDATA[
Menu="OtherSettings"
Icon="apcupsd.png"
Version="2014.09.06"
Author="SeeDrs"
Title="APC UPS"
---
<?php
   php goes here.
?>
]]>
</INLINE>
</FILE>

 

Plugin Page File

 

The page file is used by emhttp to display and render your webpage.  The page file must begin with a capital letter, and your php included in the page file.  This is the page file from the Apcupsd plugin as an example.  The 'Menu' setting is important because this is the area in 'Settings' where emhttp will install the icon.

 

<!--
create plugin README.md file
-->
<FILE Name="/usr/local/emhttp/plugins/&name;/README.md">
<INLINE>
**NTFS-3G Package**

The ntfs-3g driver package is needed for writing on NTFS formated disks.  The built in NTFS driver is read only.
</INLINE>
</FILE>

 

README File

 

The READ.me is used by plgman to dispay in the plugin webage.  Use it to describe your plugin.  Again, I recommend that you put this file in your tar bundle if it is possible to save this step.

 

Remove Method

 

<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
rm /boot/packages/ntfs-3g-2013.1.13-x86_64-1.txz
removepkg &name;
rm -r /usr/local/emhttp/plugins/&name;
rm -r /boot/config/plugins/&name;
</INLINE>
</FILE>

</PLUGIN>

 

This is the remove script executed when plgman is asked to remove the plugin.  Do any package removal and clean up necessary to remove all traces of the plugin.

 

There are some cli commands that you can use for development and testing of your plugin:

  • plugin install - Install the plugin.
  • plugin delete name - This is how you remove a plugin.  The 'name' is the name of your plugin.
  • plugin update name - This will update your plugin.  If you have made changes to the plugin, this will re-install the plugin with your changes.  This is how plgman does a plugin update.  It downloads the new plugin first, then runs the update.
  • plugin check name - Check for a new version of your plugin.

 

I know this is not complete and I would like input from Tom or Jonp if there is anything I need to correct/add.  I would rather them spend time on the core functionality at this point and not spend their time on documentation.

 

UPDATE:

V6 beta11 has depricated 'category'.  It is no longer used.

 

The emhttp file structure in beta 12 has been changed.  You can no longer have a .page file with a separate .php file of the same name.  Your php is expected in the .page file.  The php is separated in the .page file with '---'.  The following is a work around to this limitation.  This is the Snap.page from the updated snap plugin.

 

Menu="OtherSettings"
Icon="snap.png"
Version="6.04"
Author="Queeg/dlandon"
Title="SNAP"

---
<?php
shell_exec('php /usr/local/emhttp/plugins/snap/Snap.php');
?>

 

Dynamix

 

V6b12 incorporated dynamix as the default webgui.  Dynamix has a process status indicator built into every plugin webpage you can use.  This is how I did it in the apcupsd plugin:

 

$sName = "apcupsd";

<script>
$(function() {
  showStatus('<?=$sName?>');
});
</script>

 

Dynamix checks for the existence of the pid file 'apcupsd.pid' and shows 'Running' if it exists, and 'Stopped' if it is not found.  You should incorporate this indicator to be consistent with other dynamix web pages.

 

This should be put at a place in your page refresh where the pid status would be valid.

 

Notifications

 

v6b12 now has an email and webgui notification system.

/usr/local/sbin/notify -e "title of the message" -s "subject of the message" -d "additional information" -i "normal"

 

The -i parameter specificies the importance level: normal, warning or alert

 

Tabbed Menu

 

Dynamix has rhe ability to use a tabbed system for plugins.  The following is from the apcupsd plugin:

Acpupsd.page

Menu="OtherSettings"
Title="APC UPS"
Type="xmenu"
Icon="apcupsd.png"
Tabs="true"
---

 

ApcupsdSettings.page

u="Apcupsd:1"
Title="UPS Settings"
---
<?PHP

 

ApcupsdStatus.page

Menu="Apcupsd:2"
Title="UPS Status"
---
<?PHP

 

Changelog

 

A changelog can be displayed after the check for updates.  Add the following to the plugin to display the changelog:

 

<CHANGES>
###2014-12-07
- Made a change
- Made another change
</CHANGES>

Link to comment
  • Replies 195
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Other big change you won't see benefit of until -beta9 (or -rc1).  If you visit Extensions/Plugins page you will see now only one 'built-in' plugin named unRAID-OS.  This will be used to update unRaid OS on your flash instead of going through the manual process of downloading zip and copying files to the flash.

 

Soon after this release we will be posting a new webGui github repo that comprises the entire thing.  More on this later...

 

This is pretty exciting stuff.  Updates will be easier and less prone to operator error.  Anything that can cut down on operator mistakes will make for a lot less support and a happier user.  Great work LT!

Link to comment

I am working on the SNAP plugin and have modified it for the V6 plugin architecture.  I put the snap-x86_64.plg in the /boot/config/plugins/ directory and installed the plugin.

 

I'm working on some documentation and guidelines for Plugin Developers which will show up in a wiki on limetech github.

 

For now: for unRaid 6, do not manually place plugin files directly into /boot/config/plugins.  The proper way to install a plugin is to do via the Extension page under Install extension.

 

  It shows up on the plugin page of unRAID.  When I try to do an update of the plugin on that page, unRAID deletes the /boot/config/plugins/snap-x86_64.plg and creates a plugssnap-x86_64.plg file in the /boot/config directory.  SNAP does not install on the next boot.  I suspect that I just don't know enough about how the plugins work.  A little guidance would be appreciated.

Please attach your plg file and let me take a look.  I added .plg in the list of attachable files for the forum.

Link to comment

I am working on the SNAP plugin and have modified it for the V6 plugin architecture.  I put the snap-x86_64.plg in the /boot/config/plugins/ directory and installed the plugin.

 

I'm working on some documentation and guidelines for Plugin Developers which will show up in a wiki on limetech github.

 

For now: for unRaid 6, do not manually place plugin files directly into /boot/config/plugins.  The proper way to install a plugin is to do via the Extension page under Install extension.

 

  It shows up on the plugin page of unRAID.  When I try to do an update of the plugin on that page, unRAID deletes the /boot/config/plugins/snap-x86_64.plg and creates a plugssnap-x86_64.plg file in the /boot/config directory.  SNAP does not install on the next boot.  I suspect that I just don't know enough about how the plugins work.  A little guidance would be appreciated.

Please attach your plg file and let me take a look.  I added .plg in the list of attachable files for the forum.

 

Attached.  I'd also like to know how to add the description to the plugins page.

ntfs-3g-x86_64.plg

Link to comment

Attached is modified plg file.  I didn't test but "should work" - definitely you'll get the idea  8)

 

For a description, you need a "README.md" file (markdown formatted file) - you'll see it in there.

 

The 'remove' script is for cleaning up in a running system.  The plugin manager (plugin script) executes the 'Remove' methods in the .plg file when someone clicks 'remove'.  It also removes the .plg file from /boot/config/plugins.  If it's too complicated to clean up after a remove you can have the 'remove' script echo "Too damn complicated, please reboot" and exit 1 (or something like that).

ntfs-3g-x86_64.plg

Link to comment

Something else that was mentioned somewhere (can't remember where), is plugin file can can contain an in-line icon formatted with base64 like this:

 

<FILE Name="<your-path>/icon.png" Type="base64">
<INLINE>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gMaFy8xxk+XdgAAB81JREFUaAXNmGmMFUUQx2dPbpdD
UERdjhiUqIgggkHDByOKKDEaIaICAREQNEKUQKJgNK4hygcjIogoCdFoQIiQKBI1cgSUQ0UWZIOu
uwE8gOUQlmth/f0f08NM22/evAcYKvlvdVdXV1d1dVfP2zzvIqPuve/rhEv3ghKwZePapYvjXMyL
G/y/x3B+NmuOstatpd+NQCoseap70QSA83Pw6AmXk76sGUEctscLbcGF6g8bW9YM21rvNPjng7cn
i4dpeLjjaL+GbJwtvyAZwNlLWegmMBQMAM2BTacQjCW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FYYIhSONDOTYmcS8
9VnMPSXnff15GebNcI2f1wBwZpl/HFQ1RoFFoMq1MDJVGT1eOjo6CfqSjaOBrsFcyqjLTkRGEKpQ
7/pIjXG85KTqf3jXU2P8SfImNDXKYX5e70DYcLZtsnCSOXEbupE70MO2e16PkG08y37cz1qZesVl
76IJgN3tg4POUon8LcaXuAK4aI6QcY6jNJH2cKBPj/1gLM5vgDvpX5JiUKYVCFvxAAAAAElFTkSu
QmCC
</INLINE>
</FILE>

 

(that's the ubuntu-xfce icon)

 

 

Link to comment

Attached is modified plg file.  I didn't test but "should work" - definitely you'll get the idea  8)

 

For a description, you need a "README.md" file (markdown formatted file) - you'll see it in there.

 

The 'remove' script is for cleaning up in a running system.  The plugin manager (plugin script) executes the 'Remove' methods in the .plg file when someone clicks 'remove'.  It also removes the .plg file from /boot/config/plugins.  If it's too complicated to clean up after a remove you can have the 'remove' script echo "Too damn complicated, please reboot" and exit 1 (or something like that).

 

Ok.  Thanks, quite straight forward.

 

I've installed the plugins from the 'Extensions' page, but when I update a plugin, the /boot/config/plugins/ntfs-3g-x86_64.plg gets erased and a plugsntfs-3g-x86.plg is created in the /boot/config directory, but on a re-boot the plugin does not load.

Link to comment

Something else that was mentioned somewhere (can't remember where), is plugin file can can contain an in-line icon formatted with base64 like this:

 

<FILE Name="<your-path>/icon.png" Type="base64">
<INLINE>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gMaFy8xxk+XdgAAB81JREFUaAXNmGmMFUUQx2dPbpdD
UERdjhiUqIgggkHDByOKKDEaIaICAREQNEKUQKJgNK4hygcjIogoCdFoQIiQKBI1cgSUQ0UWZIOu
uwE8gOUQlmth/f0f08NM22/evAcYKvlvdVdXV1d1dVfP2zzvIqPuve/rhEv3ghKwZePapYvjXMyL
G/y/x3B+NmuOstatpd+NQCoseap70QSA83Pw6AmXk76s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pZ0Hqc7yl9
7D0PKwNBmaT9B9C/bJx2zykADEeIAMoRdIkI4zv1DDckgBM4r+qmKpeOLiMIFYYIhSONDOTYmcS8
9VnMPSXnff15GebNcI2f1wBwZpl/HFQ1RoFFoMq1MDJVGT1eOjo6CfqSjaOBrsFcyqjLTkRGEKpQ
7/pIjXG85KTqf3jXU2P8SfImNDXKYX5e70DYcLZtsnCSOXEbupE70MO2e16PkG08y37cz1qZesVl
76IJgN3tg4POUon8LcaXuAK4aI6QcY6jNJH2cKBPj/1gLM5vgDvpX5JiUKYVCFvxAAAAAElFTkSu
QmCC
</INLINE>
</FILE>

 

I get it.  Instead of downloading it from the internet, it is inline.

 

(that's the ubuntu-xfce icon)

Link to comment

I'm having an issue with SNAP plugin installation through the Extensions install.  The plugin installs correctly and I echo one last message that snap is installed, but it never exits the plugin installation.  The 'Close' button doesn't show up.  I am running a background task in snap (inotify) and when I comment that out of the script, the 'Close' button shows up.  Something is hanging the plugin installation.

 

I am running the task in the background like this:

task &

 

Maybe there is more I need to do.

Link to comment

I'm having an issue with SNAP plugin installation through the Extensions install.  The plugin installs correctly and I echo one last message that snap is installed, but it never exits the plugin installation.  The 'Close' button doesn't show up.  I am running a background task in snap (inotify) and when I comment that out of the script, the 'Close' button shows up.  Something is hanging the plugin installation.

 

I am running the task in the background like this:

task &

 

Maybe there is more I need to do.

 

Are you saying that part of installation of the script starts a background process?

Link to comment

I'm having an issue with SNAP plugin installation through the Extensions install.  The plugin installs correctly and I echo one last message that snap is installed, but it never exits the plugin installation.  The 'Close' button doesn't show up.  I am running a background task in snap (inotify) and when I comment that out of the script, the 'Close' button shows up.  Something is hanging the plugin installation.

 

I am running the task in the background like this:

task &

 

Maybe there is more I need to do.

 

Are you saying that part of installation of the script starts a background process?

 

Yes.

Link to comment

I'm having an issue with SNAP plugin installation through the Extensions install.  The plugin installs correctly and I echo one last message that snap is installed, but it never exits the plugin installation.  The 'Close' button doesn't show up.  I am running a background task in snap (inotify) and when I comment that out of the script, the 'Close' button shows up.  Something is hanging the plugin installation.

 

I am running the task in the background like this:

task &

 

Maybe there is more I need to do.

 

Are you saying that part of installation of the script starts a background process?

 

Yes.

 

Hmm probably the process is still owned by the process running the 'plugin install' and so the latter process won't exit.

 

Instead of

 

task &

 

try

 

nohup task &

Link to comment

I'm having an issue with SNAP plugin installation through the Extensions install.  The plugin installs correctly and I echo one last message that snap is installed, but it never exits the plugin installation.  The 'Close' button doesn't show up.  I am running a background task in snap (inotify) and when I comment that out of the script, the 'Close' button shows up.  Something is hanging the plugin installation.

 

I am running the task in the background like this:

task &

 

Maybe there is more I need to do.

 

Are you saying that part of installation of the script starts a background process?

 

Yes.

 

Hmm probably the process is still owned by the process running the 'plugin install' and so the latter process won't exit.

 

Instead of

 

task &

 

try

 

nohup task &

 

Solved by using the 'at' command to schedule the script to run.  The rc.snap start calls a script that puts an inotify script in the background.

 

<!--
Snap start up script.
-->
<FILE Name="/tmp/start_snap.sh">
<INLINE>
<![CDATA[
#!/bin/bash
/etc/rc.d/rc.snap start

rm /tmp/start_snap.sh
]]>
</INLINE>
</FILE>

<!--
Snap install.
-->
<FILE Name="/tmp/SnapInstall.sh" Run="/bin/bash">
<INLINE>
<![CDATA[
#!/bin/bash
#
# Start SNAP and mount any SNAP (usb) drives found.
#
echo "Starting Snap..."
at -f/tmp/start_snap.sh now

echo "Snap installation complete..."
rm /tmp/SnapInstall.sh
]]>
</INLINE>
</FILE>

Link to comment

I have 3 plugins I wrote that I want to migrate to he new plugin system.

You can see the plugins in my signature.

 

What are the requirements and changes needed?

 

I would take a look at the dockerMan plugin.  It's nicely written.

 

A few things I've learned:

- The 'name' you assign to the plugin has a lot of importance.  The name should be the sub-directory off the /usr/local/emhttp/plugins path.

- Your icon should be named the same with a .png extension in that same sub-directory.

- A READ.me file in the same sub-directory will be displayed on the plgman page.

- Be sure to include a script with 'remove' method so your plugin can clean up all that is necessary when plgman removes your plugin.  Remove packages, delete files from the flash drive, etc.

 

If you'd like, pm me and I'd be happy to review your plugin and give you some ideas.  By no means am I an expert, but the last week has been a steep learning curve for me and I have learned a lot about plugins.  I have to say it is a pretty slick system.  There seems to be one small issue with updating a plugin - it doesn't load on the next boot.

Link to comment

My OP was asking how the plugin manager worked on V6.  After a week of working with several of my plugins, I have learned a lot (geez, that hurts the brain) and I have modified my OP to document what I know at this time.  I'm not sure how complete my write up is, but it should help those of you wanting to convert V5 plugins, or author a new plugin for V6.

 

Let me know if there is anything that is incorrect or incomplete.  I will do my best to keep the OP up to date.

 

Tom or Jonp, please comment if I have gotten anything incorrect or incomplete.

Link to comment

In the example I gave in the OP, the icon is expected to be:

 

/usr/local/emhttp/plugins/ntfs-3g/ntfs-3g.png

 

Be sure your .png is named this way.

 

The line:

 

<!ENTITY pluginURL "https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g-x86_64.plg">

 

is used to check for a new plugin version.  In a telnet session, verify you can do a wget on this url without any errors.

 

I also had a situation where the name I was using in one plugin was not accepted by plgman.  When I changed the name, it worked properly.

 

Does your README.me content show up on the plugin page?

Link to comment

I have converted my openvpn client, but when have  this sett

 

<!ENTITY name      "openvpnclient">

It don't show up on plgman page... but plugin install fine anyway

 

But ... change the name to

 

<!ENTITY name      "TEST">

it works ! what can this be ? I have coded all path in the plg with real name (openvpnclient)

 

//Peter

 

 

Link to comment

I have converted my openvpn client, but when have  this sett

 

<!ENTITY name      "openvpnclient">

It don't show up on plgman page... but plugin install fine anyway

 

But ... change the name to

 

<!ENTITY name      "TEST">

it works ! what can this be ? I have coded all path in the plg with real name (openvpnclient)

 

//Peter

 

UnRaid has a problem with certain names.  Had the same issue with apcupsd.

 

Use name; variable for all references to the plugin name rather than hard coding to make this easier to change.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.