From f89862c2f2833a949977f19b6ea938437de67dbf Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Tue, 3 Sep 2024 17:29:04 -0700 Subject: [PATCH 1/2] Remove useEmbeddedTomcat property and other support for standalone builds --- gradle.properties | 5 +---- server/bootstrap/build.gradle | 2 +- server/build.gradle | 2 -- server/embedded/README.md | 24 ++++++++++-------------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/gradle.properties b/gradle.properties index 28d1817b0b..f068b7c09e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 @@ -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=3.1.0-fb_useEmbedded-SNAPSHOT owaspDependencyCheckPluginVersion=10.0.3 versioningPluginVersion=1.1.2 diff --git a/server/bootstrap/build.gradle b/server/bootstrap/build.gradle index c6915c1a75..9e8b1e477f 100644 --- a/server/bootstrap/build.gradle +++ b/server/bootstrap/build.gradle @@ -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}" diff --git a/server/build.gradle b/server/build.gradle index c3b0eb2802..4f5fc5cda1 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -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}" diff --git a/server/embedded/README.md b/server/embedded/README.md index 65f92ee21c..d344112d9f 100644 --- a/server/embedded/README.md +++ b/server/embedded/README.md @@ -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` @@ -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 `.server.embedded.main`, where `` 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` From 746303db15ba8f940125bba43767b276517711e3 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Thu, 5 Sep 2024 17:15:27 -0700 Subject: [PATCH 2/2] Use the just-published gradle plugins version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f068b7c09e..4b9be9832c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -59,7 +59,7 @@ windowsProteomicsBinariesVersion=1.0 # The current version numbers for the gradle plugins. artifactoryPluginVersion=4.31.9 gradleNodePluginVersion=3.5.1 -gradlePluginsVersion=3.1.0-fb_useEmbedded-SNAPSHOT +gradlePluginsVersion=4.0.0 owaspDependencyCheckPluginVersion=10.0.3 versioningPluginVersion=1.1.2