配置 AEM CQ6 (author + publish + apache dispatcher + ubuntu )

AEM CQ系列是Adobe下的企業內容管理系統,如今已知的一些企業好比 Deloitte,Ford Racing,這裏就很少作基本的介紹了,明白的看!html

今天在Docker配置一下author instance, publish instance, apache dispatcherjava

 

文件構架linux

Authorweb

-cq-author-4505.jardocker

-license.propertiesapache

Publishubuntu

-cq-author-4503.jarwindows

-license.propertiesbash

Author Instanceoracle

FROM ubuntu:14.04

RUN mkdir /opt/aem/
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update

# automatically accept oracle license
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
# and install java 7 oracle jdk
RUN apt-get -y install oracle-java7-installer && apt-get clean
RUN update-alternatives --display java
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
WORKDIR /opt/aem/
ADD cq-author-4505.jar /opt/aem/cq-author-4505.jar 
ADD license.properties /opt/aem/license.properties 

RUN java -jar cq-author-4505.jar -unpack -v

運行author instance

docker run -i –t –d -p 4505:4505 <yourName>/aem-auth:6.0 /bin/bash

咱們手動的啓動AEM instance

java -jar cq-author-4505.jar

image

運行 http://192.168.59.103:4505 以後呢,咱們來手動升級一下Service Pack (以後咱們會修改Docker讓他自動升級Service Pack)

Publish Instance

     這裏設置publish instance跟author instance很是類似,只是運行

docker run -i –t –d -p 4503:4503 <yourName>/aem-pub:6.0 /bin/bash

     和

java -jar cq-author-4503.jar

運行 http://192.168.59.103:4503 一樣,咱們要升級Service Pack

image

Dispatcher

這裏面咱們使用ubuntu:14.04的鏡像,在這裏咱們開一個端口8888來映射內部的80端口

docker run -i -t –d -p 8888:80 --name aem-dispatcher ubuntu:14.04

進入到Dispatcher的instance

docker exec -i -t aem-dispatcher /bin/bash

安裝apache2

apt-get update
apt-get install -y apache2

這裏apache默認的root文件夾是/var/www

 

第1步 (步驟有點多,分開寫)

        下載後如圖

image

  • 在/etc/apache2的目錄下建立一個conf的文件夾,並把剛纔解壓縮後的dispatcher.any文件拷貝過去   cp dispatcher.any /etc/apache2/conf

        image

  • 拷貝dispatcher-apache2.4-4.1.8.so 到/usr/lib/apache2/modules (這裏名字就不作修改了,若是是production,建議修改爲apache標準的命名例如mod_aem.so)

       image

 

 

第2步 (修改/etc/apache2/apache2.conf 文件)

粘貼下面的到這個 apache2.conf 最下面,請保證紅色註釋的文件名能夠在系統內存在

LoadModule dispatcher_module /usr/lib/apache2/modules/dispatcher-apache2.4-4.1.8.so

<IfModule disp_apache2.c>
# location of the configuration file. eg: 'conf/dispatcher.any'
DispatcherConfig  /etc/apache2/conf/dispatcher.any
# location of the dispatcher log file. eg: 'logs/dispatcher.log'
DispatcherLog /var/log/apache2/dispatcher.log

# log level for the dispatcher log
# 0 Errors
# 1 Warnings
# 2 Infos
# 3 Debug
DispatcherLogLevel 3

# if turned to 1, the dispatcher looks like a normal module
DispatcherNoServerHeader 0

# if turned to 1, request to / are not handled by the dispatcher
# use the mod_alias then for the correct mapping
DispatcherDeclineRoot 0

# if turned to 1, the dispatcher uses the URL already processed
# by handlers preceeding the dispatcher (i.e. mod_rewrite)
# instead of the original one passed to the web server.
DispatcherUseProcessedURL 0



# if turned to 1, the dispatcher does not spool an error
# response to the client (where the status code is greater
# or equal than 400), but passes the status code to
# Apache, which e.g. allows an ErrorDocument directive
# to process such a status code.

DispatcherPassError 0
</IfModule>

<Directory />

<IfModule disp_apache2.c> 
# enable dispatcher for ALL request. if this is too restrictive, 
# move it to another location
SetHandler dispatcher-handler
</IfModule>

Options FollowSymLinks
AllowOverride None

</Directory>
第3步 (修改/etc/apache2/conf/dispatcher.any 文件
/renders
{
/rend01
{
/hostname "192.168.59.103"
[2]--> /port "4503"
}
}
/cache
{

    # The docroot must be equal to the document root of the webserver. The
      # dispatcher will store files relative to this directory and subsequent
      # requests may be "declined" by the dispatcher, allowing the webserver
      # to deliver them just like static files.
  /docroot "/var/www"

    /allowAuthorized "1"

第4步,開始apache2 服務

這就沒什麼說的了 ,若是有錯,請仔細檢查

service apache2 start

配置Author裏面的publisher的指向

在Author上配置publisher,

http://192.168.59.103:4505/etc/replication/agents.author/publish.html

默認實際上是不用修改的,可是我使用的是windows下的docker,因此須要修改一下IP,

image

好了,基本上大功告成了,如今就是測試咱們是否配置正確了。咱們就用geometrixx來作個例子。

在author的instance上,加入咱們有這個Page  http://192.168.59.103:4505/cf#/content/geometrixx/en.html,當發佈後,

image

在publisher的instance上,咱們來檢查這個Page http://192.168.59.103:4503/content/geometrixx/en.html

image

而後咱們來檢查dispatcher是否是工做,http://192.168.59.103:8888/content/geometrixx/en.html

image

好了,最後一件事,咱們要檢查一下dispatcher是否是已經cache住這些頁面了嗎?咱們要去/var/www去看,內容並無被cache住,這是爲何呢?

image

 

 

 

咱們要檢查一下apache的LOG, Log寫的很清楚,由於沒有權限寫入/var/www,好吧,咱們來給他加個權限

image 

chown -R www-data:www-data /var/www

在檢查/var/www

image

大功告成。有機會的話會向你們介紹AEM開發。

Best Regards

Rui

相關文章
相關標籤/搜索