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-2843 Build repository community edition #56

Merged
merged 20 commits into from
Oct 8, 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
45 changes: 27 additions & 18 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, Run and Test Docker Image
name: CI

on:
push:
Expand All @@ -19,7 +19,7 @@ on:
- 'README.md'

env:
ACS_CHART_VERSION: 172410cfb4ad44d4839d9aefd31b4bcefc44f316
ACS_CHART_VERSION: 8a819c9b90b9015e5ab2654c47961fef4183cbcf # v8.5.1 plus the fix for community test values
ARTIFACT_NAME: alfresco-docker-images
REGISTRY: ghcr.io
REGISTRY_NAMESPACE: alfresco
Expand Down Expand Up @@ -48,9 +48,9 @@ jobs:
with:
auto-commit: "true"

build-test:
runs-on: ubuntu-latest
build:
needs: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down Expand Up @@ -126,8 +126,7 @@ jobs:
*.output=type=registry,push=true

compose-test:
name: compose-test
needs: build-test
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -160,13 +159,13 @@ jobs:
output-archive-name: ${{ matrix.edition }}-logs

helm-test:
needs: build
runs-on: ${{ matrix.arch == 'arm64' && 'alfrescoARM-ubuntu2404-16G-4CPU' || 'alfrescoPub-ubuntu2204-16G-4CPU' }}
strategy:
fail-fast: false
matrix:
arch: [arm64, amd64]
name: helm test
needs: build-test
runs-on: ${{ matrix.arch == 'arm64' && 'alfrescoARM-ubuntu2404-16G-4CPU' || 'alfrescoPub-ubuntu2204-16G-4CPU' }}
edition: [enterprise, community]
steps:
- name: Setup cluster
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
Expand Down Expand Up @@ -206,10 +205,10 @@ jobs:
with:
repository: Alfresco/acs-deployment
ref: ${{ env.ACS_CHART_VERSION }}
path: github-source
path: acs-deployment

- name: Setup helm repository
working-directory: github-source/helm/alfresco-content-services
working-directory: acs-deployment/helm/alfresco-content-services
run: |
helm repo add self https://alfresco.github.io/alfresco-helm-charts/
helm repo add activiti https://activiti.github.io/activiti-cloud-helm-charts
Expand All @@ -221,19 +220,26 @@ jobs:
env:
OVERRIDES_VALUES_FILE: test/helm/test-overrides.yaml
run: |
sed -i "s|localhost/|${REGISTRY}/${REGISTRY_NAMESPACE}/|g" ${{ env.OVERRIDES_VALUES_FILE }}
sed -i "s|localhost/alfresco/|${REGISTRY}/${REGISTRY_NAMESPACE}/|g" ${{ env.OVERRIDES_VALUES_FILE }}
sed -i "s|tag: latest|tag: ${TAG}|g" ${{ env.OVERRIDES_VALUES_FILE }}

if [ "${{ matrix.edition }}" = "community" ]; then
sed -i "s|/alfresco-content-repository|/alfresco-content-repository-community|g" ${{ env.OVERRIDES_VALUES_FILE }}
fi

cat ${{ env.OVERRIDES_VALUES_FILE }}

- name: Helm install
id: helm_install
run: |
helm install acs ./github-source/helm/alfresco-content-services \
helm install acs ./acs-deployment/helm/alfresco-content-services \
--set global.search.sharedSecret="$(openssl rand -hex 24)" \
--set global.known_urls=http://localhost \
--set global.alfrescoRegistryPullSecrets=regcred \
--values ./github-source/test/enterprise-integration-test-values.yaml \
--values test/helm/test-overrides.yaml
--values ./acs-deployment/helm/alfresco-content-services/${{ matrix.edition == 'community' && 'community_' || '' }}values.yaml \
--values ./acs-deployment/test/${{ matrix.edition }}-integration-test-values.yaml \
--values test/helm/test-overrides.yaml \
--values test/helm/test-overrides-${{ matrix.edition }}.yaml

- name: Watch Helm deployment
env:
Expand All @@ -243,8 +249,11 @@ jobs:
KWPID=$!
kubectl wait --timeout=${{ env.HELM_INSTALL_TIMEOUT }} --all=true --for=condition=Ready pods
kill $KWPID
echo "Waiting for ESC Reindexing job to complete... "
kubectl wait --timeout=5m --for=condition=complete job/acs-alfresco-search-enterprise-reindexing

if [ "${{ matrix.edition }}" = "enterprise" ]; then
echo "Waiting for Enterprise Search Reindexing job to complete... "
kubectl wait --timeout=5m --for=condition=complete job/acs-alfresco-search-enterprise-reindexing
fi

- name: Debug cluster status after install
if: always() && steps.helm_install.outcome != 'skipped'
Expand All @@ -265,7 +274,7 @@ jobs:
if: always() && steps.helm_install.outcome != 'skipped'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
with:
name: k8s-logs-${{ matrix.arch }}
name: k8s-logs-${{ matrix.arch }}-${{ matrix.edition }}
path: logs

- name: Run helm test
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,14 @@ export REGISTRY=myecr.domain.tld REGISTRY_NAMESPACE=myorg TARGETARCH=linux/amd64
docker login $REGISTRY
docker buildx bake repo --set *.output=type=registry,push=true
```

### Testing locally

You can easily load all the built image in a local kind cluster with:

```sh
kind load docker-image $(docker images --format "{{.Repository}}" | grep "^localhost/alfresco" | xargs)
```

Then you can run an helm install passing as values the provided
[test-overrides.yaml](./test/helm/test-overrides.yaml).
29 changes: 26 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ group "default" {
targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "search_service"]
}

group "community" {
targets = ["repository_community", "share", "search_service", "tengine_aio"]
}

group "content_service" {
targets = ["repository", "share"]
}
Expand Down Expand Up @@ -197,14 +201,33 @@ target "repository" {
ALFRESCO_REPO_GROUP_NAME = "${ALFRESCO_GROUP_NAME}"
ALFRESCO_REPO_USER_ID = "${ALFRESCO_REPO_USER_ID}"
ALFRESCO_REPO_USER_NAME = "${ALFRESCO_REPO_USER_NAME}"
ALFRESCO_REPO_ARTIFACT = "${repository_editions.artifact}"
ALFRESCO_REPO_EDITION = "${repository_editions.name}"
}
labels = {
"org.opencontainers.image.title" = "${PRODUCT_LINE} Content Repository"
"org.opencontainers.image.description" = "Alfresco Content Services Repository"
"org.opencontainers.image.title" = "${PRODUCT_LINE} Content Repository (${repository_editions.name})"
"org.opencontainers.image.description" = "Alfresco Content Services Repository ${repository_editions.name} edition"
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository:${TAG}"]
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/${repository_editions.image_name}:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")

name = "repository_${repository_editions.name}"

matrix = {
repository_editions = [
{
artifact = "alfresco-content-services-community-distribution",
image_name = "alfresco-content-repository-community",
name = "community"
},
{
artifact = "alfresco-content-services-distribution",
image_name = "alfresco-content-repository",
name = "enterprise"
}
]
}
}

variable "ALFRESCO_LIVEINDEX_USER_ID" {
Expand Down
14 changes: 10 additions & 4 deletions repository/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ ARG ALFRESCO_REPO_GROUP_ID

FROM tomcat_base AS repo_build

ARG ALFRESCO_REPO_ARTIFACT
ARG ALFRESCO_REPO_EDITION

USER root
RUN yum install -y unzip

ADD distribution /tmp/
COPY distribution/${ALFRESCO_REPO_ARTIFACT}-*.zip /tmp/
ENV DISTDIR="/tmp/distribution"

RUN unzip /tmp/*.zip -d ${DISTDIR}
Expand All @@ -28,8 +31,9 @@ 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
ADD libs ${CATALINA_HOME}/lib/
COPY amps /tmp/amps
COPY amps_${ALFRESCO_REPO_EDITION} /tmp/amps
COPY libs ${CATALINA_HOME}/lib/
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; \
Expand All @@ -55,9 +59,11 @@ RUN groupadd -g ${ALFRESCO_REPO_GROUP_ID} ${ALFRESCO_REPO_GROUP_NAME} && \
yum install -y fontconfig && \
yum clean all && rm -rf /var/cache/yum

COPY entrypoint.sh /entrypoint.sh

FROM repo-rhlike AS repo-rockylinux9

FROM repo-${DISTRIB_NAME}${DISTRIB_MAJOR}
USER ${ALFRESCO_REPO_USER_NAME}

CMD ["catalina.sh", "run"]
CMD ["/entrypoint.sh"]
gionn marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion repository/amps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ By default the `scripts/fetch-artifacts.sh` script will fetch the following AMPs
* 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.
Expand Down
Empty file.
Empty file.
12 changes: 10 additions & 2 deletions repository/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
{
"name": "alfresco-device-sync-repo",
"version": "5.0.0",
"path": "repository/amps",
"path": "repository/amps_enterprise",
"classifier": ".amp",
"group": "org.alfresco.services.sync",
"repository": "enterprise-releases"
},
{
"name": "alfresco-googledrive-repo-enterprise",
"version": "4.1.0",
"path": "repository/amps",
"path": "repository/amps_enterprise",
"classifier": ".amp",
"group": "org.alfresco.integrations",
"repository": "enterprise-releases"
Expand All @@ -48,6 +48,14 @@
"classifier": ".zip",
"group": "org.alfresco",
"repository": "enterprise-releases"
},
{
"name": "alfresco-content-services-community-distribution",
"version": "23.2.0",
"path": "repository/distribution",
"classifier": ".zip",
"group": "org.alfresco",
"repository": "public"
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions repository/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec catalina.sh run "$@"
2 changes: 1 addition & 1 deletion share/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG DISTRIB_NAME
ARG DISTRIB_MAJOR
FROM tomcat_base as share_build
FROM tomcat_base AS share_build

USER root
EXPOSE 8000
Expand All @@ -10,8 +10,8 @@

COPY entrypoint.sh ${CATALINA_HOME}/shared/classes/alfresco

ADD amps /tmp/amps

Check warning on line 13 in share/Dockerfile

View workflow job for this annotation

GitHub Actions / kics

[MEDIUM] Add Instead of Copy

Using ADD to load external installation scripts could lead to an evil web server leveraging this and loading a malicious script.
ADD distribution /tmp/

Check warning on line 14 in share/Dockerfile

View workflow job for this annotation

GitHub Actions / kics

[MEDIUM] Add Instead of Copy

Using ADD to load external installation scripts could lead to an evil web server leveraging this and loading a malicious script.
ENV DISTDIR="/tmp/distribution"

RUN yum install -y unzip
Expand Down
2 changes: 1 addition & 1 deletion test/community-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Do not move this file to a folder that is not a first level folder
services:
alfresco:
image: alfresco/alfresco-content-repository-community:23.2.0
image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository-community:${TAG}
mem_limit: 1900m
environment:
JAVA_TOOL_OPTIONS: >-
Expand Down
11 changes: 11 additions & 0 deletions test/helm/test-overrides-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
dtas:
config:
assertions:
acs:
edition: Community
version: 23.2.0
modules:
- id: alfresco-aos-module
version: 3.0.0
installed: true
13 changes: 13 additions & 0 deletions test/helm/test-overrides-enterprise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dtas:
config:
assertions:
acs:
edition: Enterprise
version: 23.2.2
modules:
- id: alfresco-aos-module
version: 3.0.0
installed: true
- id: org.alfresco.integrations.google.docs
version: 4.1.0
installed: true
31 changes: 16 additions & 15 deletions test/helm/test-overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
---
alfresco-repository:
image:
repository: localhost/alfresco-content-repository
repository: localhost/alfresco/alfresco-content-repository
tag: latest
share:
image:
repository: localhost/alfresco-share
repository: localhost/alfresco/alfresco-share
tag: latest
alfresco-search-enterprise:
reindexing:
image:
repository: localhost/alfresco-elasticsearch-reindexing
repository: localhost/alfresco/alfresco-elasticsearch-reindexing
tag: latest
hookExecution: false
liveIndexing:
content:
image:
repository: localhost/alfresco-elasticsearch-live-indexing-content
repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-content
tag: latest
metadata:
image:
repository: localhost/alfresco-elasticsearch-live-indexing-metadata
repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-metadata
tag: latest
path:
image:
repository: localhost/alfresco-elasticsearch-live-indexing-path
repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-path
tag: latest
mediation:
image:
repository: localhost/alfresco-elasticsearch-live-indexing-mediation
repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-mediation
tag: latest
alfresco-transform-service:
pdfrenderer:
image:
repository: localhost/alfresco-pdf-renderer
repository: localhost/alfresco/alfresco-pdf-renderer
tag: latest
imagemagick:
image:
repository: localhost/alfresco-imagemagick
repository: localhost/alfresco/alfresco-imagemagick
tag: latest
libreoffice:
image:
repository: localhost/alfresco-libreoffice
repository: localhost/alfresco/alfresco-libreoffice
tag: latest
transformmisc:
image:
repository: localhost/alfresco-misc
repository: localhost/alfresco/alfresco-misc
tag: latest
tika:
image:
repository: localhost/alfresco-tika
repository: localhost/alfresco/alfresco-tika
tag: latest
transformrouter:
image:
repository: localhost/alfresco-transform-router
repository: localhost/alfresco/alfresco-transform-router
tag: latest
filestore:
image:
repository: localhost/alfresco-shared-file-store
repository: localhost/alfresco/alfresco-shared-file-store
tag: latest
alfresco-sync-service:
enabled: false ## disable till release of 5.0.1
Expand All @@ -67,4 +68,4 @@ dtas:
- not test_api_explorer_reachability
config:
config:
search_timeout_seconds: 360
search_timeout_seconds: "360"
Loading