標籤:
AEM CQ系列是Adobe下的企業內容管理系統,現在已知的一些企業比如 Deloitte,Ford Racing,這裡就不多做基本的介紹了,明白的看!
今天在Docker配置一下author instance, publish instance, apache dispatcher
檔案構架
Author
-cq-author-4505.jar
-license.properties
Publish
-cq-author-4503.jar
-license.properties
Author Instance
FROM ubuntu:14.04RUN mkdir /opt/aem/RUN apt-get install -y software-properties-commonRUN add-apt-repository ppa:webupd8team/javaRUN apt-get update# automatically accept oracle licenseRUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections# and install java 7 oracle jdkRUN apt-get -y install oracle-java7-installer && apt-get cleanRUN update-alternatives --display javaENV JAVA_HOME /usr/lib/jvm/java-7-oracleWORKDIR /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
運行 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
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 updateapt-get install -y apache2
這裡apache預設的root檔案夾是/var/www
第1步 (步驟有點多,分開寫)
- 下載AEM Dispatcher的config,下載並解壓縮 wget https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher/_jcr_content/top/download_6/file.res/dispatcher-apache2.4-linux-x86-64-4.1.8.tar.gz
下載後
- 在/etc/apache2的目錄下建立一個conf的檔案夾,並把剛才解壓縮後的dispatcher.any檔案拷貝過去 cp dispatcher.any /etc/apache2/conf
- 拷貝dispatcher-apache2.4-4.1.8.so 到/usr/lib/apache2/modules (這裡名字就不做修改了,如果是production,建議修改成apache標準的命名例如mod_aem.so)
第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 DebugDispatcherLogLevel 3# if turned to 1, the dispatcher looks like a normal moduleDispatcherNoServerHeader 0# if turned to 1, request to / are not handled by the dispatcher# use the mod_alias then for the correct mappingDispatcherDeclineRoot 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 locationSetHandler dispatcher-handler</IfModule>Options FollowSymLinksAllowOverride 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,
好了,基本上大功告成了,現在就是測試我們是否配置正確了。我們就用geometrixx來做個例子。
在author的instance上,加入我們有這個Page http://192.168.59.103:4505/cf#/content/geometrixx/en.html,當發布後,
在publisher的instance上,我們來檢查這個Page http://192.168.59.103:4503/content/geometrixx/en.html
然後我們來檢查dispatcher是不是工作,http://192.168.59.103:8888/content/geometrixx/en.html
好了,最後一件事,我們要檢查一下dispatcher是不是已經cache住這些頁面了嗎?我們要去/var/www去看,內容並沒有被cache住,這是為什麼呢?
我們要檢查一下apache的LOG, Log寫的很清楚,因為沒有許可權寫入/var/www,好吧,我們來給他加個許可權
chown -R www-data:www-data /var/www
在檢查/var/www
大功告成。有機會的話會向大家介紹AEM開發。
配置 AEM CQ6 (author + publish + apache dispatcher + ubuntu )