Skip to content

mstrhakr/plugin-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

53 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Plugin Development Documentation for Unraidยฎ

The community-maintained guide to building plugins for Unraidยฎ OS

Unraidยฎ is a registered trademark of Lime Technology, Inc. This project is not affiliated with, endorsed by, or sponsored by Lime Technology, Inc.

License: MIT Works with Unraidยฎ Contributions Welcome Visitors

View on GitHub ย ย  Built with GitHub Copilot ย ย  View Analytics


๐Ÿ“š The full documentation is available at: mstrhakr.github.io/unraid-plugin-docs


๐Ÿ“– About This Documentation

This is the unofficial, community-driven documentation for developing plugins for Unraidยฎ OS. The Unraidยฎ plugin system is powerful but has historically lacked comprehensive documentation. This project aims to fill that gap by providing clear, well-organized, and up-to-date resources for plugin developers.

โš ๏ธ Disclaimer: This is not official Lime Technology documentation. Unraidยฎ is a registered trademark of Lime Technology, Inc. This project is not affiliated with, endorsed by, or sponsored by Lime Technology, Inc. While every effort is made to ensure accuracy, please verify critical information against official sources and existing plugins.


๐Ÿš€ Quick Start

New to Unraidยฎ plugin development? Start here:

  1. Introduction to Plugins - What are plugins and how do they work?
  2. Plugin File Structure - Anatomy of a .plg file
  3. Your First Plugin - Step-by-step tutorial
  4. Web UI Pages - Creating .page files for the web GUI

๐Ÿ“š Documentation Index

Core Concepts

Topic Description
Introduction Overview of the Unraidยฎ plugin system
PLG File Reference Complete reference for .plg XML structure
Page Files Creating web UI pages (.page files)
Plugin Lifecycle Installation, updates, and removal
File System Layout Where files go and why

Web UI Development

Topic Description
Page Headers Menu, Title, Type, Icon, and more
Dynamix Markdown The form syntax used in Unraidยฎ UI
PHP Integration Using PHP in your pages
JavaScript & AJAX Client-side scripting
CSS & Theming Styling your plugin UI

Events & System Integration

Topic Description
Event System Responding to array start/stop, Docker, etc.
Configuration Files Storing and reading plugin settings
Shell Scripts Background tasks and automation
Docker Integration Working with Docker containers

Packaging & Distribution

Topic Description
Package Building Creating .txz packages
Versioning Version strategies and update checking
Community Applications Publishing to the CA App Store
Best Practices Tips from experienced developers

Reference

Topic Description
Plugin Command Using the plugin CLI tool
API Reference Available PHP functions and variables
Example Plugins Links to well-documented plugins
Troubleshooting Common issues and solutions

๐Ÿ—‚๏ธ Plugin System Overview

At a high level, an Unraidยฎ plugin consists of:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        myplugin.plg                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  XML-based installer that:                               โ”‚   โ”‚
โ”‚  โ”‚  โ€ข Downloads and extracts packages                       โ”‚   โ”‚
โ”‚  โ”‚  โ€ข Runs install/remove scripts                           โ”‚   โ”‚
โ”‚  โ”‚  โ€ข Defines plugin metadata (name, version, author)       โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    myplugin-package.txz                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Slackware package containing:                           โ”‚   โ”‚
โ”‚  โ”‚  /usr/local/emhttp/plugins/myplugin/                     โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ myplugin.page       (Web UI)                      โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ myplugin.settings.page                            โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ default.cfg                                       โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ php/                                              โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ scripts/                                          โ”‚   โ”‚
โ”‚  โ”‚    โ”œโ”€โ”€ javascript/                                       โ”‚   โ”‚
โ”‚  โ”‚    โ””โ”€โ”€ event/                                            โ”‚   โ”‚
โ”‚  โ”‚        โ”œโ”€โ”€ started                                       โ”‚   โ”‚
โ”‚  โ”‚        โ””โ”€โ”€ stopping_docker                               โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”— Key Directories

Path Purpose Persistence
/boot/config/plugins/ Plugin files stored on USB flash โœ… Survives reboot
/boot/config/plugins/myplugin/ Plugin config and cached files โœ… Survives reboot
/usr/local/emhttp/plugins/myplugin/ Active plugin files (web UI) โŒ RAM disk
/var/log/plugins/ Symlinks indicating installed plugins โŒ RAM disk
/tmp/plugins/ Downloaded plugin files for updates โŒ Temporary

๐ŸŽฏ emhttp Events

Plugins can respond to system events by placing executable scripts in their event/ directory:

Event Triggered When
driver_loaded Early in emhttp initialization
starting Array start begins
array_started Array devices are valid
disks_mounted Disks and shares are mounted
docker_started Docker service starts
libvirt_started VM service starts
started Array start completes
stopping Array stop begins
stopping_docker About to stop Docker
stopping_libvirt About to stop VMs
unmounting_disks About to unmount disks
stopped Array has stopped
poll_attributes SMART data polled

See Event System for full details.


๐Ÿ› ๏ธ Development Tips

Quick Testing Workflow

  1. Edit files directly in /usr/local/emhttp/plugins/myplugin/ on your server
  2. Refresh the browser to see changes (PHP/HTML changes are instant)
  3. A reboot will restore original files from the package, so copy changes back to your source!

Useful CLI Commands

# Install a plugin
plugin install /path/to/myplugin.plg

# Check for plugin updates
plugin check myplugin.plg

# Update a plugin
plugin update myplugin.plg

# Remove a plugin
plugin remove myplugin.plg

# Get plugin version
plugin version /var/log/plugins/myplugin.plg

๐Ÿค Contributing

GitHub

This documentation is a community effort! Contributions are welcome:

See CONTRIBUTING.md for guidelines.


๐Ÿ“œ Resources & Links

Official Resources

Community Developer Resources

Historical References


๐Ÿ“„ License

This documentation is licensed under CC BY-SA 4.0. Code examples are provided under the MIT License.


Made with โค๏ธ by the Unraidยฎ community
unraid.net