Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC
# The value 'delete' will cause the conflicting version(s) in the build directory to be removed.
versionConflictAction=delete

# Comment the following line to deploy the application with standalone tomcat
useEmbeddedTomcat=true

# Comment the following line when deploying a pre-build distribution with embedded tomcat
useLocalBuild

Expand Down Expand Up @@ -62,7 +59,7 @@ windowsProteomicsBinariesVersion=1.0
# The current version numbers for the gradle plugins.
artifactoryPluginVersion=4.31.9
gradleNodePluginVersion=3.5.1
gradlePluginsVersion=3.0.1
gradlePluginsVersion=4.0.0
owaspDependencyCheckPluginVersion=10.0.3
versioningPluginVersion=1.1.2

Expand Down
2 changes: 1 addition & 1 deletion server/bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceSets {

dependencies
{
def tomcatVersion = BuildUtils.useEmbeddedTomcat(project) ? project.springBootTomcatVersion : project.apacheTomcatVersion
def tomcatVersion = project.springBootTomcatVersion

implementation "org.apache.tomcat:tomcat-api:${tomcatVersion}"
implementation "org.apache.tomcat:tomcat-catalina:${tomcatVersion}"
Expand Down
2 changes: 0 additions & 2 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ configurations {
configurations.recompilingJsp.setDescription("Dependencies used by RecompileJspClassLoader")
BuildUtils.addTomcatBuildDependencies(project, 'recompilingJsp')

BuildUtils.addLabKeyDependency(project: project, config: 'tomcatJars', depProjectPath: BuildUtils.getBootstrapProjectPath(gradle)/*, depProjectConfig: 'runTimeElements'*/)

dependencies
{
remotePipelineJars "jakarta.servlet:jakarta.servlet-api:${servletApiVersion}"
Expand Down
24 changes: 10 additions & 14 deletions server/embedded/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# embedded
# Embedded
LabKey Server now uses embedded Tomcat, which bundles a fully tested copy of Tomcat and simplifies configuration.
This is the supported way to run LabKey Server as of version 24.3, replacing deploying into a standalone Tomcat installation.
This is the only way to run LabKey Server as of version 24.8, replacing deploying into a standalone Tomcat installation.

### Setup
1. Within the root-level `gradle.properties` file, uncomment the `useEmbeddedTomcat` and `useLocalBuild` properties. If using SSL, also uncomment the `useSsl` property (and see further instructions below).
1. Within the root-level `gradle.properties` file, uncomment the `useLocalBuild` property. If using SSL, also uncomment the `useSsl` property (and see further instructions below).
2. `gradlew cleanBuild`
3. `gradlew pickPg` or `gradlew pickMSSQL`
4. `gradlew deployApp`
Expand All @@ -14,33 +14,29 @@ This is the supported way to run LabKey Server as of version 24.3, replacing dep
configuration instead.

#### Embedded tomcat gradle properties explained:
+ `useEmbeddedTomcat` - if present, this will cause the :server:embedded project to be included in your local set of Gradle projects to be built. This also will affect the behavior of the `pickPg`, `pickMSSQL`, and `deployApp` tasks and is required to be present in order to build a distribution with an embedded Tomcat server. This property is present in the root-level `gradle.properties` file, but commented out by default.
+ `useLocalBuild` - If present, will allow the embedded server to use the locally built modules from `build/deploy/modules`. This property is present in the root-level `gradle.properties` file, but commented out by default.
+ `useSsl` - If present, the default port for the server will be 8443 instead of 8080 and the `server.ssl` properties in the `application.properties` file will be uncommented. Note, however, that these ssl properties will still need to be updated by hand to reflect your local certificate location, password, etc.
+ `useLocalBuild` - If present, will allow the embedded server to use the locally built modules from `build/deploy/modules`. This property is present in the root-level `gradle.properties` file, but commented out by default.
+ `useSsl` - If present, the default port for the server will be 8443 instead of 8080 and the `server.ssl` properties in the `application.properties` file will be uncommented. Note, however, that these ssl properties will still need to be updated by hand to reflect your local certificate location, password, etc.

Note that it is only the presence of these properties that matter, not the value. Setting one of these properties to false will not achieve what you expect. In addition, there is a new property, `serverPort`, that can be used to override the default port for your server instance.

#### Updated and new gradle tasks
The following tasks have been updated with new logic based on the presence of the `useEmbeddedTomcat` property:

+ `startTomcat` - If `useEmbeddedTomcat` is defined, starts the server using whatever executable jar is in the `build/deploy/embedded directory`. If there is more than one jar file there, the task will fail.
+ `stopTomcat` - If `useEmbeddedTomcat` is defined, stops the server that is running on the port provided in `build/deploy/embedded/config/application.properties`. This uses the Spring Actuator so if you have a non-embedded server running that does not have the actuator, this command will have no effect. The command logs a message to give an indication of whether it was successful or not. For example:
+ `startTomcat` - Starts the server using whatever executable jar is in the `build/deploy/embedded directory`. If there is more than one jar file there, the task will fail.
+ `stopTomcat` - Stops the server that is running on the port provided in `build/deploy/embedded/config/application.properties`. The command logs a message to give an indication of whether it was successful or not. For example:
> Task :server:stopEmbeddedTomcat
Shutdown successful
OR
> Task :server:stopEmbeddedTomcat
Shutdown command exited with non-zero status 7.

+ `deployDistribution` - If `useEmbeddedTomcat` is defined, this will find a distribution file with the `-embedded` suffix in its name and deploy it. The deployment puts the executable jar file in `build/deploy/embedded` and copies the contents of the `bin` directory in the distribution to `build/deploy/embedded/bin`. This task has a dependency on the `setup` task, so after it has run the `build/deploy/embedded/configs` directory will also be populated with the current `application.properties` file, provided the `useEmbeddedTomcat` property has been set.
+ `deployDistribution` - Finds a distribution file with the `-embedded` suffix in its name and deploys it. The deployment puts the executable jar file in `build/deploy/embedded` and copies the contents of the `bin` directory in the distribution to `build/deploy/embedded/bin`. This task has a dependency on the `setup` task, so after it has run the `build/deploy/embedded/configs` directory will also be populated with the current `application.properties` file.

The following task has been added as well
+ `cleanEmbeddedDeploy` - This task is really only incidental. It is a dependency of `deployDistribution` and `deployApp` so likely won’t be called individually. It removes the `build/deploy/embedded` directory.

+ `cleanEmbeddedDeploy` - This task is really only incidental. It is a dependency of `deployDistribution` and `deployApp` so likely won’t be called individually. It removes the `build/deploy/embedded` directory.

#### Troubleshooting
+ If starting your server from the LabKeyEmbedded_Dev configuration fails, this is likely due to IntelliJ not being able to find the embedded project on which the configuration depends. There are a few things you should check:
+ Ensure that the `useEmbeddedTomcat` property is uncommented in the root-level `build.gradle` file
+ Within the Gradle window, ensure that the `:server:embedded` project is listed. If it is not, run the task `gradle projects` on the command line to see if it appears in that listing. If it does, try a Gradle refresh within IntelliJ. If it is not in the output from the `projects` command, look at your `settings.gradle` file to see why this might be.
+ Within the Gradle window, ensure that the `:server:embedded` project is listed. If it is not, run the task `gradle projects` on the command line to see if it appears in that listing. If it does, try a Gradle refresh within IntelliJ. If it is not in the output from the `projects` command, look at your `settings.gradle` file to see why this might be.
+ From the Configurations menu, choose the "Edit Configurations ..." and then under the Spring Boot section, choose the `LabKeyEmbedded_Dev` configuration.
+ If the there is nothing selected for "Use classpath of module", open the dropdown and choose `<root>.server.embedded.main`, where `<root>` is the name of the root of your enlistment.
+ If there are no options presented for "Use classpath of module" and the embedded module does appear in the Gradle projects listing, try `File -> Invalidate Caches / Restart`