The previous article in this series covered the reasons for iRules LX and the conceptual operation. Now we need learn the new configurations items that iRules LX introduces. Since iRules LX has DevOps teams in mind, there is a slightly different workflow than standard iRules.
Our first new configuration item, LX Workspaces, provides a development and staging environment for your Node.js code and the TCL iRules that are used for iRules LX. The code can be authored and saved in the workspace without affecting the running code on the data plane. Workspaces can also be exported as TGZ files and then imported to another BIG-IP. This is especially useful to allow for development and testing on a BIG-IP in a lab/dev environment and then later installed onto a production BIG-IP.
Both LX Workspaces and LX Plugins (which we will talk about later) can be found on your BIG-IP in the menu Local Traffic > iRules as shown here -
When you select the + option to create a new workspace and give it a name, the workspace will look like this (except that it will be blank with no folders) -
You can see in the screen shot that we have a rules folder. This folder will be created once you add an iRule and will always be named "rules". It can contain any number TCL iRules you create for the workspace. You also see the folder named dc_extension. This is an extension.
An extension is folder of Node.js code within an LX Workspace. As we saw with the screenshot above, we had one extension named dc_extension. The extension folder can be given any valid Unix name (except rules), but the name will matter when it is time to start coding (more in tomorrow's article). If we expand the extension folder, we will see this -
Each extension will have these files and folders to start off with.
index.js - This file is the Node.js code that will eventually run on your BIG-IP.
node_modules - This folder will contain node modules you install from NPM.
package.json - This is the standard package.json file that is use to store various information and package dependencies about a Node.js program.
An LX Plugin is the production code from the LX Workspace that is actively running on the data plane of the BIG-IP. You can see in this screenshot the settings of an LX Plugin -
Also, each workspace extension is listed. Each extension has their own Node.js settings and if you click on an extension inside a LX Plugin you will see this -
So now that we know our new configuration objects we need to follow a workflow to get iRules LX up and running. That workflow looks like this -
Step 1: Write Code in LX Workspace
The first step is to actually write the code you want in a LX Workspace. This would be both your Node.js code and the TCL iRules that would make the RPC calls to Node.
Step 2: Load LX Workspace to an LX Plugin
To load the workspace into the LX Plugin, you would create the LX Plugin and select the LX Workspace that you want to load into it -
When you create the LX Plugin, the extensions will get loaded into a Node.js process(es) and the TCL iRules will be loaded in the TCL iRules menu with the rest of the iRules -
You can see on the Partition/Path that this matches the LX Plugin we created. This works just like as if an iApp created the iRule. As such, you can not edit the iRule from here--you can only do it in the LX Workspace itself.
Step 3: Load the TCL iRule to a Virtual Server
At this point your TCL iRule can now be added to a virtual server -
You will find your iRule under the Partition/Path for your LX Plugin. Move it over to the enabled section and you will be running iRules LX.
Making Updates to iRules LX
If you change code in the LX Workspace, that code will not be active until you reload it to the LX Plugin. An LX Workspace let's you know if the code in the workspace is different than that which is running in the LX Plugin with a status indicator -
This indicator is yellow when the code is different. To reload the LX Workspace code into the LX Plugin, just click the Reload From Workspace button next to the indicator. When the code is in sync, the indicator will be green -
Licensing and Provisioning
iRules LX is licensed to all BIG-IP users in TMOS 12.1 (assuming you have a valid support contract). On new licenses (once that where generated after TMOS 12.1 released) iRules LX will be automatically licensed. If you have an older license and have upgraded to v12.1, you simply need to reactivate your license. This can be done online if your BIG-IP has internet access or manually.
To use iRules LX, it must be provisioned. It is not turned on by default, so customers that are not using it do not need to worry about Node.js processes running on their BIG-IP. To provision it, browse over to the Resource Provisioning menu of your BIG-IP, check the box for iRules LX and give it a nominal level of resources -
In the next article in this series, we will cover writing code for iRules LX.