Premium Feature — This feature is available with the Professional and Enterprise Editions of LabKey Server. It requires the addition of the moduleEditor module to your distribution. Learn more or contact LabKey.

File-based modules (i.e. modules that do not contain Java or other code needing compliation) can be loaded and updated on a production server by an administrator using the user interface without needing to start and stop. This feature makes it easier to update queries, reports, and views that can be maintained through a file based module.

Create Your Module

Create a file based module containing the resources needed. Typically you would create your module on a development machine, and build it, generating a file named [MODULE_NAME].module.

If you would like a small module to test this feature as shown in the walkthrough on this page, download:

If you need help learning to create modules, try this tutorial:

Add Module to Server

On your LabKey Server, add your new module by name as follows. You must be a site admin or have the Platform Developer role to add modules.

  • Select (Admin) > Site > Admin Console.
  • Click the Module Information tab.
  • Click Module Details above the list of current modules.
  • Click Create New Empty Module.
  • Enter the name of your new module and click Submit.

You will now see your module listed. Notice the module type shown is "SimpleModule". At this point the module is empty.

Next, use the reloading mechanism described in the next section to populate this empty module with your content.

Reload Module

To reload the module on the server, use Update Module from the module details page of the admin console. Note that you do this to populate an empty module as well as to load changed content in the future.

  • On the (Admin) > Site > Admin Console > Module Information > Module Details page, find the row for your module.
  • Click the Update Module link for the module.
  • Click Choose File or Browse, and select the .module file to load. Note that the name of the module file must be in all lower case. In our example, it is "aloadingdemo.module".
  • Click Submit.

Now your module can be enabled and used on your server.

Use Your Module

Without starting and stopping the server, your module is now available to be used. If you are using our loading demo module and choose to use it in a folder containing the example study downloadable from this page, you will be able to use a few additional module resources.

Navigate to the folder where you want to use the resources it contains and enable it:

  • Select (Admin) > Folder > Management.
  • Click the Folder Type tab.
  • Check the box for your module name and click Update Folder.
  • You can now use the contents.
    • If you used our "aLoadingDemo" module, you can now add a web part of the "1 New Web Part" type.

Edit Your Module Resources

To edit the module-based resources, you must make changes using a development machine (or elsewhere on your filesystem), then regenerate the revised .module file and then use the Update Module link on the module details page to reload the new content.

When you are working on a Development mode server, you will see the ability to create and load a new module, but this cannot be used to generate an editable version of the module. If you click Edit Module on the module details page, you will see a message indicating it cannot be edited. Instead, you can use your development machine, following the instructions in this topic:

Manage Loaded Module

On the Module Details page, on the right side of the row for your module, there are links to:

  • Update Module: Load new information for the module by way of a new .module archive file.
  • Delete Module: Delete the module from the server. Note that deleting a module removes it from the server, and deletes the content in the "build/deploy/modules" subdirectory. It also may cause the webapp to reload.

Troubleshooting

Note that feature is intended for use on a production server, and will only succeed for modules that do not contain Java code or require compilation.

If you see the error message "Archive should not contain java code" and believe that your module does not contain such code, check the following:

1. The module.properties file should contain the line:

ModuleClass: org.labkey.api.module.SimpleModule

2. If there is a build.gradle file in your module, it must contain the line:

apply plugin: 'org.labkey.fileModule'

3. If your module is located in the "$LABKEY_HOME/server/modules" directory, our tools will attempt to build it. Try moving it to "$LABKEY_HOME/server/localModules" instead, then include it in your settings.gradle file:

include ':server:localModules:myModule'
You can then build it there manually and try again to load the .module file on your server.

4. If your module does not contain any actual source code, but includes a "src" directory (for example, if you cloned our demo module available on GitHub then removed the java code), try renaming it to "notSource" or something else so that it is not viewed as needing compilation by our tools.

Related Topics

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all