Your plugin might rely on files in addition to its source code, such as configuration files. When you upgrade Traffic Server, you might need to make sure your plugin is always able to find its associated files. The mechanism for preserving relative file locations with upgrades is as follows:
Make sure that all plugins are contained in their own directories
within the plugin
directory.
The plugin directory path is specified in the Traffic Server
records.config
file variable
proxy.config.plugin.plugin_dir
. This path is
relative to the Traffic Server install directory. The default value
is config/plugin
.
Make sure that all plugins are listed in the
plugin.db
file. For each plugin, this file
contains the plugin name, object file, license key, file name(s),
and directory relative to the plugin
directory.
When Traffic Server is upgraded, the Traffic Server
installation program looks at the plugin.db
file to see which plugins to copy over to the new Traffic Server
installation, and what the appropriate object files, license keys,
additional files, and directories should be.
The format of the plugin.db
file is as
follows:
[name of your plugin] Object=[name of plugin’s shared object file License=[license key] Dir=[name of any directories to be copied over]
Entries in plugin.db
are case-sensitive.
Do not include white spaces in your entries. For example, the following line is incorrect:
Object = plugin.so
The correct entry would be:
Object=plugin.so
For example, suppose you have a blacklist plugin in the
plugin
directory. Its object file is Blacklist.so
and it has some user interface files (images and HTML files) in the
Blacklist/ui
directory. To make sure that the
blacklist plugin is upgraded properly, plugin.db
needs the following entry:
[Blacklist plugin] Object=Blacklist.so License=ABCD0123456789 Dir=Blacklist/ui
In this example, if all of the necessary files and directories are
in the Blacklist directory, then you could simply specify
Dir=Blacklist
.
This means that the Blacklist image and HTML files are always located in:
<Traffic Server install
directory>
/<plugin
directory>
/Blacklist/ui
Your plugin might need to specify the absolute location of its associated files. The following functions provide the Traffic Server install directory path and plugin directory path: