From ea117c8523a0981e6a8311690b21b9991fb13be3 Mon Sep 17 00:00:00 2001 From: Benjamin Van der Smissen Date: Fri, 26 Apr 2024 13:57:30 +0200 Subject: [PATCH 1/4] DOCKER-450 [Add] Support for Alfresco v23.1 && v23.2 * [Add] tomcat-embedded V10 * [Update] JSON-logging V0.0.7 to V0.0.8 * [Update] Changelog * [source] https://docs.alfresco.com/content-services/latest/support/#supported-platforms/23-1 DOCKER-450 [test] sonarcube DOCKER-450 [test] ignore subproject embedded-x code for sonarqube --- .github/workflows/ci.yml | 4 +- 1alfresco-skeleton/23.1/overload.gradle | 11 + 1alfresco-skeleton/23.2/overload.gradle | 11 + .../23.1/local/share-config-custom.xml | 524 ++++++++++++++++++ 1share-skeleton/23.1/overload.gradle | 10 + .../23.2/local/share-config-custom.xml | 524 ++++++++++++++++++ 1share-skeleton/23.2/overload.gradle | 10 + .../23.1/community-23.1.0/overload.gradle | 24 + .../23.1/enterprise-23.1.0/overload.gradle | 23 + .../23.2/community-23.2.0/overload.gradle | 23 + .../23.2/enterprise-23.2.0/overload.gradle | 23 + 2share/23.1/community-23.1.0/overload.gradle | 16 + 2share/23.2/community-23.2.0/overload.gradle | 16 + Changelog.md | 2 +- build.gradle | 17 + settings.gradle | 21 +- tomcat-base/build.gradle | 37 +- .../tomcat/AlfrescoTomcatFactoryHelper.java | 14 +- .../tomcat-embedded-10/overload.gradle | 5 + .../tomcat/embedded/tomcat/TomcatFactory.java | 4 +- .../tomcat-embedded-8.5/overload.gradle | 2 +- .../tomcat/embedded/tomcat/TomcatFactory.java | 153 +++++ tomcat-base/tomcat-embedded-9/overload.gradle | 6 - .../tomcat/embedded/tomcat/TomcatFactory.java | 153 +++++ 24 files changed, 1604 insertions(+), 29 deletions(-) create mode 100644 1alfresco-skeleton/23.1/overload.gradle create mode 100644 1alfresco-skeleton/23.2/overload.gradle create mode 100644 1share-skeleton/23.1/local/share-config-custom.xml create mode 100644 1share-skeleton/23.1/overload.gradle create mode 100644 1share-skeleton/23.2/local/share-config-custom.xml create mode 100644 1share-skeleton/23.2/overload.gradle create mode 100644 2repository/23.1/community-23.1.0/overload.gradle create mode 100644 2repository/23.1/enterprise-23.1.0/overload.gradle create mode 100644 2repository/23.2/community-23.2.0/overload.gradle create mode 100644 2repository/23.2/enterprise-23.2.0/overload.gradle create mode 100644 2share/23.1/community-23.1.0/overload.gradle create mode 100644 2share/23.2/community-23.2.0/overload.gradle create mode 100644 tomcat-base/tomcat-embedded-10/overload.gradle rename tomcat-base/{ => tomcat-embedded-10}/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java (98%) create mode 100644 tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java create mode 100644 tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffd9a0b3..3e4762ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "community-6.1.2-ga","community-6.2.0-ga","community-7.0.0", "community-7.1.1", "community-7.2.0", "community-7.3.0", "community-7.4.0", "enterprise-6.1.1","enterprise-6.2.2","enterprise-7.0.1", "enterprise-7.1.0", "enterprise-7.2.0", "enterprise-7.3.0", "enterprise-7.4.0" ] + version: [ "community-6.1.2-ga","community-6.2.0-ga","community-7.0.0", "community-7.1.1", "community-7.2.0", "community-7.3.0", "community-7.4.0", "community-23.1.0", "community-23.2.0", "enterprise-6.1.1","enterprise-6.2.2","enterprise-7.0.1", "enterprise-7.1.0", "enterprise-7.2.0", "enterprise-7.3.0", "enterprise-7.4.0", "enterprise-23.1.0", "enterprise-23.2.0" ] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - name: Set up JDK 17 @@ -114,4 +114,4 @@ jobs: uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2 with: cache-read-only: false - arguments: :tomcat-base:tomcat-embedded-8.5:publish :tomcat-base:tomcat-embedded-9:publish --info -PsigningKeyId=CDE3528F \ No newline at end of file + arguments: :tomcat-base:tomcat-embedded-8.5:publish :tomcat-base:tomcat-embedded-9:publish :tomcat-base:tomcat-embedded-10:publish --info -PsigningKeyId=CDE3528F \ No newline at end of file diff --git a/1alfresco-skeleton/23.1/overload.gradle b/1alfresco-skeleton/23.1/overload.gradle new file mode 100644 index 00000000..c2773d2a --- /dev/null +++ b/1alfresco-skeleton/23.1/overload.gradle @@ -0,0 +1,11 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 1, + rev: 0 + ], + flavor: 'skeleton' + ] +} + diff --git a/1alfresco-skeleton/23.2/overload.gradle b/1alfresco-skeleton/23.2/overload.gradle new file mode 100644 index 00000000..4b265a43 --- /dev/null +++ b/1alfresco-skeleton/23.2/overload.gradle @@ -0,0 +1,11 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 2, + rev: 0 + ], + flavor: 'skeleton' + ] +} + diff --git a/1share-skeleton/23.1/local/share-config-custom.xml b/1share-skeleton/23.1/local/share-config-custom.xml new file mode 100644 index 00000000..3211ef8f --- /dev/null +++ b/1share-skeleton/23.1/local/share-config-custom.xml @@ -0,0 +1,524 @@ + + + + + + + false + + + false + + + + + + + + + + production + + + + + manual + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + 1000 + + + 7000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${ALFRESCO_PROTOCOL}://${ALFRESCO_HOST}:${ALFRESCO_PORT}/${ALFRESCO_CONTEXT} + + + + + false + + + + application/vnd.openxmlformats-officedocument.wordprocessingml.document + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + application/vnd.ms-powerpoint + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + location.path.documents + + slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&max={maximumFolderCountSite} + + + + + + + + alfresco://company/home + + + + false + + + 500 + + + + true + + + + + + + + secret + + ALFRESCO.ORG + + HTTP/repository.server.com@ALFRESCO.ORG + + ShareHTTP + + true + + + + + + + + + + alfresco-noauth + Alfresco - unauthenticated access + Access to Alfresco Repository WebScripts that do not require authentication + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + none + + + + alfresco + Alfresco - user access + Access to Alfresco Repository WebScripts that require user authentication + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + user + + + + alfresco-feed + Alfresco Feed + Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet + http + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + true + user + + + + alfresco-api + alfresco + Alfresco Public API - user access + Access to Alfresco Repository Public API that require user authentication. + This makes use of the authentication that is provided by parent 'alfresco' endpoint. + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/api + user + + + + + + + + 2 + 8 + false + + + false + + + + + + + + + + + + diff --git a/1share-skeleton/23.1/overload.gradle b/1share-skeleton/23.1/overload.gradle new file mode 100644 index 00000000..00b73fe2 --- /dev/null +++ b/1share-skeleton/23.1/overload.gradle @@ -0,0 +1,10 @@ +ext { + share = [ + version: [ + major: 23, + minor: 1, + rev: 0 + ], + flavor: 'skeleton' + ] +} \ No newline at end of file diff --git a/1share-skeleton/23.2/local/share-config-custom.xml b/1share-skeleton/23.2/local/share-config-custom.xml new file mode 100644 index 00000000..3211ef8f --- /dev/null +++ b/1share-skeleton/23.2/local/share-config-custom.xml @@ -0,0 +1,524 @@ + + + + + + + false + + + false + + + + + + + + + + production + + + + + manual + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + 1000 + + + 7000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${ALFRESCO_PROTOCOL}://${ALFRESCO_HOST}:${ALFRESCO_PORT}/${ALFRESCO_CONTEXT} + + + + + false + + + + application/vnd.openxmlformats-officedocument.wordprocessingml.document + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + application/vnd.ms-powerpoint + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + location.path.documents + + slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&max={maximumFolderCountSite} + + + + + + + + alfresco://company/home + + + + false + + + 500 + + + + true + + + + + + + + secret + + ALFRESCO.ORG + + HTTP/repository.server.com@ALFRESCO.ORG + + ShareHTTP + + true + + + + + + + + + + alfresco-noauth + Alfresco - unauthenticated access + Access to Alfresco Repository WebScripts that do not require authentication + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + none + + + + alfresco + Alfresco - user access + Access to Alfresco Repository WebScripts that require user authentication + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + user + + + + alfresco-feed + Alfresco Feed + Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet + http + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s + true + user + + + + alfresco-api + alfresco + Alfresco Public API - user access + Access to Alfresco Repository Public API that require user authentication. + This makes use of the authentication that is provided by parent 'alfresco' endpoint. + alfresco + ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/api + user + + + + + + + + 2 + 8 + false + + + false + + + + + + + + + + + + diff --git a/1share-skeleton/23.2/overload.gradle b/1share-skeleton/23.2/overload.gradle new file mode 100644 index 00000000..7f8e04a6 --- /dev/null +++ b/1share-skeleton/23.2/overload.gradle @@ -0,0 +1,10 @@ +ext { + share = [ + version: [ + major: 23, + minor: 2, + rev: 0 + ], + flavor: 'skeleton' + ] +} \ No newline at end of file diff --git a/2repository/23.1/community-23.1.0/overload.gradle b/2repository/23.1/community-23.1.0/overload.gradle new file mode 100644 index 00000000..1011ea20 --- /dev/null +++ b/2repository/23.1/community-23.1.0/overload.gradle @@ -0,0 +1,24 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 1, + rev : 0, + label: 1 + ], + flavor : 'community' + ] + solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' + shareimage = 'docker.io/xenit/alfresco-share-community:23.1.0' +// 13,14,15 are supported + psqlimage = 'docker.io/xenit/postgres:13' + tests = true + alfrescoBomVersion='23.1.0' +} + +dependencies { + alfrescoAmp platform("org.alfresco:acs-community-packaging:$alfrescoBomVersion") + alfrescoAmp 'org.alfresco:alfresco-share-services@amp' + baseAlfrescoWar platform("org.alfresco:acs-community-packaging:$alfrescoBomVersion") + baseAlfrescoWar 'org.alfresco:content-services-community@war' +} diff --git a/2repository/23.1/enterprise-23.1.0/overload.gradle b/2repository/23.1/enterprise-23.1.0/overload.gradle new file mode 100644 index 00000000..4dd0d7d6 --- /dev/null +++ b/2repository/23.1/enterprise-23.1.0/overload.gradle @@ -0,0 +1,23 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 1, + rev : 0, + label: 1 + ], + flavor : 'enterprise' + ] + solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' + shareimage = 'docker.io/xenit/alfresco-share-community:23.1.0' + psqlimage = 'docker.io/xenit/postgres:13' + tests = true + alfrescoBomVersion = '23.1.0' +} + +dependencies { + alfrescoAmp platform("org.alfresco:acs-packaging:$alfrescoBomVersion") + alfrescoAmp 'org.alfresco:alfresco-share-services@amp' + baseAlfrescoWar platform("org.alfresco:acs-packaging:$alfrescoBomVersion") + baseAlfrescoWar 'org.alfresco:content-services@war' +} diff --git a/2repository/23.2/community-23.2.0/overload.gradle b/2repository/23.2/community-23.2.0/overload.gradle new file mode 100644 index 00000000..d3221184 --- /dev/null +++ b/2repository/23.2/community-23.2.0/overload.gradle @@ -0,0 +1,23 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 2, + rev : 0, + label: 1 + ], + flavor : 'community' + ] + solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' + shareimage = 'docker.io/xenit/alfresco-share-community:23.2.0' + psqlimage = 'docker.io/xenit/postgres:13' + tests = true + alfrescoBomVersion='23.2.0' +} + +dependencies { + alfrescoAmp platform("org.alfresco:acs-community-packaging:$alfrescoBomVersion") + alfrescoAmp 'org.alfresco:alfresco-share-services@amp' + baseAlfrescoWar platform("org.alfresco:acs-community-packaging:$alfrescoBomVersion") + baseAlfrescoWar 'org.alfresco:content-services-community@war' +} diff --git a/2repository/23.2/enterprise-23.2.0/overload.gradle b/2repository/23.2/enterprise-23.2.0/overload.gradle new file mode 100644 index 00000000..516d4ed7 --- /dev/null +++ b/2repository/23.2/enterprise-23.2.0/overload.gradle @@ -0,0 +1,23 @@ +ext { + alfresco = [ + version: [ + major: 23, + minor: 2, + rev : 0, + label: 1 + ], + flavor : 'enterprise' + ] + solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' + shareimage = 'docker.io/xenit/alfresco-share-community:23.2.0' + psqlimage = 'docker.io/xenit/postgres:13' + tests = true + alfrescoBomVersion = '23.2.0' +} + +dependencies { + alfrescoAmp platform("org.alfresco:acs-packaging:$alfrescoBomVersion") + alfrescoAmp 'org.alfresco:alfresco-share-services@amp' + baseAlfrescoWar platform("org.alfresco:acs-packaging:$alfrescoBomVersion") + baseAlfrescoWar 'org.alfresco:content-services@war' +} diff --git a/2share/23.1/community-23.1.0/overload.gradle b/2share/23.1/community-23.1.0/overload.gradle new file mode 100644 index 00000000..191c83de --- /dev/null +++ b/2share/23.1/community-23.1.0/overload.gradle @@ -0,0 +1,16 @@ +ext { + share = [ + version: [ + major: 23, + minor: 1, + rev: 0, + label: 1 + ], + flavor: 'community' + ] +} + +dependencies { + baseShareWar 'org.alfresco:share:23.1.1.2@war' +} + diff --git a/2share/23.2/community-23.2.0/overload.gradle b/2share/23.2/community-23.2.0/overload.gradle new file mode 100644 index 00000000..7e78ef01 --- /dev/null +++ b/2share/23.2/community-23.2.0/overload.gradle @@ -0,0 +1,16 @@ +ext { + share = [ + version: [ + major: 23, + minor: 2, + rev: 0, + label: 1 + ], + flavor: 'community' + ] +} + +dependencies { + baseShareWar 'org.alfresco:share:23.2.0.72@war' +} + diff --git a/Changelog.md b/Changelog.md index 0c0828a1..ef36eed9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). * [PR #110](https://github.com/xenit-eu/docker-alfresco/pull/110) XM2C-81 fix alfresco environment and default system properties ### Added - +* [PR #208](https://xenitsupport.jira.com/browse/DOCKER-450) DOCKER-450 Add Alfresco V23.1 & V23.2 support * [PR #98](https://github.com/xenit-eu/docker-alfresco/pull/98) XM2C-43 Merge docker-share into docker-alfresco * [PR #88](https://github.com/xenit-eu/docker-alfresco/pull/88) DOCKER-415 Add a healthcheck for Alfresco * [PR #86](https://github.com/xenit-eu/docker-alfresco/pull/86) DOCKER-414 Fix alf_data content store permissions diff --git a/build.gradle b/build.gradle index bf2e457c..7042dfa1 100644 --- a/build.gradle +++ b/build.gradle @@ -65,6 +65,11 @@ String getTomcatProject(majorVersion) { return ":tomcat-base:tomcat-embedded-9" } + if (majorVersion == 23) { + println 'tomcat-embedded-10' + return ":tomcat-base:tomcat-embedded-10" + } + return null } @@ -100,3 +105,15 @@ subprojects { } } } + +// Remove when Alfresco V7.X support is dropped. +project(":tomcat-base:tomcat-embedded-8.5") { + sonarqube { + skipProject = true + } +} +project(":tomcat-base:tomcat-embedded-9") { + sonarqube { + skipProject = true + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 17a20bf2..e9ee08d7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,8 @@ rootProject.name = 'docker-alfresco' - include ':tomcat-base' include ':tomcat-base:tomcat-embedded-8.5' include ':tomcat-base:tomcat-embedded-9' +include ':tomcat-base:tomcat-embedded-10' include ':1alfresco-skeleton' include ':1alfresco-skeleton:6.1' include ':1alfresco-skeleton:6.2' @@ -11,6 +11,8 @@ include ':1alfresco-skeleton:7.1' include ':1alfresco-skeleton:7.2' include ':1alfresco-skeleton:7.3' include ':1alfresco-skeleton:7.4' +include ':1alfresco-skeleton:23.1' +include ':1alfresco-skeleton:23.2' include ':2repository' include ':1share-skeleton' include ':1share-skeleton:6.1' @@ -20,19 +22,26 @@ include ':1share-skeleton:7.1' include ':1share-skeleton:7.2' include ':1share-skeleton:7.3' include ':1share-skeleton:7.4' +include ':1share-skeleton:23.1' +include ':1share-skeleton:23.2' include ':2share' def includeRepoProject(String flavor, String version) { def projectName = ":2repository:${flavor}-$version" include projectName - project(projectName).projectDir = file("2repository/${version.substring(0,3)}/${flavor}-$version") + project(projectName).projectDir = file("2repository/${version.substring(0,getSecondDotPosition(version))}/${flavor}-$version") } def includeShareProject(String flavor, String version) { def projectName = ":2share:${flavor}-$version" include projectName - project(projectName).projectDir = file("2share/${version.substring(0,3)}/${flavor}-$version") + project(projectName).projectDir = file("2share/${version.substring(0,getSecondDotPosition(version))}/${flavor}-$version") +} + +def getSecondDotPosition(String version) { + return version.split(/\./)[0].length() + 1 + version.split(/\./)[1].length() } + if (includeCommunity == 'true') { includeRepoProject('community', '6.1.2-ga') includeRepoProject('community', '6.2.0-ga') @@ -41,6 +50,8 @@ if (includeCommunity == 'true') { includeRepoProject('community', '7.2.0') includeRepoProject('community', '7.3.0') includeRepoProject('community', '7.4.0') + includeRepoProject('community', '23.1.0') + includeRepoProject('community', '23.2.0') includeShareProject('community', '6.1.0') includeShareProject('community', '6.2.2') @@ -49,6 +60,8 @@ if (includeCommunity == 'true') { includeShareProject('community', '7.2.1') includeShareProject('community', '7.3.0') includeShareProject('community', '7.4.0') + includeShareProject('community', '23.1.0') + includeShareProject('community', '23.2.0') } if (includeEnterprise == 'true') { @@ -59,4 +72,6 @@ if (includeEnterprise == 'true') { includeRepoProject('enterprise', '7.2.0') includeRepoProject('enterprise', '7.3.0') includeRepoProject('enterprise', '7.4.0') + includeRepoProject('enterprise', '23.1.0') + includeRepoProject('enterprise', '23.2.0') } diff --git a/tomcat-base/build.gradle b/tomcat-base/build.gradle index 3a503111..b6bcd69f 100644 --- a/tomcat-base/build.gradle +++ b/tomcat-base/build.gradle @@ -5,7 +5,6 @@ subprojects { apply plugin: 'eu.xenit.docker' apply plugin: 'java' apply plugin: "maven-publish" - apply from: "${rootProject.projectDir}/jacoco.gradle" if (new File("${project.projectDir}/overload.gradle").exists()) { @@ -17,21 +16,31 @@ subprojects { configurations { sharedLibs } + // This can be deleted when support for Alfresco V7.X is dropped. + if (!tomcatVersion.contains("10")) { + java { + withJavadocJar() + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + + } + }else{ + java { + withJavadocJar() + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 - java { - withJavadocJar() - withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + } } ext { - jsonLoggingVersion = '0.0.7' + jsonLoggingVersion = '0.0.8' } dependencies { - compileOnly "org.projectlombok:lombok:1.18.28" - annotationProcessor "org.projectlombok:lombok:1.18.28" - + compileOnly "org.projectlombok:lombok:1.18.32" + annotationProcessor "org.projectlombok:lombok:1.18.32" implementation "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}" implementation "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}" implementation "org.apache.tomcat:tomcat-jasper:${tomcatVersion}" @@ -62,6 +71,7 @@ subprojects { main { java { srcDir file("$project.parent.projectDir/src/shared/main/java") + srcDir file("$project.projectDir/src/shared/main/java") } } test { @@ -84,7 +94,12 @@ subprojects { } createDockerFile { - from 'docker.io/eclipse-temurin:11' + if (!tomcatVersion.contains("10")) { + from 'docker.io/eclipse-temurin:11' + } + else{ + from 'docker.io/eclipse-temurin:17-jre' + } smartCopy configurations.sharedLibs, '/usr/local/tomcat/shared/lib/' smartCopy "${project.parent.projectDir}/src/shared/main/resources/keystore", '/keystore' smartCopy configurations.runtimeClasspath, '/app/tomcat-embedded/lib' diff --git a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java b/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java index 5ea55ca2..f8a629c2 100644 --- a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java +++ b/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java @@ -14,6 +14,7 @@ import java.nio.file.Paths; import java.util.Properties; import java.util.logging.Logger; +import org.apache.tomcat.util.net.SSLHostConfigCertificate; public class AlfrescoTomcatFactoryHelper { @@ -66,9 +67,16 @@ public static void createSSLConnector(Tomcat tomcat, AlfrescoConfiguration alfre ); SSLHostConfig sslHostConfig = new SSLHostConfig(); - sslHostConfig.setCertificateKeystoreFile(alfrescoConfiguration.getTomcatSSLKeystore()); - sslHostConfig.setCertificateKeystorePassword(alfrescoConfiguration.getTomcatSSLKeystorePassword()); - sslHostConfig.setCertificateKeystoreType("JCEKS"); + // This is deprecated in Tomcat 9 and deleted from Tomcat V10.1! +// sslHostConfig.setCertificateKeystoreFile(alfrescoConfiguration.getTomcatSSLKeystore()); +// sslHostConfig.setCertificateKeystorePassword(alfrescoConfiguration.getTomcatSSLKeystorePassword()); +// sslHostConfig.setCertificateKeystoreType("JCEKS"); + SSLHostConfigCertificate sslHostConfigCertificate = new SSLHostConfigCertificate(sslHostConfig, SSLHostConfigCertificate.Type.UNDEFINED); + sslHostConfigCertificate.setCertificateKeystoreFile(alfrescoConfiguration.getTomcatSSLKeystore()); + sslHostConfigCertificate.setCertificateKeystorePassword(alfrescoConfiguration.getTomcatSSLKeystorePassword()); + sslHostConfigCertificate.setCertificateKeystoreType("JCEKS"); + + sslHostConfig.addCertificate(sslHostConfigCertificate); sslHostConfig.setTruststoreFile(alfrescoConfiguration.getTomcatSSLTruststore()); sslHostConfig.setTruststorePassword(alfrescoConfiguration.getTomcatSSLTruststorePassword()); sslHostConfig.setTruststoreType("JCEKS"); diff --git a/tomcat-base/tomcat-embedded-10/overload.gradle b/tomcat-base/tomcat-embedded-10/overload.gradle new file mode 100644 index 00000000..85b9c9d9 --- /dev/null +++ b/tomcat-base/tomcat-embedded-10/overload.gradle @@ -0,0 +1,5 @@ +ext { + tomcat = [ + version: '10.1.23' + ] +} \ No newline at end of file diff --git a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-10/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java similarity index 98% rename from tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java rename to tomcat-base/tomcat-embedded-10/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java index b1ce96f0..21e3b6e4 100644 --- a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java +++ b/tomcat-base/tomcat-embedded-10/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java @@ -1,7 +1,7 @@ package eu.xenit.alfresco.tomcat.embedded.tomcat; import eu.xenit.alfresco.tomcat.embedded.config.TomcatConfiguration; -import eu.xenit.logging.json.valve.JsonAccessLogValve; +import eu.xenit.logging.json.valve.JsonAccessLogValve10; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Service; @@ -108,7 +108,7 @@ private void addWebapp(Tomcat tomcat, Path path) { ctx.addLifecycleListener(lifecycleListener); if (getConfiguration().isAccessLogging()) { - JsonAccessLogValve valve = new JsonAccessLogValve(); + JsonAccessLogValve10 valve = new JsonAccessLogValve10(); ctx.addValve(valve); ctx.getAccessLog(); } diff --git a/tomcat-base/tomcat-embedded-8.5/overload.gradle b/tomcat-base/tomcat-embedded-8.5/overload.gradle index 75219e70..f6c2f5ef 100644 --- a/tomcat-base/tomcat-embedded-8.5/overload.gradle +++ b/tomcat-base/tomcat-embedded-8.5/overload.gradle @@ -2,4 +2,4 @@ ext { tomcat = [ version: '8.5.78' ] -} +} \ No newline at end of file diff --git a/tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java new file mode 100644 index 00000000..16817d77 --- /dev/null +++ b/tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java @@ -0,0 +1,153 @@ +package eu.xenit.alfresco.tomcat.embedded.tomcat; + +import eu.xenit.alfresco.tomcat.embedded.config.TomcatConfiguration; +import eu.xenit.logging.json.valve.JsonAccessLogValve85; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.LifecycleListener; +import org.apache.catalina.Service; +import org.apache.catalina.WebResourceRoot; +import org.apache.catalina.connector.Connector; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.webresources.DirResourceSet; +import org.apache.catalina.webresources.StandardRoot; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.stream.Stream; + +import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.redirectLog4j; + +public class TomcatFactory { + + private final TomcatConfiguration configuration; + + public TomcatFactory(TomcatConfiguration configuration) { + this.configuration = configuration; + } + + public static Connector getConnector(Tomcat tomcat, String protocol, int port, boolean sslEnabled, String scheme, int maxThreads, int maxHttpHeaderSize, String relaxedPathChars, String relaxedQueryChars) { + Connector connector = new Connector(protocol); + connector.setPort(port); + connector.setProperty("connectionTimeout", "240000"); + connector.setURIEncoding(StandardCharsets.UTF_8.name()); + connector.setProperty("SSLEnabled", String.valueOf(sslEnabled)); + connector.setProperty("maxThreads", String.valueOf(maxThreads)); + connector.setProperty("maxHttpHeaderSize", String.valueOf(maxHttpHeaderSize)); + connector.setProperty("relaxedPathChars", relaxedPathChars); + connector.setProperty("relaxedQueryChars", relaxedQueryChars); + connector.setScheme(scheme); + Service service = tomcat.getService(); + service.setContainer(tomcat.getEngine()); + connector.setService(service); + return connector; + } + + private TomcatConfiguration getConfiguration() { + return configuration; + } + + public Tomcat getTomcat() throws IOException { + Tomcat tomcat = new Tomcat(); + tomcat.setBaseDir(getConfiguration().getTomcatBaseDir()); + tomcat.setPort(getConfiguration().getTomcatPort()); + tomcat.getServer().setPort(getConfiguration().getTomcatServerPort()); + createDefaultConnector(tomcat); + addUserWithRole(tomcat, "CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repoclient"); + addUserWithRole(tomcat, "CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repository"); + Path webapps = Paths.get(getConfiguration().getWebappsPath()); + if (Files.exists(webapps)) { + try (var directoryStream = Files.newDirectoryStream(webapps)) { + directoryStream.forEach(path -> addWebapp(tomcat, path)); + } + } + return tomcat; + } + + protected boolean isEmptyDir(Path path) { + if (Files.isDirectory(path)) { + try (Stream entries = Files.list(path)) { + return entries.findFirst().isEmpty(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + return false; + } + + private void addWebapp(Tomcat tomcat, Path path) { + if (isEmptyDir(path)) { + // Our gradle plugin adds a share directory, even when baseShareWar is not configured + return; + } + if (Files.isDirectory(path)) { + String contextPath = "/" + path.getFileName().toString(); + String absolutePath = path.toAbsolutePath().toString(); + StandardContext ctx = (StandardContext) tomcat.addWebapp(contextPath, absolutePath); + ctx.setParentClassLoader(Thread.currentThread().getContextClassLoader()); + LifecycleListener lifecycleListener = event -> { + if (event.getType().equals("before_start")) { + WebResourceRoot resources = new StandardRoot(ctx); + resources.setCacheMaxSize(getConfiguration().getTomcatCacheMaxSize()); + resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getSharedClasspathDir(), "/")); + resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getGeneratedClasspathDir(), "/")); + resources.addJarResources(new DirResourceSet(resources, "/WEB-INF/lib", getConfiguration().getSharedLibDir(), "/")); + if (getConfiguration().isJsonLogging()) { + redirectLog4j(path, Paths.get(configuration.getGeneratedClasspathDir())); + } + ctx.setResources(resources); + } + if (getConfiguration().isExitOnFailure() && event.getType().equals("after_stop")) { + stopTomcat(tomcat); + } + }; + ctx.addLifecycleListener(lifecycleListener); + + if (getConfiguration().isAccessLogging()) { + JsonAccessLogValve85 valve = new JsonAccessLogValve85(); + ctx.addValve(valve); + ctx.getAccessLog(); + } + } + } + + private void createDefaultConnector(Tomcat tomcat) { + Connector connector = getConnector(tomcat, + "HTTP/1.1", + getConfiguration().getTomcatPort(), + false, + "http", + getConfiguration().getTomcatMaxThreads(), + getConfiguration().getTomcatMaxHttpHeaderSize(), + getConfiguration().getTomcatRelaxedPathChars(), + getConfiguration().getTomcatRelaxedQueryChars() + ); + connector.setRedirectPort(getConfiguration().getTomcatSslPort()); + tomcat.setConnector(connector); + } + + private void addUserWithRole(Tomcat tomcat, String username, String password, String role) { + tomcat.addUser(username, password); + tomcat.addRole(username, role); + } + + + private void stopTomcat(Tomcat tomcat) { + Thread thread = new Thread(() -> { + try { + tomcat.stop(); + tomcat.destroy(); + } catch (LifecycleException e) { + e.printStackTrace(); + } + }); + thread.start(); + + } + + +} \ No newline at end of file diff --git a/tomcat-base/tomcat-embedded-9/overload.gradle b/tomcat-base/tomcat-embedded-9/overload.gradle index 7e93e153..7ff2f22c 100644 --- a/tomcat-base/tomcat-embedded-9/overload.gradle +++ b/tomcat-base/tomcat-embedded-9/overload.gradle @@ -2,10 +2,4 @@ ext { tomcat = [ version: '9.0.59' ] -} - -sonarqube { - properties { - property 'sonar.projectBaseDir', "$project.parent.projectDir/src/shared/" - } } \ No newline at end of file diff --git a/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java new file mode 100644 index 00000000..16817d77 --- /dev/null +++ b/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java @@ -0,0 +1,153 @@ +package eu.xenit.alfresco.tomcat.embedded.tomcat; + +import eu.xenit.alfresco.tomcat.embedded.config.TomcatConfiguration; +import eu.xenit.logging.json.valve.JsonAccessLogValve85; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.LifecycleListener; +import org.apache.catalina.Service; +import org.apache.catalina.WebResourceRoot; +import org.apache.catalina.connector.Connector; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.webresources.DirResourceSet; +import org.apache.catalina.webresources.StandardRoot; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.stream.Stream; + +import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.redirectLog4j; + +public class TomcatFactory { + + private final TomcatConfiguration configuration; + + public TomcatFactory(TomcatConfiguration configuration) { + this.configuration = configuration; + } + + public static Connector getConnector(Tomcat tomcat, String protocol, int port, boolean sslEnabled, String scheme, int maxThreads, int maxHttpHeaderSize, String relaxedPathChars, String relaxedQueryChars) { + Connector connector = new Connector(protocol); + connector.setPort(port); + connector.setProperty("connectionTimeout", "240000"); + connector.setURIEncoding(StandardCharsets.UTF_8.name()); + connector.setProperty("SSLEnabled", String.valueOf(sslEnabled)); + connector.setProperty("maxThreads", String.valueOf(maxThreads)); + connector.setProperty("maxHttpHeaderSize", String.valueOf(maxHttpHeaderSize)); + connector.setProperty("relaxedPathChars", relaxedPathChars); + connector.setProperty("relaxedQueryChars", relaxedQueryChars); + connector.setScheme(scheme); + Service service = tomcat.getService(); + service.setContainer(tomcat.getEngine()); + connector.setService(service); + return connector; + } + + private TomcatConfiguration getConfiguration() { + return configuration; + } + + public Tomcat getTomcat() throws IOException { + Tomcat tomcat = new Tomcat(); + tomcat.setBaseDir(getConfiguration().getTomcatBaseDir()); + tomcat.setPort(getConfiguration().getTomcatPort()); + tomcat.getServer().setPort(getConfiguration().getTomcatServerPort()); + createDefaultConnector(tomcat); + addUserWithRole(tomcat, "CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repoclient"); + addUserWithRole(tomcat, "CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repository"); + Path webapps = Paths.get(getConfiguration().getWebappsPath()); + if (Files.exists(webapps)) { + try (var directoryStream = Files.newDirectoryStream(webapps)) { + directoryStream.forEach(path -> addWebapp(tomcat, path)); + } + } + return tomcat; + } + + protected boolean isEmptyDir(Path path) { + if (Files.isDirectory(path)) { + try (Stream entries = Files.list(path)) { + return entries.findFirst().isEmpty(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + return false; + } + + private void addWebapp(Tomcat tomcat, Path path) { + if (isEmptyDir(path)) { + // Our gradle plugin adds a share directory, even when baseShareWar is not configured + return; + } + if (Files.isDirectory(path)) { + String contextPath = "/" + path.getFileName().toString(); + String absolutePath = path.toAbsolutePath().toString(); + StandardContext ctx = (StandardContext) tomcat.addWebapp(contextPath, absolutePath); + ctx.setParentClassLoader(Thread.currentThread().getContextClassLoader()); + LifecycleListener lifecycleListener = event -> { + if (event.getType().equals("before_start")) { + WebResourceRoot resources = new StandardRoot(ctx); + resources.setCacheMaxSize(getConfiguration().getTomcatCacheMaxSize()); + resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getSharedClasspathDir(), "/")); + resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getGeneratedClasspathDir(), "/")); + resources.addJarResources(new DirResourceSet(resources, "/WEB-INF/lib", getConfiguration().getSharedLibDir(), "/")); + if (getConfiguration().isJsonLogging()) { + redirectLog4j(path, Paths.get(configuration.getGeneratedClasspathDir())); + } + ctx.setResources(resources); + } + if (getConfiguration().isExitOnFailure() && event.getType().equals("after_stop")) { + stopTomcat(tomcat); + } + }; + ctx.addLifecycleListener(lifecycleListener); + + if (getConfiguration().isAccessLogging()) { + JsonAccessLogValve85 valve = new JsonAccessLogValve85(); + ctx.addValve(valve); + ctx.getAccessLog(); + } + } + } + + private void createDefaultConnector(Tomcat tomcat) { + Connector connector = getConnector(tomcat, + "HTTP/1.1", + getConfiguration().getTomcatPort(), + false, + "http", + getConfiguration().getTomcatMaxThreads(), + getConfiguration().getTomcatMaxHttpHeaderSize(), + getConfiguration().getTomcatRelaxedPathChars(), + getConfiguration().getTomcatRelaxedQueryChars() + ); + connector.setRedirectPort(getConfiguration().getTomcatSslPort()); + tomcat.setConnector(connector); + } + + private void addUserWithRole(Tomcat tomcat, String username, String password, String role) { + tomcat.addUser(username, password); + tomcat.addRole(username, role); + } + + + private void stopTomcat(Tomcat tomcat) { + Thread thread = new Thread(() -> { + try { + tomcat.stop(); + tomcat.destroy(); + } catch (LifecycleException e) { + e.printStackTrace(); + } + }); + thread.start(); + + } + + +} \ No newline at end of file From d1425b8bc19a7860961d526714a0b200081d0bb8 Mon Sep 17 00:00:00 2001 From: Benjamin Van der Smissen Date: Mon, 27 May 2024 13:53:09 +0200 Subject: [PATCH 2/4] DOCKER-450 [Ignore] tomcate-base:tomcat-embedded-X code for review. * Normally this code belongs with the tomcat-base code and does not trigger issues. * TomcatFactory.java can be set back into tomcat-base as soon as Alfresco V7.X is dropped. --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 7042dfa1..fa287a5c 100644 --- a/build.gradle +++ b/build.gradle @@ -116,4 +116,9 @@ project(":tomcat-base:tomcat-embedded-9") { sonarqube { skipProject = true } +} +project(":tomcat-base:tomcat-embedded-10") { + sonarqube { + skipProject = true + } } \ No newline at end of file From c274d27bf77d73cef77b1300a1038676feb3533e Mon Sep 17 00:00:00 2001 From: Benjamin Van der Smissen Date: Fri, 31 May 2024 11:21:17 +0200 Subject: [PATCH 3/4] DOCKER-450 [Update] postgres v13 to v15 official image * [Remove] jackson library --- 2repository/23.1/community-23.1.0/overload.gradle | 3 +-- 2repository/23.1/enterprise-23.1.0/overload.gradle | 2 +- 2repository/23.2/community-23.2.0/overload.gradle | 2 +- 2repository/23.2/enterprise-23.2.0/overload.gradle | 2 +- tomcat-base/build.gradle | 1 - .../embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java | 4 ---- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/2repository/23.1/community-23.1.0/overload.gradle b/2repository/23.1/community-23.1.0/overload.gradle index 1011ea20..00383301 100644 --- a/2repository/23.1/community-23.1.0/overload.gradle +++ b/2repository/23.1/community-23.1.0/overload.gradle @@ -10,8 +10,7 @@ ext { ] solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' shareimage = 'docker.io/xenit/alfresco-share-community:23.1.0' -// 13,14,15 are supported - psqlimage = 'docker.io/xenit/postgres:13' + psqlimage = 'postgres:15' tests = true alfrescoBomVersion='23.1.0' } diff --git a/2repository/23.1/enterprise-23.1.0/overload.gradle b/2repository/23.1/enterprise-23.1.0/overload.gradle index 4dd0d7d6..30ef53af 100644 --- a/2repository/23.1/enterprise-23.1.0/overload.gradle +++ b/2repository/23.1/enterprise-23.1.0/overload.gradle @@ -10,7 +10,7 @@ ext { ] solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' shareimage = 'docker.io/xenit/alfresco-share-community:23.1.0' - psqlimage = 'docker.io/xenit/postgres:13' + psqlimage = 'postgres:15' tests = true alfrescoBomVersion = '23.1.0' } diff --git a/2repository/23.2/community-23.2.0/overload.gradle b/2repository/23.2/community-23.2.0/overload.gradle index d3221184..fc6c4a0e 100644 --- a/2repository/23.2/community-23.2.0/overload.gradle +++ b/2repository/23.2/community-23.2.0/overload.gradle @@ -10,7 +10,7 @@ ext { ] solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' shareimage = 'docker.io/xenit/alfresco-share-community:23.2.0' - psqlimage = 'docker.io/xenit/postgres:13' + psqlimage = 'postgres:15' tests = true alfrescoBomVersion='23.2.0' } diff --git a/2repository/23.2/enterprise-23.2.0/overload.gradle b/2repository/23.2/enterprise-23.2.0/overload.gradle index 516d4ed7..a9da5edd 100644 --- a/2repository/23.2/enterprise-23.2.0/overload.gradle +++ b/2repository/23.2/enterprise-23.2.0/overload.gradle @@ -10,7 +10,7 @@ ext { ] solrimage = 'docker.io/xenit/alfresco-solr6:2.0.8.2' shareimage = 'docker.io/xenit/alfresco-share-community:23.2.0' - psqlimage = 'docker.io/xenit/postgres:13' + psqlimage = 'postgres:15' tests = true alfrescoBomVersion = '23.2.0' } diff --git a/tomcat-base/build.gradle b/tomcat-base/build.gradle index b6bcd69f..883a1c8d 100644 --- a/tomcat-base/build.gradle +++ b/tomcat-base/build.gradle @@ -47,7 +47,6 @@ subprojects { implementation "org.apache.tomcat:tomcat-jasper-el:${tomcatVersion}" implementation "org.apache.tomcat:tomcat-jsp-api:${tomcatVersion}" implementation "eu.xenit.logging:json-logging:${jsonLoggingVersion}" - implementation "com.fasterxml.jackson.core:jackson-databind:2.15.3" testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0" testImplementation("org.junit-pioneer:junit-pioneer:2.1.0") testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0" diff --git a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java b/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java index f8a629c2..77d7aa23 100644 --- a/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java +++ b/tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/alfresco/tomcat/AlfrescoTomcatFactoryHelper.java @@ -67,10 +67,6 @@ public static void createSSLConnector(Tomcat tomcat, AlfrescoConfiguration alfre ); SSLHostConfig sslHostConfig = new SSLHostConfig(); - // This is deprecated in Tomcat 9 and deleted from Tomcat V10.1! -// sslHostConfig.setCertificateKeystoreFile(alfrescoConfiguration.getTomcatSSLKeystore()); -// sslHostConfig.setCertificateKeystorePassword(alfrescoConfiguration.getTomcatSSLKeystorePassword()); -// sslHostConfig.setCertificateKeystoreType("JCEKS"); SSLHostConfigCertificate sslHostConfigCertificate = new SSLHostConfigCertificate(sslHostConfig, SSLHostConfigCertificate.Type.UNDEFINED); sslHostConfigCertificate.setCertificateKeystoreFile(alfrescoConfiguration.getTomcatSSLKeystore()); sslHostConfigCertificate.setCertificateKeystorePassword(alfrescoConfiguration.getTomcatSSLKeystorePassword()); From 6cffea779f50ec356c7c5db4175dfdd52ad1725c Mon Sep 17 00:00:00 2001 From: Benjamin Van der Smissen Date: Thu, 6 Jun 2024 09:13:09 +0200 Subject: [PATCH 4/4] DOCKER-450 [Remove] Alfresco V6.1 & V6.2 Support --- .github/workflows/ci.yml | 4 +- 1alfresco-skeleton/6.1/overload.gradle | 11 - 1alfresco-skeleton/6.2/overload.gradle | 11 - .../6.1/local/share-config-custom.xml | 524 ------------------ 1share-skeleton/6.1/overload.gradle | 10 - .../6.2/local/share-config-custom.xml | 524 ------------------ 1share-skeleton/6.2/overload.gradle | 10 - .../6.1/community-6.1.2-ga/overload.gradle | 19 - .../6.1/enterprise-6.1.1/overload.gradle | 24 - .../6.2/community-6.2.0-ga/overload.gradle | 19 - .../6.2/enterprise-6.2.2/overload.gradle | 23 - 2share/6.1/community-6.1.0/overload.gradle | 16 - 2share/6.2/community-6.2.2/overload.gradle | 16 - build.gradle | 9 - settings.gradle | 11 - tomcat-base/build.gradle | 2 +- .../tomcat/embedded/tomcat/TomcatFactory.java | 0 .../tomcat-embedded-8.5/overload.gradle | 5 - .../tomcat/embedded/tomcat/TomcatFactory.java | 0 .../tomcat/embedded/tomcat/TomcatFactory.java | 153 ----- 20 files changed, 3 insertions(+), 1388 deletions(-) delete mode 100644 1alfresco-skeleton/6.1/overload.gradle delete mode 100644 1alfresco-skeleton/6.2/overload.gradle delete mode 100644 1share-skeleton/6.1/local/share-config-custom.xml delete mode 100644 1share-skeleton/6.1/overload.gradle delete mode 100644 1share-skeleton/6.2/local/share-config-custom.xml delete mode 100644 1share-skeleton/6.2/overload.gradle delete mode 100644 2repository/6.1/community-6.1.2-ga/overload.gradle delete mode 100644 2repository/6.1/enterprise-6.1.1/overload.gradle delete mode 100644 2repository/6.2/community-6.2.0-ga/overload.gradle delete mode 100644 2repository/6.2/enterprise-6.2.2/overload.gradle delete mode 100644 2share/6.1/community-6.1.0/overload.gradle delete mode 100644 2share/6.2/community-6.2.2/overload.gradle rename tomcat-base/tomcat-embedded-10/src/{shared => }/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java (100%) delete mode 100644 tomcat-base/tomcat-embedded-8.5/overload.gradle rename tomcat-base/{tomcat-embedded-8.5/src/shared => tomcat-embedded-9/src}/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java (100%) delete mode 100644 tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e4762ba..d8229a4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "community-6.1.2-ga","community-6.2.0-ga","community-7.0.0", "community-7.1.1", "community-7.2.0", "community-7.3.0", "community-7.4.0", "community-23.1.0", "community-23.2.0", "enterprise-6.1.1","enterprise-6.2.2","enterprise-7.0.1", "enterprise-7.1.0", "enterprise-7.2.0", "enterprise-7.3.0", "enterprise-7.4.0", "enterprise-23.1.0", "enterprise-23.2.0" ] + version: [ "community-7.0.0", "community-7.1.1", "community-7.2.0", "community-7.3.0", "community-7.4.0", "community-23.1.0", "community-23.2.0", "enterprise-7.0.1", "enterprise-7.1.0", "enterprise-7.2.0", "enterprise-7.3.0", "enterprise-7.4.0", "enterprise-23.1.0", "enterprise-23.2.0" ] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - name: Set up JDK 17 @@ -114,4 +114,4 @@ jobs: uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2 with: cache-read-only: false - arguments: :tomcat-base:tomcat-embedded-8.5:publish :tomcat-base:tomcat-embedded-9:publish :tomcat-base:tomcat-embedded-10:publish --info -PsigningKeyId=CDE3528F \ No newline at end of file + arguments: :tomcat-base:tomcat-embedded-9:publish :tomcat-base:tomcat-embedded-10:publish --info -PsigningKeyId=CDE3528F \ No newline at end of file diff --git a/1alfresco-skeleton/6.1/overload.gradle b/1alfresco-skeleton/6.1/overload.gradle deleted file mode 100644 index c0aa5589..00000000 --- a/1alfresco-skeleton/6.1/overload.gradle +++ /dev/null @@ -1,11 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 1, - rev: 1 - ], - flavor: 'skeleton' - ] -} - diff --git a/1alfresco-skeleton/6.2/overload.gradle b/1alfresco-skeleton/6.2/overload.gradle deleted file mode 100644 index 4e23a40b..00000000 --- a/1alfresco-skeleton/6.2/overload.gradle +++ /dev/null @@ -1,11 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 2, - rev: 0 - ], - flavor: 'skeleton' - ] -} - diff --git a/1share-skeleton/6.1/local/share-config-custom.xml b/1share-skeleton/6.1/local/share-config-custom.xml deleted file mode 100644 index 3211ef8f..00000000 --- a/1share-skeleton/6.1/local/share-config-custom.xml +++ /dev/null @@ -1,524 +0,0 @@ - - - - - - - false - - - false - - - - - - - - - - production - - - - - manual - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - 1000 - - - 7000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${ALFRESCO_PROTOCOL}://${ALFRESCO_HOST}:${ALFRESCO_PORT}/${ALFRESCO_CONTEXT} - - - - - false - - - - application/vnd.openxmlformats-officedocument.wordprocessingml.document - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - application/vnd.ms-powerpoint - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - location.path.documents - - slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&max={maximumFolderCountSite} - - - - - - - - alfresco://company/home - - - - false - - - 500 - - - - true - - - - - - - - secret - - ALFRESCO.ORG - - HTTP/repository.server.com@ALFRESCO.ORG - - ShareHTTP - - true - - - - - - - - - - alfresco-noauth - Alfresco - unauthenticated access - Access to Alfresco Repository WebScripts that do not require authentication - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - none - - - - alfresco - Alfresco - user access - Access to Alfresco Repository WebScripts that require user authentication - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - user - - - - alfresco-feed - Alfresco Feed - Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet - http - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - true - user - - - - alfresco-api - alfresco - Alfresco Public API - user access - Access to Alfresco Repository Public API that require user authentication. - This makes use of the authentication that is provided by parent 'alfresco' endpoint. - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/api - user - - - - - - - - 2 - 8 - false - - - false - - - - - - - - - - - - diff --git a/1share-skeleton/6.1/overload.gradle b/1share-skeleton/6.1/overload.gradle deleted file mode 100644 index 994d7674..00000000 --- a/1share-skeleton/6.1/overload.gradle +++ /dev/null @@ -1,10 +0,0 @@ -ext { - share = [ - version: [ - major: 6, - minor: 1, - rev: 0 - ], - flavor: 'skeleton' - ] -} \ No newline at end of file diff --git a/1share-skeleton/6.2/local/share-config-custom.xml b/1share-skeleton/6.2/local/share-config-custom.xml deleted file mode 100644 index 3211ef8f..00000000 --- a/1share-skeleton/6.2/local/share-config-custom.xml +++ /dev/null @@ -1,524 +0,0 @@ - - - - - - - false - - - false - - - - - - - - - - production - - - - - manual - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - 1000 - - - 7000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${ALFRESCO_PROTOCOL}://${ALFRESCO_HOST}:${ALFRESCO_PORT}/${ALFRESCO_CONTEXT} - - - - - false - - - - application/vnd.openxmlformats-officedocument.wordprocessingml.document - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - application/vnd.ms-powerpoint - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - location.path.documents - - slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&max={maximumFolderCountSite} - - - - - - - - alfresco://company/home - - - - false - - - 500 - - - - true - - - - - - - - secret - - ALFRESCO.ORG - - HTTP/repository.server.com@ALFRESCO.ORG - - ShareHTTP - - true - - - - - - - - - - alfresco-noauth - Alfresco - unauthenticated access - Access to Alfresco Repository WebScripts that do not require authentication - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - none - - - - alfresco - Alfresco - user access - Access to Alfresco Repository WebScripts that require user authentication - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - user - - - - alfresco-feed - Alfresco Feed - Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet - http - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/s - true - user - - - - alfresco-api - alfresco - Alfresco Public API - user access - Access to Alfresco Repository Public API that require user authentication. - This makes use of the authentication that is provided by parent 'alfresco' endpoint. - alfresco - ${ALFRESCO_INTERNAL_PROTOCOL}://${ALFRESCO_INTERNAL_HOST}:${ALFRESCO_INTERNAL_PORT}/${ALFRESCO_INTERNAL_CONTEXT}/api - user - - - - - - - - 2 - 8 - false - - - false - - - - - - - - - - - - diff --git a/1share-skeleton/6.2/overload.gradle b/1share-skeleton/6.2/overload.gradle deleted file mode 100644 index 085e7f6c..00000000 --- a/1share-skeleton/6.2/overload.gradle +++ /dev/null @@ -1,10 +0,0 @@ -ext { - share = [ - version: [ - major: 6, - minor: 2, - rev: 0 - ], - flavor: 'skeleton' - ] -} \ No newline at end of file diff --git a/2repository/6.1/community-6.1.2-ga/overload.gradle b/2repository/6.1/community-6.1.2-ga/overload.gradle deleted file mode 100644 index 7010133c..00000000 --- a/2repository/6.1/community-6.1.2-ga/overload.gradle +++ /dev/null @@ -1,19 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 1, - rev : '2-ga' - ], - flavor : 'community' - ] - solrimage = 'docker.io/xenit/alfresco-solr6:1.3.0.1' - shareimage = 'docker.io/xenit/alfresco-share-community:6.1.0.2' - psqlimage = 'docker.io/xenit/postgres:11' - tests = true -} - -dependencies { - alfrescoAmp 'org.alfresco:alfresco-share-services:6.1.1.4@amp' - baseAlfrescoWar 'org.alfresco:content-services-community:6.1.2-ga@war' -} diff --git a/2repository/6.1/enterprise-6.1.1/overload.gradle b/2repository/6.1/enterprise-6.1.1/overload.gradle deleted file mode 100644 index 90d5d6e0..00000000 --- a/2repository/6.1/enterprise-6.1.1/overload.gradle +++ /dev/null @@ -1,24 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 1, - rev : 1, - label: 11 - ], - flavor : 'enterprise' - ] - solrimage = 'docker.io/xenit/alfresco-solr6:1.3.0.1' - shareimage = 'docker.io/xenit/alfresco-share-community:6.1.0.2' - psqlimage = 'docker.io/xenit/postgres:11' - tests = true - alfrescoBomVersion = '6.1.1.11' -} - -dependencies { - alfrescoAmp platform("org.alfresco:acs-packaging:$alfrescoBomVersion") - alfrescoAmp 'org.alfresco:alfresco-share-services@amp' - baseAlfrescoWar platform("org.alfresco:acs-packaging:$alfrescoBomVersion") - baseAlfrescoWar 'org.alfresco:content-services@war' -} - diff --git a/2repository/6.2/community-6.2.0-ga/overload.gradle b/2repository/6.2/community-6.2.0-ga/overload.gradle deleted file mode 100644 index a88d0b8c..00000000 --- a/2repository/6.2/community-6.2.0-ga/overload.gradle +++ /dev/null @@ -1,19 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 2, - rev : '0-ga' - ], - flavor : 'community' - ] - solrimage = 'docker.io/xenit/alfresco-solr6:1.4.0' - shareimage = 'docker.io/xenit/alfresco-share-community:6.2.0' - psqlimage = 'docker.io/xenit/postgres:11.7' - tests = true -} - -dependencies { - alfrescoAmp 'org.alfresco:alfresco-share-services:6.2.2.7@amp' - baseAlfrescoWar 'org.alfresco:content-services-community:6.2.0-ga@war' -} diff --git a/2repository/6.2/enterprise-6.2.2/overload.gradle b/2repository/6.2/enterprise-6.2.2/overload.gradle deleted file mode 100644 index d02553c0..00000000 --- a/2repository/6.2/enterprise-6.2.2/overload.gradle +++ /dev/null @@ -1,23 +0,0 @@ -ext { - alfresco = [ - version: [ - major: 6, - minor: 2, - rev : 2, - label: 25 - ], - flavor : 'enterprise' - ] - solrimage = 'docker.io/xenit/alfresco-solr6:2.0.1' - shareimage = 'docker.io/xenit/alfresco-share-community:6.2.0' - psqlimage = 'docker.io/xenit/postgres:11.7' - tests = true - alfrescoBomVersion = '6.2.2.25' -} - -dependencies { - alfrescoAmp platform("org.alfresco:acs-packaging:$alfrescoBomVersion") - alfrescoAmp 'org.alfresco:alfresco-share-services@amp' - baseAlfrescoWar platform("org.alfresco:acs-packaging:$alfrescoBomVersion") - baseAlfrescoWar 'org.alfresco:content-services@war' -} \ No newline at end of file diff --git a/2share/6.1/community-6.1.0/overload.gradle b/2share/6.1/community-6.1.0/overload.gradle deleted file mode 100644 index 4a7a4489..00000000 --- a/2share/6.1/community-6.1.0/overload.gradle +++ /dev/null @@ -1,16 +0,0 @@ -ext { - share = [ - version: [ - major: 6, - minor: 1, - rev: '1', - label: '4' - ], - flavor: 'community' - ] -} - -dependencies { - baseShareWar 'org.alfresco:share:6.1.1.4@war' -} - diff --git a/2share/6.2/community-6.2.2/overload.gradle b/2share/6.2/community-6.2.2/overload.gradle deleted file mode 100644 index 6154b77a..00000000 --- a/2share/6.2/community-6.2.2/overload.gradle +++ /dev/null @@ -1,16 +0,0 @@ -ext { - share = [ - version: [ - major: 6, - minor: 2, - rev: '2', - label: '7' - ], - flavor: 'community' - ] -} - -dependencies { - baseShareWar 'org.alfresco:share:6.2.2.7@war' -} - diff --git a/build.gradle b/build.gradle index fa287a5c..957c4c5d 100644 --- a/build.gradle +++ b/build.gradle @@ -55,10 +55,6 @@ def calcRepository(flavor, isAlfresco) { String getTomcatProject(majorVersion) { println "major version used : ${majorVersion}" - if (majorVersion == 6) { - println 'tomcat-embedded-8.5' - return ":tomcat-base:tomcat-embedded-8.5" - } if (majorVersion == 7) { println 'tomcat-embedded-9' @@ -107,11 +103,6 @@ subprojects { } // Remove when Alfresco V7.X support is dropped. -project(":tomcat-base:tomcat-embedded-8.5") { - sonarqube { - skipProject = true - } -} project(":tomcat-base:tomcat-embedded-9") { sonarqube { skipProject = true diff --git a/settings.gradle b/settings.gradle index e9ee08d7..9ab473b0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1,8 @@ rootProject.name = 'docker-alfresco' include ':tomcat-base' -include ':tomcat-base:tomcat-embedded-8.5' include ':tomcat-base:tomcat-embedded-9' include ':tomcat-base:tomcat-embedded-10' include ':1alfresco-skeleton' -include ':1alfresco-skeleton:6.1' -include ':1alfresco-skeleton:6.2' include ':1alfresco-skeleton:7.0' include ':1alfresco-skeleton:7.1' include ':1alfresco-skeleton:7.2' @@ -15,8 +12,6 @@ include ':1alfresco-skeleton:23.1' include ':1alfresco-skeleton:23.2' include ':2repository' include ':1share-skeleton' -include ':1share-skeleton:6.1' -include ':1share-skeleton:6.2' include ':1share-skeleton:7.0' include ':1share-skeleton:7.1' include ':1share-skeleton:7.2' @@ -43,8 +38,6 @@ def getSecondDotPosition(String version) { if (includeCommunity == 'true') { - includeRepoProject('community', '6.1.2-ga') - includeRepoProject('community', '6.2.0-ga') includeRepoProject('community', '7.0.0') includeRepoProject('community', '7.1.1') includeRepoProject('community', '7.2.0') @@ -53,8 +46,6 @@ if (includeCommunity == 'true') { includeRepoProject('community', '23.1.0') includeRepoProject('community', '23.2.0') - includeShareProject('community', '6.1.0') - includeShareProject('community', '6.2.2') includeShareProject('community', '7.0.1') includeShareProject('community', '7.1.0') includeShareProject('community', '7.2.1') @@ -65,8 +56,6 @@ if (includeCommunity == 'true') { } if (includeEnterprise == 'true') { - includeRepoProject('enterprise', '6.1.1') - includeRepoProject('enterprise', '6.2.2') includeRepoProject('enterprise', '7.0.1') includeRepoProject('enterprise', '7.1.0') includeRepoProject('enterprise', '7.2.0') diff --git a/tomcat-base/build.gradle b/tomcat-base/build.gradle index 883a1c8d..9098059f 100644 --- a/tomcat-base/build.gradle +++ b/tomcat-base/build.gradle @@ -70,7 +70,7 @@ subprojects { main { java { srcDir file("$project.parent.projectDir/src/shared/main/java") - srcDir file("$project.projectDir/src/shared/main/java") + srcDir file("$project.projectDir/src/main/java") } } test { diff --git a/tomcat-base/tomcat-embedded-10/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-10/src/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java similarity index 100% rename from tomcat-base/tomcat-embedded-10/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java rename to tomcat-base/tomcat-embedded-10/src/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java diff --git a/tomcat-base/tomcat-embedded-8.5/overload.gradle b/tomcat-base/tomcat-embedded-8.5/overload.gradle deleted file mode 100644 index f6c2f5ef..00000000 --- a/tomcat-base/tomcat-embedded-8.5/overload.gradle +++ /dev/null @@ -1,5 +0,0 @@ -ext { - tomcat = [ - version: '8.5.78' - ] -} \ No newline at end of file diff --git a/tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-9/src/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java similarity index 100% rename from tomcat-base/tomcat-embedded-8.5/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java rename to tomcat-base/tomcat-embedded-9/src/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java diff --git a/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java b/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java deleted file mode 100644 index 16817d77..00000000 --- a/tomcat-base/tomcat-embedded-9/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java +++ /dev/null @@ -1,153 +0,0 @@ -package eu.xenit.alfresco.tomcat.embedded.tomcat; - -import eu.xenit.alfresco.tomcat.embedded.config.TomcatConfiguration; -import eu.xenit.logging.json.valve.JsonAccessLogValve85; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.Service; -import org.apache.catalina.WebResourceRoot; -import org.apache.catalina.connector.Connector; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.startup.Tomcat; -import org.apache.catalina.webresources.DirResourceSet; -import org.apache.catalina.webresources.StandardRoot; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.stream.Stream; - -import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.redirectLog4j; - -public class TomcatFactory { - - private final TomcatConfiguration configuration; - - public TomcatFactory(TomcatConfiguration configuration) { - this.configuration = configuration; - } - - public static Connector getConnector(Tomcat tomcat, String protocol, int port, boolean sslEnabled, String scheme, int maxThreads, int maxHttpHeaderSize, String relaxedPathChars, String relaxedQueryChars) { - Connector connector = new Connector(protocol); - connector.setPort(port); - connector.setProperty("connectionTimeout", "240000"); - connector.setURIEncoding(StandardCharsets.UTF_8.name()); - connector.setProperty("SSLEnabled", String.valueOf(sslEnabled)); - connector.setProperty("maxThreads", String.valueOf(maxThreads)); - connector.setProperty("maxHttpHeaderSize", String.valueOf(maxHttpHeaderSize)); - connector.setProperty("relaxedPathChars", relaxedPathChars); - connector.setProperty("relaxedQueryChars", relaxedQueryChars); - connector.setScheme(scheme); - Service service = tomcat.getService(); - service.setContainer(tomcat.getEngine()); - connector.setService(service); - return connector; - } - - private TomcatConfiguration getConfiguration() { - return configuration; - } - - public Tomcat getTomcat() throws IOException { - Tomcat tomcat = new Tomcat(); - tomcat.setBaseDir(getConfiguration().getTomcatBaseDir()); - tomcat.setPort(getConfiguration().getTomcatPort()); - tomcat.getServer().setPort(getConfiguration().getTomcatServerPort()); - createDefaultConnector(tomcat); - addUserWithRole(tomcat, "CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repoclient"); - addUserWithRole(tomcat, "CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repository"); - Path webapps = Paths.get(getConfiguration().getWebappsPath()); - if (Files.exists(webapps)) { - try (var directoryStream = Files.newDirectoryStream(webapps)) { - directoryStream.forEach(path -> addWebapp(tomcat, path)); - } - } - return tomcat; - } - - protected boolean isEmptyDir(Path path) { - if (Files.isDirectory(path)) { - try (Stream entries = Files.list(path)) { - return entries.findFirst().isEmpty(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - return false; - } - - private void addWebapp(Tomcat tomcat, Path path) { - if (isEmptyDir(path)) { - // Our gradle plugin adds a share directory, even when baseShareWar is not configured - return; - } - if (Files.isDirectory(path)) { - String contextPath = "/" + path.getFileName().toString(); - String absolutePath = path.toAbsolutePath().toString(); - StandardContext ctx = (StandardContext) tomcat.addWebapp(contextPath, absolutePath); - ctx.setParentClassLoader(Thread.currentThread().getContextClassLoader()); - LifecycleListener lifecycleListener = event -> { - if (event.getType().equals("before_start")) { - WebResourceRoot resources = new StandardRoot(ctx); - resources.setCacheMaxSize(getConfiguration().getTomcatCacheMaxSize()); - resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getSharedClasspathDir(), "/")); - resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getGeneratedClasspathDir(), "/")); - resources.addJarResources(new DirResourceSet(resources, "/WEB-INF/lib", getConfiguration().getSharedLibDir(), "/")); - if (getConfiguration().isJsonLogging()) { - redirectLog4j(path, Paths.get(configuration.getGeneratedClasspathDir())); - } - ctx.setResources(resources); - } - if (getConfiguration().isExitOnFailure() && event.getType().equals("after_stop")) { - stopTomcat(tomcat); - } - }; - ctx.addLifecycleListener(lifecycleListener); - - if (getConfiguration().isAccessLogging()) { - JsonAccessLogValve85 valve = new JsonAccessLogValve85(); - ctx.addValve(valve); - ctx.getAccessLog(); - } - } - } - - private void createDefaultConnector(Tomcat tomcat) { - Connector connector = getConnector(tomcat, - "HTTP/1.1", - getConfiguration().getTomcatPort(), - false, - "http", - getConfiguration().getTomcatMaxThreads(), - getConfiguration().getTomcatMaxHttpHeaderSize(), - getConfiguration().getTomcatRelaxedPathChars(), - getConfiguration().getTomcatRelaxedQueryChars() - ); - connector.setRedirectPort(getConfiguration().getTomcatSslPort()); - tomcat.setConnector(connector); - } - - private void addUserWithRole(Tomcat tomcat, String username, String password, String role) { - tomcat.addUser(username, password); - tomcat.addRole(username, role); - } - - - private void stopTomcat(Tomcat tomcat) { - Thread thread = new Thread(() -> { - try { - tomcat.stop(); - tomcat.destroy(); - } catch (LifecycleException e) { - e.printStackTrace(); - } - }); - thread.start(); - - } - - -} \ No newline at end of file