Skip to content
Open
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
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ infrastructure in DevOps manner.

This *can* be in smaller minor versions, although it was tested in this way.

* Docker (>= 17.12.ce)
* Docker (>= 17.12.ce)
* Maven (>= 3.3.9)
* AEM jar (>= 6.1) + **license.properties** file

Expand All @@ -18,7 +18,7 @@ this repository.

To run any AEM you need to put three elements into:

- AEM 6.1, 6.2 or 6.3 (all tested) jars into `aem/aem_packages`
- one of AEM 6.1, 6.2 or 6.3 (all tested) jars into `aem/aem_packages`
- the name does not matter - it can be any `*.jar`.
- license.properties file - this has to be named that way
- unzipped mod_dispatcher content `dispatcher/mod_dispatcher` for Apache 2.4
Expand All @@ -42,5 +42,21 @@ Firefox and all other browsers provides [proxy configuration][2]. What you need
to do is configure proxy and use it in order to access configured domains (like
geometrixxselling.com) inside your network.

### Installing packages into AEM instance

There is an option to enhance AEM docker file with your custom/update packages
(i.e.cumulative fix packs or your own app packages). In order to do so, you have
to change the Dockerfile (or import this one using FROM) and add more packages
by:

COPY aem_packages/your-custom-package.zip crx-quickstart/install/
RUN ./crx-quickstart/bin/install.sh

It will copy the package (obviously), but also will run AEM and wait until
the package is installed. That gives you an opportunity to store JCR repository
as it is in installed state, do not making the image boot up with installation
process, which can't be always properly maintained/verified - and also it saves
time of potential image user (which doesn't build this image from scratch).

[1]: 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
[2]: https://support.mozilla.org/en-US/kb/connection-settings-firefox
19 changes: 16 additions & 3 deletions aem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,37 @@ LABEL maintainer=sii.pl

WORKDIR /aem

# Phase #1: install AEM jar provided, then license (all needed before run)
COPY aem_packages/*.jar /aem/aem.jar
COPY aem_packages/license.properties /aem/license.properties

# Phase #2: create packages install folder
RUN mkdir -p /aem/crx-quickstart/install
COPY install_packages/* /aem/crx-quickstart/install/

WORKDIR /aem

RUN java -jar aem.jar -unpack -r nosamplecontent
# Phase #3: unpack AEM insatnce and copy enahnced run script
RUN java -jar aem.jar -unpack -r nosamplecontent -nobrowser

WORKDIR /aem/crx-quickstart/bin
COPY ./scripts/run.sh /aem/crx-quickstart/bin/run.sh
COPY ./scripts/install.sh /aem/crx-quickstart/bin/install.sh

WORKDIR /aem/crx-quickstart

# Phase #4: provide information which runmode this instance goes with
# https://vsupalov.com/docker-build-time-env-values/
ARG AEM_RUNMODE=author
ENV CQ_RUNMODE=$AEM_RUNMODE

WORKDIR /aem
RUN ./crx-quickstart/bin/install.sh

#This is an example how to install packages - put them into content folder and then run install.sh
#COPY install_packages/AEM-6.3.3.0-6.3.3.zip crx-quickstart/install/
#RUN ./crx-quickstart/bin/install.sh

#COPY install_packages/AEM-CFP-6.3.3.8-8.0.zip crx-quickstart/install/
#RUN ./crx-quickstart/bin/install.sh

EXPOSE 80 10000 2000
ENTRYPOINT ["/aem/crx-quickstart/bin/run.sh"]
51 changes: 51 additions & 0 deletions aem/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# This script mean to:
# - put package for installation in install folder
# - run AEM
# - wait until the installation is done
# - close AEM instance

function load_proc() {
PROC=$(top -b -n 1 -p $JAVA_PID | head -8 | tail -1 | awk '{print $9}')
}

function find_java_proc() {
JAVA_PID=$(ps -o pid= --ppid $AEM_PID | head -1)
}

# run
echo "Starting AEM instance in $(pwd)"
$(pwd)/crx-quickstart/bin/run.sh &

AEM_PID=$!

echo "AEM started with $AEM_PID"

sleep 30 # let the instance start - it has to run properly process
find_java_proc

echo "Checking PROC"
load_proc
echo "PROC: $PROC"

ATTEMPTS=0

while [ $ATTEMPTS -lt 4 ]; do
sleep 2
load_proc
ATTEMPTS=$(echo $PROC $ATTEMPTS | awk '{v = $1 > 10 ? 0 : $2 + 1; print v}')
echo "PROC: $PROC"
done

echo "Stopping AEM instance"

$(pwd)/crx-quickstart/bin/stop

echo "Waiting ultil it sleeps forever"

while kill -0 $AEM_PID; do
sleep 1
done

echo "Done!"
11 changes: 10 additions & 1 deletion aem/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ CQ_VERBOSE='false'
# do not fork the JVM
CQ_NOFORK='true'

# do not show browser
CQ_NOBROWSER='true'

# force forking the VM using recommended default memory settings
#CQ_FORK='true'

Expand All @@ -51,8 +54,14 @@ CQ_NOFORK='true'
# config for jaas
CQ_JAAS_CONFIG='etc/jaas.config'

# config JMX value if not set
if [ -z $JMXPORT ]; then
JMXPORT=45029
HOST_IP="127.0.0.1"
fi

# default JVM options
CQ_JVM_OPTS="-Xdebug
CQ_JVM_OPTS="-Xdebug
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=${HOST_IP}
-Dcom.sun.management.jmxremote.port=${JMXPORT}
Expand Down