Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2716: implement instructions in repo to install AMPS #9

Merged
merged 16 commits into from
Jul 26, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.zip
*.amp
dist
*.jar
1 change: 1 addition & 0 deletions ats/trouter/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"version": "4.1.3",
"path": "ats/trouter",
"classifier": ".jar",
"repository": "enterprise-releases",
"group": "org.alfresco"
}
]
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose-components.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
services:
alfresco:
image: quay.io/alfresco/alfresco-content-repository:23.2.2
image: localhost/alfresco-content-repository:latest
mem_limit: 1900m
environment:
JAVA_TOOL_OPTIONS: >-
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
services:
alfresco:
image: quay.io/alfresco/alfresco-content-repository:23.2.2
image: localhost/alfresco-content-repository:latest
mem_limit: 1900m
environment:
JAVA_TOOL_OPTIONS: >-
Expand Down
33 changes: 23 additions & 10 deletions repository/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ FROM tomcat_base AS repo_build
USER root
RUN yum install -y unzip

ADD alfresco-content-services-distribution-*.zip /tmp/

RUN unzip /tmp/alfresco-content-services-distribution-*.zip -d /tmp/distribution
RUN mkdir -m 750 -p ${CATALINA_HOME}/shared/classes/alfresco/extension/keystore/ ${CATALINA_HOME}/alf_data
RUN unzip /tmp/distribution/web-server/webapps/alfresco.war -d ${CATALINA_HOME}/webapps/alfresco/
RUN cp -a /tmp/distribution/web-server/conf/* ${CATALINA_HOME}/conf/ && rm -f ${CATALINA_HOME}/conf/Catalina/localhost/share.xml
RUN cp -a /tmp/distribution/web-server/lib/* ${CATALINA_HOME}/lib/
RUN cp -a /tmp/distribution/licenses ${CATALINA_HOME}/
RUN cp -a /tmp/distribution/keystore/metadata-keystore/keystore* ${CATALINA_HOME}/shared/classes/alfresco/extension/keystore/
RUN chmod -R o= ${CATALINA_HOME}/
ADD distribution /tmp/
ENV DISTDIR="/tmp/distribution"

RUN unzip /tmp/*.zip -d ${DISTDIR}
RUN java -jar ${DISTDIR}/bin/alfresco-mmt.jar list ${DISTDIR}/web-server/webapps/alfresco.war
RUN mkdir -m 750 -p ${CATALINA_HOME}/shared/classes/alfresco/extension/keystore/
RUN mkdir -m 770 ${CATALINA_HOME}/alf_data/
RUN unzip ${DISTDIR}/web-server/webapps/alfresco.war -d ${CATALINA_HOME}/webapps/alfresco/
RUN cp -a ${DISTDIR}/web-server/conf/* ${CATALINA_HOME}/conf/ && rm -f ${CATALINA_HOME}/conf/Catalina/localhost/share.xml
RUN cp -a ${DISTDIR}/web-server/lib/* ${CATALINA_HOME}/lib/
RUN cp -a ${DISTDIR}/licenses ${CATALINA_HOME}/
RUN cp -a ${DISTDIR}/keystore/metadata-keystore/keystore* ${CATALINA_HOME}/shared/classes/alfresco/extension/keystore/
RUN chmod -R o-rwx ${CATALINA_HOME}/
RUN sed -i 's|shared.loader=|shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar|' \
${CATALINA_HOME}/conf/catalina.properties
RUN sed -i 's|../modules/platform|modules/platform|' ${CATALINA_HOME}/conf/Catalina/localhost/alfresco.xml
Expand All @@ -26,6 +29,16 @@ RUN sed -i \
-re "s|(appender.rolling.filePattern=)(alfresco.log.%d\{yyyy-MM-dd\})|\1${CATALINA_HOME}/logs\/\2|" \
${CATALINA_HOME}/webapps/alfresco/WEB-INF/classes/log4j2.properties

ADD amps /tmp/amps
RUN if [ -f /tmp/amps/alfresco-aos-module-*.amp ]; then umask 0027; \
unzip ${DISTDIR}/web-server/webapps/ROOT.war -d ${CATALINA_HOME}/webapps/ROOT/; \
cp ${CATALINA_HOME}/webapps/ROOT/META-INF/context.xml ${CATALINA_HOME}/conf/Catalina/localhost/ROOT.xml; \
unzip ${DISTDIR}/web-server/webapps/_vti_bin.war -d ${CATALINA_HOME}/webapps/_vti_bin/; \
else echo "No AOS module found"; \
fi
RUN java -jar ${DISTDIR}/bin/alfresco-mmt.jar install /tmp/amps/ ${CATALINA_HOME}/webapps/alfresco -nobackup -directory
RUN java -jar ${DISTDIR}/bin/alfresco-mmt.jar list ${CATALINA_HOME}/webapps/alfresco

FROM tomcat_base AS repo-rhlike
ARG ALFRESCO_REPO_USER_ID
ARG ALFRESCO_REPO_GROUP_ID
Expand Down
30 changes: 30 additions & 0 deletions repository/amps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Alfresco repository AMPs

Place here your Alfresco module Packages (AMPs) to be installed in the Alfresco
repository.

AMP packages should have the `.amp` extension and stick to the Alfresco module
packaging format as described in the [Alfresco
documentation](https://docs.alfresco.com/content-services/latest/develop/extension-packaging/#alfresco-module-package-amp).

The [in-process Alfresco
SDK](https://docs.alfresco.com/content-services/latest/develop/sdk/) provides a
way to build well structured AMPs.

> Note that AMPs are not the recommanded way to extend Alfresco. You should
> prefer using the Alfresco SDK to build your extensions as JARs even better,
> use the [out-of-process Alfresco
> SDK](https://docs.alfresco.com/content-services/latest/develop/oop-sdk/) to
> build Docker images with your extensions.

By default the `scripts/fetch-amps.sh` script will fetch the following AMPs from the Alfresco Nexus repository:

* alfresco-share-services
* alfresco-aos-module
* alfresco-device-sync-repo
* alfresco-googledrive-repo-enterprise
* alfresco-content-services-distribution

You can replace those, remove them to keep only the ones you need or add more.
Be careful though as some AMPs may depend on one another (e.g.
`googldrive-repo` depends on `alfresco-share-services`).
37 changes: 35 additions & 2 deletions repository/artifacts.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
{
"artifacts": {
"acs23": [
{
"name": "alfresco-share-services",
"version": "23.2.2.3",
"path": "repository/amps",
"classifier": ".amp",
"group": "org.alfresco",
"repository": "releases"
},
{
"name": "alfresco-aos-module",
"version": "3.0.0",
"path": "repository/amps",
"classifier": ".amp",
"group": "org.alfresco.aos-module",
"repository": "releases"
},
{
"name": "alfresco-device-sync-repo",
"version": "5.0.0",
"path": "repository/amps",
"classifier": ".amp",
"group": "org.alfresco.services.sync",
"repository": "enterprise-releases"
},
{
"name": "alfresco-googledrive-repo-enterprise",
"version": "4.1.0",
"path": "repository/amps",
"classifier": ".amp",
"group": "org.alfresco.integrations",
"repository": "enterprise-releases"
},
{
"name": "alfresco-content-services-distribution",
"version": "23.2.2",
"path": "repository",
"path": "repository/distribution",
"classifier": ".zip",
"group": "org.alfresco"
"group": "org.alfresco",
"repository": "enterprise-releases"
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions repository/distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Alfresco repository distribution

Place here the version of Alfresco Content Services 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 distribution.

```tree
keystore/
|_metadata-keystore/
bin/
licenses/
|_3rd-party/
web-server/
|_webapps/
|_shared/
|_classes/
|_alfresco/
|_conf/
|_Catalina/
|_localhost/
```
5 changes: 3 additions & 2 deletions scripts/fetch-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ cd ${REPO_ROOT}/..

for i in $(find . -name artifacts.json -mindepth 2); do
for j in $(jq -r ".artifacts.acs${INDEX_KEY} | keys | .[]" $i); do
ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases"
ARTIFACT_REPO=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].repository" $i)
ARTIFACT_NAME=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].name" $i)
ARTIFACT_VERSION=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].version" $i)
ARTIFACT_EXT=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].classifier" $i)
ARTIFACT_GROUP=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].group" $i)
ARTIFACT_PATH=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].path" $i)
ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/service/local/repositories/${ARTIFACT_REPO}"
echo "Downloading $ARTIFACT_GROUP:$ARTIFACT_NAME $ARTIFACT_VERSION from $ARTIFACT_BASEURL"
wget "${ARTIFACT_BASEURL}/${ARTIFACT_GROUP/\./\/}/${ARTIFACT_NAME}/${ARTIFACT_VERSION}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" \
wget "${ARTIFACT_BASEURL}/${ARTIFACT_GROUP//\./\/}/${ARTIFACT_NAME}/${ARTIFACT_VERSION}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" \
-O ${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}
done
done
4 changes: 4 additions & 0 deletions search/enterprise/common/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,31 @@
"version": "4.0.1",
"path": "search/enterprise/common",
"classifier": "-app.jar",
"repository": "enterprise-releases",
"group": "org.alfresco"
},
{
"name": "alfresco-elasticsearch-live-indexing-path",
"version": "4.0.1",
"path": "search/enterprise/common",
"classifier": "-app.jar",
"repository": "enterprise-releases",
"group": "org.alfresco"
},
{
"name": "alfresco-elasticsearch-live-indexing-content",
"version": "4.0.1",
"path": "search/enterprise/common",
"classifier": "-app.jar",
"repository": "enterprise-releases",
"group": "org.alfresco"
},
{
"name": "alfresco-elasticsearch-live-indexing",
"version": "4.0.1",
"path": "search/enterprise/common",
"classifier": "-app.jar",
"repository": "enterprise-releases",
"group": "org.alfresco"
}
]
Expand Down
3 changes: 2 additions & 1 deletion tomcat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ COPY --chown=:tomcat --chmod=640 --from=tomcat_dist /build/tomcat $CATALINA_HOME
COPY --chown=:tomcat --chmod=640 --from=tcnative_build /usr/local/tcnative $TOMCAT_NATIVE_LIBDIR
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
RUN mkdir -m 770 logs temp work && chgrp tomcat . logs temp work; \
chmod og+x bin/*.sh; \
find . -type d -exec chmod ug+rx {} +; \
chmod ug+rx bin/*.sh; \
# verify Tomcat Native is working properly
nativeLines="$(catalina.sh configtest 2>&1 | grep -c 'Loaded Apache Tomcat Native library')" && \
test $nativeLines -ge 1 || exit 1
Expand Down