Ir al contenido principal

Creating Docker containers for Adobe Experience Manager

This is a Docker tutorial for creating a docker image for the Galen framework, above is the vid and below you will find some of the steps followed.
  • Adobe experience manager is a content management system which in a nutshell is an application that allows us to create web sites to be consumed by end users. You might be familiar with other such applications like wordpress or drupal which serves the same purpose

  • A typical deployment would be comprised of two AEM instances, the author instance used for creating and modifying content, the publish instance which serves the content and finally we have a dispatcher which is a static web server used for caching, load balancing and some security purposes.

  • We can configure an AEM instance to work as an author or publish instance by either changing the file name for the jar file

  •   
    java -jar cq-author-4502.jar
    java -jar cq-publish-4503.jar
      
    
  • Or by using the run modes to configure the instance

  •   
    java -jar cq-quickstart.jar -Dsling.run.modes=author -p 4502
    java -jar cq-quickstart.jar -Dsling.run.modes=publish -p 4503
      
    
  1. 1.

    Pre-reqs

    • Have Java installed (If you want to start AEM outside docker)
    • Have an AEM instance jar and the license.properties files
      And docker installed
  2. 2.

    Create a base AEM image in docker so it can be reused

    • Start from a clean ubuntu image
        
      FROM ubuntu
        
      
    • Create default/working directory
        
      WORKDIR /opt/aem
        
      
    • Install Oracle's Java 8 inside the docker container
        
      RUN apt-get update && \
          apt-get install -y curl && \
          apt-get install -y software-properties-common && \
          add-apt-repository ppa:openjdk-r/ppa && \
          apt-get update && \
          apt-get install -y openjdk-8-jdk && \
          rm -rf /var/lib/apt/lists/* && \
          rm -rf /var/cache/oracle-jdk8-installer
        
      
    • Copy the license and jar file into the image
        
      ADD license.properties ./
      ADD cq-quickstart-6.3.0.jar cq-quickstart.jar
        
      
    • Unpack the jar for future use on other images, child images should use the cq-quickstart.jar file when interacting with AEM
        
      RUN java -jar cq-quickstart.jar -unpack
        
      
    • Build the image
        
      docker build -t aem .
        
      
  3. 3.

    Create a container for the author or publish instances

    • Use the base image
        
      FROM aem
        
      
    • Export the port number
        
      EXPOSE PORT-NUMBER
        
      
    • Start AEM using the same port as above and provide the run mode value: author or publish and for the port: 4502 or 4503
        
      ENTRYPOINT ["java", "-Xmx1024M", "-jar", "cq-quickstart.jar", "-Dsling.run.modes=RUN-MODE", "-p", "PORT-NUMBER"]
        
      
    • Build the image and define the name for the type of instance: author or publish
        
      docker build -t INSTANCE-TYPE .
      docker build -t author .
        
      
    • And finally start the container using the name for the type of instance: author or publish and map the corresponding ports the port: 4502 or 4503
        
      docker run -p PORT-NUMBER:PORT-NUMBER INSTANCE-TYPE
      docker run -p 4502:4502 author
        
      
  4. 4.

    Create a docker container for the dispatcher using default configurations

    • Use an apache image as a base (This one already have some configurations like the port 80 already exposed)
        
      FROM httpd:2.4
        
      
    • Create default/working directory
        
      WORKDIR /usr/src/app
        
      
    • Download the dispatcher module
        
      ADD https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher/_jcr_content/top/download_8/file.res/dispatcher-apache2.4-linux-x86-64-4.2.3.tar.gz ./dispatcher/
        
      
    • Unzip it and then copy the module file into apache's modules folder
        
      RUN tar -xzvf ./dispatcher/dispatcher-apache2.4-linux-x86-64-4.2.3.tar.gz -C ./dispatcher && \
          cp ./dispatcher/dispatcher-apache2.4-4.2.3.so /usr/local/apache2/modules/mod_dispatcher.so
        
      
    • Copy a local version of the dispatcher.any file already modified to work with the publish instance, take into account that the configuration on that file is expecting that you are starting the containers using docker-compose and that the service for the publish instance is also called publish.

      If you need another name or to start the container using just docker change any text matching the text "publish" to the new one or the ip of your publish container

      ADD dispatcher.any /usr/local/apache2/conf/dispatcher.any
    • Copy a local version of the httpd.conf file already modified to use the dispatcher module.

        
      COPY httpd.conf /usr/local/apache2/conf/httpd.conf
        
      
    • Start all the containers using docker-compose
        
      docker-compose up
        
      
  5. 5.

Entradas populares de este blog

Creating a Docker container for a NodeJs application: Express + Mongo + Docker Compose

This is a Docker tutorial for creating a NodeJs container using expressjs and mongoose, above is the vid and below you will find the steps followed.
StepsPre-reqsHave node.js installedAnd docker installed (make sure you have docker-compose as well)Create an simple node app using expressjs and mongooseModify your container and create a docker-compose fileBuild and Run your new container Create your simple node appInitialize the node appnpm initInstall the dependencies for our appnpm install --save express mongoose Create the database.jsCreate the index.js Create a dockerfileInclude container with node preinstalled: FROM nodeCreate default/working directory: WORKDIR /usr/src/appCopy package.json to workdir and install dependencies (which we will need in this case😊): COPY package.json .RUN npm install Copy the rest of the app (just the index.js file in this case)COPY . .Expose the port required for reaching our expressjs appEXPOSE 3000Add a command to run when this container is star…

Creating a Mongo replicaset using docker: Mongo replicaset + Nodejs + Docker Compose

This is a Docker tutorial for creating a Mongo replica set using docker compose and also a couple more containers to experiment with the replica set, above is the vid and below you will find some of the steps followed.
StepsPre-reqsHave node.js installedAnd docker installed (make sure you have docker-compose as well)Create a container for defining configurations for a mongo instanceCreate a container for setting up the replica setCreate a simple node app using expressjs and mongoose (A modified version from the previous video)Create a docker-compose file with the mongo and setup containers and two additional containers for experimenting with the replica setBuild, Run and experiment with your new containers Create a dockerfile for the first mongo container (not really needed but you could configure more stuff if needed)Include container with mongo preinstalled: FROM mongoCreate default/working directory: WORKDIR /usr/src/configsCopy mongo's configurations file into the container
C…

Creating a tensorflow.js + vue.js simple application in javascript

This is a Tensorflow.js tutorial for creating a simple application using Vue.js, above is the vid and below you will find some of the steps followed. Steps Pre-reqs Have node.js installed Create the Vue.js application using nuxt.js Add support for tensorflow.js in vue.js and add a simple model Add the simple tensorflow.js model using vue.js into github pages Create the Vue.js application using nuxt.js Install vue.js cli npm install -g vue-cli Create a base Vue.js app using the starter kit from Nuxt vue init nuxt-community/starter-template simple-vue-tensorflow Start the dev server npm run dev Create empty component components/TensorflowExample.vue Add the component into the page pages/index.vue …