Module Development

During development, you will typically want to keep your module uncompressed so that you can quickly add or adjust those resources that can be automatically reloaded. Any changes you make to queries, reports, HTML views and web parts will automatically be noticed and the contents of those files will be reloaded without needing to restart the server.

Move to Production

Typically you will develop a module on a developer machine, deploy it to a staging server when it's working, and then move it to the production server once the development is complete. Moving the module can be done either by copying the uncompressed module directory and its subdirectories and files from the test server to the production server, or by compressing the module directory into a .module file and copying that to the production server. Which technique you choose will probably depend on what kind of file system access you have between the servers. If the production server's drive is mounted on the test server, a simple directory copy would be sufficient. If FTP is the only access between the test and production servers, sending a compressed file would be easier.

An easy way to compress the module directory is to use the JAR utility, which can also be automated via a Gradle build task. Use the standard JAR options and name the target file "<module-name>.module".

Deploy the Module

Deploy the .module file using the server UI or by copying it to the <labkey-home>/externalModules/ directory on your production server. You may have to create the externalModules directory. (The modules directory works also, but we recommend the externalModules to indicate that this is user provided code.) A server running in production mode will not recognize a new module -- a manual server restart is required in this case. But a production server will monitor existing modules for changes. When it loads the module, it will automatically expand the .module into a directory with the same base name (overwriting the existing directory and files), and load the newly-updated module's resources. Also a module must be enabled in the folder you are working/testing in.

  • Shut down Tomcat.
  • Create the "externalModules" directory in your LabKey installation if it does not exist already. For example:
sudo mkdir -p /usr/local/labkey/labkey/externalModules
  • Copy the .module file to that new directory.
  • Start Tomcat.

Update the Module

Most files in a module can be updated while the production server is running (sql queries, html views, trigger scripts, assay domains and views) without restarting. Some files cannot be updated while the server is running (SQL scripts, assay provider definitions, compiled Java code, etc) and require a manual restart of the server.

Related Topics


Was this content helpful?

Log in or register an account to provide feedback

expand all collapse all