How to add my extensions to ACS 6 containers

Extending ACS 6 docker images

After you have your ACS 6 local environment running, you’re probably thinking, this is nice, but I want to deploy my favorite amps, like JS console, Alfresco Governance Services (AGS), or even custom developed amps developed with Alfresco SDK.

In short, the goal would be to derive your own container using the ACS6 container as a base. Then deploy that container to a registry like docker hub, which also supports private repositories that you can pull from and deploy in your environments.

Why am I doing it this way? I recommend this free course to answer that question:

https://classroom.udacity.com/courses/ud615

In short, it’s to speed up deploy times, and orchestration and rolling updates from a Kubernetes layer.

Extension

To extend the base image, you have 2 approaches. Create a new Docker Image with the ACS image as your base, or clone the ACS docker image project, and extend the  https://github.com/Alfresco/acs-community-packaging/blob/master/docker-alfresco/Dockerfile 

In my case, I choose to extend the base image so that I don’t depend on access to source for maintenance.

Extending ACS Content Repository Community 6.0.5 EA base with Java-Script Console support

Create a folder acsrepo6 with the following Dockerfile

FROM alfresco/alfresco-content-repository-community:6.0.5-ea
MAINTAINER Alexander Mahabir

RUN cd /usr/local/tomcat/amps; \
  curl -L https://github.com/share-extras/js-console/releases/download/v0.6.0-rc1/javascript-console-repo-0.6.0.amp \
  --output javascript-console-repo-0.6.0.amp
## Repackage alfresco application into war archive to install amps
RUN cd /usr/local/tomcat/webapps/alfresco; jar -cMf ../alfresco.war .
RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \
   /usr/local/tomcat/amps /usr/local/tomcat/webapps/alfresco.war -directory -nobackup -force
RUN cd /usr/local/tomcat/webapps/alfresco; jar -xf ../alfresco.war
RUN rm -f /usr/local/tomcat/webapps/alfresco.war

Navigate to that folder and run

docker build -t acs-6-extended . --squash

NB: Use of –squash flag to keep collapse the layers of your Dockerfile so that the resulting size of your image remains small.

Extending ACS  Share 6.0.a  base with Java-Script Console

Create a folder acsshare6 with the following Dockerfile

FROM alfresco/alfresco-share:6.0.a
MAINTAINER Alexander Mahabir

RUN cd /usr/local/tomcat/amps_share; \
  curl -L https://github.com/share-extras/js-console/releases/download/v0.6.0-rc1/javascript-console-share-0.6.0.amp \
  --output javascript-console-share-0.6.0.amp
## Repackage alfresco application into war archive to install amps
RUN cd /usr/local/tomcat/webapps/share; jar -cMf ../share.war .
RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \
   /usr/local/tomcat/amps_share /usr/local/tomcat/webapps/share.war -directory -nobackup -force
RUN cd /usr/local/tomcat/webapps/share; jar -xf ../share.war
RUN rm -f /usr/local/tomcat/webapps/share.war

Then navigate to the folder and build the image

docker build -t acs-share-6-extended . --squash

We should now have 2 container images with our extensions

You can verify with the following command

 docker images -a |grep extended

acs-share-6-extended

acs-6-extended

Usage

Update your docker-compose.yml to use your custom/extended images

version: "3"

services:
    alfresco:
        image: acs-6-extended
        environment:
            JAVA_OPTS : "
                -Ddb.driver=org.postgresql.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                -Dsolr.host=solr6
                -Dsolr.port=8983
                -Dsolr.secureComms=none
                -Dsolr.base.url=/solr
                -Dindex.subsystem.name=solr6
                -Ddeployment.method=DOCKER_COMPOSE
                "
        ports:
            - 8082:8080 #Browser port

    share:
        image: acs-share-6-extended
        environment:
            - REPO_HOST=alfresco
            - REPO_PORT=8080
        ports:
            - 8080:8080

    postgres:
        image: postgres:10.1
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432

    solr6:
        image: alfresco/alfresco-search-services:1.1.1
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6
            - SOLR_SOLR_PORT=8983
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
        ports:
            - 8083:8983 #Browser port

Then start the system up with the following command

dockder-compose up

You should now have ACS 6 EA, with JS console in share

Navigate to http://DOCKER_HOST:8080/share

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: