Skip to content

Instantly share code, notes, and snippets.

@howkymike
Last active October 1, 2022 18:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howkymike/d2ad4e81298e2408511a14cb731441c3 to your computer and use it in GitHub Desktop.
Save howkymike/d2ad4e81298e2408511a14cb731441c3 to your computer and use it in GitHub Desktop.
Instruction allowing Alfresco developers to run dockerized Alfresco on Apple silicon M1 arm64 chip

Alfresco Community on M1 Apple Silicon chip (arm64)

If you want to run dockerized Alfresco Community on your M1 Macbook there are some steps you have to follow and traps you have to avoid. Most importantly:

  • currently (02.2022) amd64 Java isn't perfect on arm64. You should recompile everything to use arm64 architecture. As a bonus you will get quite good performance.
  • to compile Alfresco content services, Oracle's Java is needed. The ones from OpenJDK, Zulu, Temurin just does not work...
  • while creating alfresco-content and alfresco-share images, you should add some amps to amps/amps_share directory. Especially share-services. js-console and ootb-support-tools are nice to have.
  • by default alfresco-search has mutal TLS turned on. While you are developing, it is better to specify ALFRESCO_SECURE_COMMS=none (or secret in the newer versions)

Instruction

  1. Install maven and Oracle's JDK. As of 02.2022 this versions are working:
➜ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
Default locale: en_PL, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
  1. Create alfresco-base-java-arm64 Docker image
  • git clone git@github.com:Alfresco/alfresco-docker-base-java.git
  • In the Dockerfile change image to arm64. Example: FROM arm64v8/centos:7.9.2009 AS centos7
  • Compile: mvn clean install -DskipTests
  • Create image: docker build -t alfresco-base-java-arm64 . --build-arg DISTRIB_NAME=centos --build-arg DISTRIB_MAJOR=7 --build-arg JAVA_MAJOR=11 --build-arg JDIST=jdk --no-cache --target JAVA_BASE_IMAGE
  1. Create alfresco-base-tomcat-arm64 Docker image
  • Clone repo: git clone git@github.com:Alfresco/alfresco-docker-base-tomcat.git
  • In the Dockerfile change java image to previously created alfresco-base-java-arm64. Example: FROM alfresco-base-java-arm64 AS centos7
  • Compile: mvn clean install -DskipTests
  • ** In the Dockerfile change make -j "$(nproc)" to make - nproc variable does not exist on arm64 centOS
  • Craete image: docker build -t alfresco-base-tomcat-arm64 . --build-arg DISTRIB_NAME=centos --build-arg DISTRIB_MAJOR=7 --build-arg JAVA_MAJOR=11 --build-arg TOMCAT_MAJOR=10 --no-cache
  1. Optionally: download and compile additional Alfresco extensions (i.e. OOTB Support Tools)

  2. Optionally: Add api-explorer

  • Clone repo: git clone https://github.com/Alfresco/rest-api-explorer.git
  • Checkout specific version: git checkout 7.2.0 (Alfresco 7.2)
  • Compile: mvn clean install -DskipTests
  • Now you have target/api-explorer.war which you can later copy to the alfresco-community-repo/packaging/docker-alfresco/target/war/
  1. Create alfresco-content-repository-community-arm64 Docker image
  • Clone repo: git clone git@github.com:Alfresco/alfresco-community-repo.git
  • Checkout specific version: git checkout 14.145 Alfresco 7.2)
  • Compile: mvn clean install -DskipTests
  • Go to the packaging/docker-alfresco
  • Copy all amps (most importantly share-services in the /amps/share-services/target/ dir) to the packaging/docker-alfresco/target/amps/
  • In the Dockerfile change:
    • FROM directive. Example: alfresco-docker-base-tomcat-dcevm-arm64:latest
    • Add following lines in the end (before USER) RUN chgrp -R alfresco ${TOMCAT_DIR}/webapps ${TOMCAT_DIR}/amps ${TOMCAT_DIR}/lib && \ find ${TOMCAT_DIR}/webapps -type d -exec chmod 0750 {} \; && \ find ${TOMCAT_DIR}/webapps -type f -exec chmod 0640 {} \; && \ chmod -R g+rwx ${TOMCAT_DIR}/webapps && \ chmod 664 ${TOMCAT_DIR}/amps/*
  • Create a Docker image: docker buildx build . --load --platform linux/arm64 -t alfresco-content-repository-community-arm64
  1. Create alfresco-share-arm64 Docker image
  • git clone git@github.com:Alfresco/alfresco-community-share.git
  • Checkout specific version: git checkout 14.96 (Alfresco 7.2)
  • Compile: mvn clean install -DskipTests
  • Copy all custom amps (i.e. js-console, ootbee-support-tools) to the packaging/docker/target/amps_share/
  • Go to packaging/docker and remove LABEL directive from the Dockerfile and change FROM to i.e. FROM alfresco-docker-base-tomcat-dcevm-arm64:latest
  • Create an image: docker buildx build . --load --platform linux/arm64 -t alfresco-share-arm64
  1. Create alfresco-search-services-arm64 Docker image
  • Clone repo: git clone git@github.com:Alfresco/SearchServices.git

  • Checkout specific version: git checkout 2.0.3 (Alfresco 7.2)

  • Go to search-services and compile: mvn clean install -DskipTests

  • Go to packaging/target/docker-resources

  • In the search_config_setup.sh:

    • ( before 2.0.3 ) in the first line add ALFRESCO_SECURE_COMMS=none (it can be also setup by the ENV variable)
    • ( after 2.0.3 ) in the first line add ALFRESCO_SECURE_COMMS=secret and add to the switch-case sed alfresco.secureComms.secret=secret\n and in your docker images you have to add the following lines
      • in the sol6->environment ALFRESCO_SECURE_COMMS: "secret" JAVA_TOOL_OPTIONS: " -Dalfresco.secureComms.secret=secret"
      • in the alfresco->environment->JAVA_OPTS -Dsolr.secureComms=secret -Dsolr.sharedSecret=secret
  • open Dockerfile and modify:

    • FROM (i.e. FROM alfresco-base-java-dcevm-arm64)
  • Create an image: docker buildx build . --load --platform linux/arm64 -t alfresco-search-services-arm64

  1. In your all-in-one alfresco maven project change Dockerfile (FROM) and docker-compose.yml (JAVA_TOOL_OPTIONS, image) to use previously created images.

Hints

  1. While downloading images from GitHub it is recommended to checkout specific release tag.
  2. If you face compile error, it probably means your maven is using wrong JDK or you have installed wrong JDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment