diff --git a/Makefile b/Makefile index e8d02bb5..c4ebf111 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,10 @@ prepare_connectors: scripts/fetch-artifacts.sh setenv @echo "Fetching all artifacts for Connectors targets" @./scripts/fetch-artifacts.sh connector +prepare_share: scripts/fetch-artifacts.sh setenv + @echo "Fetching all artifacts for Share targets" + @./scripts/fetch-artifacts.sh share + prepare_all: scripts/fetch-artifacts.sh setenv @echo "Fetching all artifacts" @./scripts/fetch-artifacts.sh @@ -77,6 +81,10 @@ connectors: prepare_connectors @echo "Building Connectors images" docker buildx bake ${DOCKER_BAKE_ARGS} connectors +share: prepare_share + @echo "Building Share images" + docker buildx bake ${DOCKER_BAKE_ARGS} share + all: docker-bake.hcl prepare_all @echo "Building all images" docker buildx bake ${DOCKER_BAKE_ARGS} diff --git a/README.md b/README.md index c1c81b7d..d49afe4d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Using this tool to build Alfresco images requires: require authentication * Some Unix tools: `jq`, `wget`, `make` -Configuring the authentication to Alfresco NExus server must be dopne using the +Configuring the authentication to Alfresco Nexus server must be done using the wget rc file `~/.wgetrc` or `~/.netrc`: ```sh diff --git a/docker-bake.hcl b/docker-bake.hcl index 056782b7..089dc78d 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,5 +1,5 @@ group "default" { - targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors"] + targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "share"] } group "content_service" { @@ -22,6 +22,10 @@ group "connectors" { targets = ["connector_msteams", "connector_ms365"] } +group "share" { + targets = ["share"] +} + variable "REGISTRY" { default = "localhost" } @@ -546,3 +550,19 @@ target "connector_ms365" { output = ["type=docker"] platforms = split(",", "${TARGETARCH}") } + +target "share" { + context = "./share" + dockerfile = "Dockerfile" + inherits = ["tomcat_base"] + contexts = { + tomcat_base = "target:tomcat_base" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} Share Enterprise" + "org.opencontainers.image.description" = "Alfresco Share Enterprise" + } + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}alfresco-share:${TAG}"] + output = ["type=docker"] + platforms = split(",", "${TARGETARCH}") +} diff --git a/share/Dockerfile b/share/Dockerfile new file mode 100644 index 00000000..052dcfa4 --- /dev/null +++ b/share/Dockerfile @@ -0,0 +1,33 @@ +FROM tomcat_base + +USER root +EXPOSE 8000 + +RUN mkdir -p ${CATALINA_HOME}/shared/classes/alfresco/web-extension \ + ${CATALINA_HOME}/amps_share \ + ${CATALINA_HOME}/webapps/share/ \ + ${CATALINA_HOME}/alfresco-mmt/ \ + /licenses + +COPY substituter.sh ${CATALINA_HOME}/shared/classes/alfresco + +ADD distribution /tmp/ +ENV DISTDIR="/tmp/distribution" + +RUN yum install -y unzip xmlstarlet && \ + unzip /tmp/*.zip -d ${DISTDIR} &&\ + unzip ${DISTDIR}/alfresco*/web-server/webapps/share.war -d ${CATALINA_HOME}/webapps/share/ &&\ + cp ${DISTDIR}/alfresco*/bin/* ${CATALINA_HOME}/alfresco-mmt/ &&\ + cp -r ${DISTDIR}/alfresco*/amps ${CATALINA_HOME}/amps_share &&\ + cp ${DISTDIR}/alfresco*/web-extension-samples/custom-slingshot-application-context.xml.sample ${CATALINA_HOME}/shared/classes/alfresco/web-extension &&\ + cp ${DISTDIR}/alfresco*/web-extension-samples/smartfolders-amp-actions-config.xml ${CATALINA_HOME}/shared/classes/alfresco/web-extension &&\ + cp /tmp/share-config-custom.xml ${CATALINA_HOME}/shared/classes/alfresco/web-extension &&\ + rm -rf ${DISTDIR} /tmp &&\ + sed -i "s/shared.loader=/shared.loader=\${catalina.base}\/shared\/classes/" ${CATALINA_HOME}/conf/catalina.properties &&\ + chmod +x ${CATALINA_HOME}/shared/classes/alfresco/substituter.sh &&\ + yum clean all && rm -rf /var/cache/yum + +RUN java -jar ${CATALINA_HOME}/alfresco-mmt/alfresco-mmt*.jar install \ + ${CATALINA_HOME}/amps_share ${CATALINA_HOME}/webapps/share -directory -nobackup -force + +ENTRYPOINT ["/usr/local/tomcat/shared/classes/alfresco/substituter.sh", "catalina.sh run"] diff --git a/share/README.md b/share/README.md new file mode 100644 index 00000000..e69de29b diff --git a/share/artifacts.json b/share/artifacts.json new file mode 100644 index 00000000..a666d02f --- /dev/null +++ b/share/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-content-services-share-distribution", + "version": "23.2.2", + "path": "share/distribution", + "classifier": ".zip", + "group": "org.alfresco", + "repository": "enterprise-releases" + } + ] + } +} diff --git a/share/distribution/README.md b/share/distribution/README.md new file mode 100644 index 00000000..9172a562 --- /dev/null +++ b/share/distribution/README.md @@ -0,0 +1,17 @@ +# Alfresco Content Services share distribution + +Place here the version of Alfresco Content Services share distribution you want to +use in your Docker image. +Distribution file must be a ZIP file with the expected structure of an Alfresco +Content Services share distribution. + +```tree +amps/ +bin/ +web-extension-samples/ +web-server/ +|_webapps/ +|_conf/ + |_Catalina/ + |_localhost/ +``` diff --git a/share/distribution/share-config-custom.xml b/share/distribution/share-config-custom.xml new file mode 100644 index 00000000..65fa6aa3 --- /dev/null +++ b/share/distribution/share-config-custom.xml @@ -0,0 +1,741 @@ + + + + + + + false + + + false + + + + + + + + + + production + + + + + manual + true + + + + + + + + + + + + + Alfresco-CSRFToken + + + + + + + + + + + {token} +
{token}
+ {token} +
+ + + + + + + + /proxy/alfresco/remoteadm/.* + + + It is not allowed to access this url from your browser + + + + + + + POST + /proxy/alfresco/api/publishing/channels/.+ + + + {referer} + + + {origin} + + + + + + + POST + + /page/caches/dependency/clear|/page/index|/page/surfBugStatus|/page/modules/deploy|/page/modules/module|/page/api/javascript/debugger|/page/console + + + + {referer} + + + {origin} + + + + + + + POST + + /page/dologin(\?.+)?|/page/site/[^/]+/start-workflow|/page/start-workflow|/page/context/[^/]+/start-workflow + + + + {referer} + + + {origin} + + + + + + + POST + /page/dologout(\?.+)? + + + {referer} + + + {origin} + + + {token} + {token} + + + + + + + + .+ + + + + + + {token} + {token} + + + + + + + GET + /page/.* + + .+ + .+ + + + + {token} + {token} + + + + + + + POST +
multipart/.+
+ + .+ + +
+ + {token} + {token} + + + {referer} + + + {origin} + +
+ + + + + POST|PUT|DELETE + + .+ + + + + {token} + {token} + + + {referer} + + + {origin} + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + false + + + 1000 + + + 7000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://REPO_HOST:REPO_PORT/alfresco + + + + + 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 + http://REPO_HOST:REPO_PORT/alfresco/s + none + + + + alfresco + Alfresco - user access + Access to Alfresco Repository WebScripts that require user authentication + alfresco + http://REPO_HOST:REPO_PORT/alfresco/s + user + + + + alfresco-feed + Alfresco Feed + Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet + http + http://REPO_HOST:REPO_PORT/alfresco/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 + http://REPO_HOST:REPO_PORT/alfresco/api + user + + + + + + + + 2 + 8 + true + + + false + + + + + + + + + + + +
diff --git a/share/substituter.sh b/share/substituter.sh new file mode 100644 index 00000000..92c3431b --- /dev/null +++ b/share/substituter.sh @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +if [[ $REPO_HOST == "" ]]; then + REPO_HOST=localhost +fi + +if [[ $REPO_PORT == "" ]]; then + REPO_PORT=8080 +fi + +if [[ $USE_SSL == "true" ]]; then + sed -ie 's_port="8080"_port="8080" scheme="https"_' "$CATALINA_HOME"/conf/server.xml +fi + +echo "Replace 'REPO_HOST' with '$REPO_HOST' and 'REPO_PORT' with '$REPO_PORT'" + +xmlstarlet ed --inplace \ +-u "//config[@evaluator='string-compare' and @condition='DocumentLibrary']//repository-url" -v "http://"$REPO_HOST:$REPO_PORT"/alfresco" \ +-u "//config[@evaluator='string-compare' and @condition='Remote']//remote//endpoint//endpoint-url" -v "http://"$REPO_HOST:$REPO_PORT"/alfresco/s" \ +"$CATALINA_HOME"/shared/classes/alfresco/web-extension/share-config-custom.xml + +echo "NEW -csrf.filter.referer is '$CSRF_FILTER_REFERER'" +echo "NEW -csrf.filter.origin is '$CSRF_FILTER_ORIGIN'" + +if [ "${CSRF_FILTER_REFERER}" != "" ] && [ "${CSRF_FILTER_ORIGIN}" != "" ]; then + # set CSRFPolicy to true and set both properties referer and origin + xmlstarlet ed --inplace \ + -u "//config[@evaluator='string-compare' and @condition='CSRFPolicy']/@replace" -v "true" \ + -u "//config[@evaluator='string-compare' and @condition='CSRFPolicy']//referer" -v "$CSRF_FILTER_REFERER" \ + -u "//config[@evaluator='string-compare' and @condition='CSRFPolicy']//origin" -v "$CSRF_FILTER_ORIGIN" \ + "$CATALINA_HOME"/shared/classes/alfresco/web-extension/share-config-custom.xml +fi + +bash -c "$@" diff --git a/test/helm/test-overrides.yaml b/test/helm/test-overrides.yaml index 0dfdaf06..3ef76115 100644 --- a/test/helm/test-overrides.yaml +++ b/test/helm/test-overrides.yaml @@ -3,7 +3,10 @@ alfresco-repository: image: repository: localhost/alfresco-content-repository tag: latest -#share: +share: + image: + repository: localhost/alfresco-share + tag: latest alfresco-search-enterprise: liveIndexing: content: