管理 Dispatcher 設定

使用Cloud Manager部署Dispatcher配置檔案

Cloud Manager能夠部署Web伺服器和Dispatcher配置檔案(假設這些檔案儲存在​Git Repository​中),以及常規AEM內容包。

要利用此功能,Maven構建版本應生成包含至少兩個目錄的zip檔案- conf​和​conf.d。 此zip檔案可使用maven-assembly-plugin來製作。 Cloud Manager使用內置嚮導生成的項目具有在建立項目時建立的正確Maven項目結構。 這是新Managed Services客戶的推薦路徑。

部署到Dispatcher Instance​時,這些目錄的內容將覆蓋Dispatcher實例上這些目錄的內容。 由於Web伺服器和Dispatcher配置檔案通常需要特定於環境的資訊,因此要正確使用此功能,您首先需要與客戶成功工程師(CSE)合作,在/etc/sysconfig/httpd中設定這些環境變數。

為現有Managed Services客戶配置Dispatcher的步驟

按照以下步驟完成配置Dispatcher的初始過程:

  1. 從CSE中獲取當前生產配置檔案。

  2. 移除硬式編碼的環境特定資料(例如發佈轉譯器IP),並以變數取代。

  3. 在每個目標Dispatcher的鍵值對中定義所需的變數,並請求CSE在每個實例上添加到/etc/sysconfig/httpd

  4. 在您的舞台環境上測試更新的組態,然後請求CSE部署至生產環境。

  5. 將檔案提交到​Git儲存庫

  6. 透過Cloud Manager進行部署。

注意

將Dispatcher和Web伺服器配置遷移到​Git Repository​可在Cloud Manager上線期間完成,但也可以在稍後的時間點完成。

範例

特定的檔案和目錄結構可能因項目的具體情況而有所不同,但本示例應提供如何將項目結構化為包含Apache和Dispatcher配置的具體指南。

  1. 建立名為dispatcher的子目錄。

    注意

    您可在此處使用任何名稱,但在此步驟中建立的目錄名稱必須與步驟6中使用的名稱相同。

  2. 此子目錄將包含一個Maven模組,該模組使用Maven Assembly Plugin構建Dispatcher zip檔案。 要啟動此操作,請在dispatcher目錄中建立包含此內容的pom.xml檔案,根據需要更改父引用、artifactId和名稱。

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <!-- reference to your parent pom -->
        </parent>
    
        <artifactId>dispatcher</artifactId> <!-- feel free to change this -->
        <packaging>pom</packaging>
        <name>dispatcher</name> <!-- feel free to change this -->
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals><goal>single</goal></goals>
                            <configuration>
                                <descriptors>
                                    <descriptor>assembly.xml</descriptor>
                                </descriptors>
                                <appendAssemblyId>false</appendAssemblyId>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    
    注意

    如同在步驟1中,此處的artifactId和名稱可以是其他值(如果需要);dispatcher這裡只是簡單的範例。

  3. Maven Assembly Plugin需要​descriptor​來定義如何建立zip檔案。 要建立此描述符,請使用此內容建立名為assembly.xml的檔案(同樣,在dispatcher子目錄中)。 請注意,上述pom.xml檔案的第26行會參照此檔案名稱。

    <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
      <id>distribution</id>
      <formats>
        <format>zip</format>
      </formats>
      <includeBaseDirectory>false</includeBaseDirectory>
      <fileSets>
        <fileSet>
          <directory>${basedir}/src</directory>
          <includes>
            <include>**/*</include>
          </includes>
          <outputDirectory></outputDirectory>
        </fileSet>
      </fileSets>
    </assembly>
    
  4. 現在,在dispatcher子目錄內建立名為src的子目錄(如第11行上面的匯編描述符中所引用),以儲存實際的Apache和Dispatcher配置。 在此src目錄中,建立名為confconf.dconf.dispatcher.dconf.modules.d的目錄。

  5. 現在,您可以用配置檔案填充confconf.dconf.dispatcher.dconf.modules.d目錄。 例如,預設配置由這些檔案和符號連結組成。

    dispatcher
    ├── assembly.xml
    ├── pom.xml
    └── src
        ├── conf
        │  ├── httpd.conf
        │  └── magic
        ├── conf.d
        │  ├── README
        │  ├── autoindex.conf
        │  ├── available_vhosts
        │  │  ├── aem_author.vhost
        │  │  ├── aem_flush.vhost
        │  │  ├── aem_health.vhost
        │  │  ├── aem_lc.vhost
        │  │  └── aem_publish.vhost
        │  ├── dispatcher_vhost.conf
        │  ├── enabled_vhosts
        │  │  ├── aem_author.vhost -> ../available_vhosts/aem_author.vhost
        │  │  ├── aem_flush.vhost -> ../available_vhosts/aem_flush.vhost
        │  │  └── aem_publish.vhost -> ../available_vhosts/aem_publish.vhost
        │  ├── rewrites
        │  │  ├── base_rewrite.rules
        │  │  └── xforwarded_forcessl_rewrite.rules
        │  ├── userdir.conf
        │  ├── variables
        │  │  └── ams_default.vars
        │  ├── welcome.conf
        │  └── whitelists
        │      └── 000_base_whitelist.rules
        ├── conf.dispatcher.d
        │  ├── available_farms
        │  │  ├── 000_ams_author_farm.any
        │  │  ├── 001_ams_lc_farm.any
        │  │  └── 999_ams_publish_farm.any
        │  ├── cache
        │  │  ├── ams_author_cache.any
        │  │  ├── ams_author_invalidate_allowed.any
        │  │  ├── ams_publish_cache.any
        │  │  └── ams_publish_invalidate_allowed.any
        │  ├── clientheaders
        │  │  ├── ams_author_clientheaders.any
        │  │  ├── ams_common_clientheaders.any
        │  │  ├── ams_lc_clientheaders.any
        │  │  └── ams_publish_clientheaders.any
        │  ├── dispatcher.any
        │  ├── enabled_farms
        │  │  ├── 000_ams_author_farm.any -> ../available_farms/000_ams_author_farm.any
        │  │  └── 999_ams_publish_farm.any -> ../available_farms/999_ams_publish_farm.any
        │  ├── filters
        │  │  ├── ams_author_filters.any
        │  │  ├── ams_lc_filters.any
        │  │  └── ams_publish_filters.any
        │  ├── renders
        │  │  ├── ams_author_renders.any
        │  │  ├── ams_lc_renders.any
        │  │  └── ams_publish_renders.any
        │  └── vhosts
        │      ├── ams_author_vhosts.any
        │      ├── ams_lc_vhosts.any
        │      └── ams_publish_vhosts.any
        └── conf.modules.d
            ├── 00-base.conf
            ├── 00-dav.conf
            ├── 00-lua.conf
            ├── 00-mpm.conf
            ├── 00-proxy.conf
            ├── 00-systemd.conf
            ├── 01-cgi.conf
            └── 02-dispatcher.conf
    
  6. 最後,在項目根目錄的pom.xml檔案中,添加<module>元素以包含調度程式模組。

    例如,如果您的現有模組清單是

        <modules>
            <module>core</module>
            <module>ui.apps</module>
            <module>ui.content</module>
        </modules>
    

    您應將它變更為

        <modules>
            <module>core</module>
            <module>ui.apps</module>
            <module>ui.content</module>
            <module>dispatcher</module>
        </modules>
    
    注意

    如步驟1中所述,<module>元素​的值必須​與所建立的目錄名稱匹配。

  7. 最後,要測試,請在項目根目錄中運行mvn clean軟體包。 在輸出中,您應該會看到這樣的行

    [INFO] --- maven-assembly-plugin:3.1.0:single (default) @ dispatcher ---
    [INFO] Reading assembly descriptor: assembly.xml
    [INFO] Building zip: /Users/me/mycompany/dispatcher/target/dispatcher-1.0-SNAPSHOT.zip
    

    您也可以解壓縮此檔案以檢視其內容。

    $ unzip -l dispatcher/target/dispatcher-1.0-SNAPSHOT.zip
    Archive:  dispatcher/target/dispatcher-1.0-SNAPSHOT.zip
      Length      Date    Time    Name
    ---------  ---------- -----   ----
            0  09-12-2018 12:53   conf.modules.d/
            0  10-19-2018 10:38   conf.dispatcher.d/
            0  09-12-2018 12:53   conf.dispatcher.d/available_farms/
            0  09-12-2018 12:53   conf.dispatcher.d/filters/
            0  09-12-2018 12:53   conf.dispatcher.d/renders/
            0  09-12-2018 12:53   conf.dispatcher.d/cache/
            0  09-12-2018 12:53   conf.dispatcher.d/clientheaders/
            0  09-12-2018 12:53   conf.dispatcher.d/enabled_farms/
            0  09-12-2018 12:53   conf.dispatcher.d/vhosts/
            0  09-12-2018 12:53   conf.d/
            0  09-12-2018 12:53   conf.d/rewrites/
            0  09-12-2018 12:53   conf.d/whitelists/
            0  09-12-2018 12:53   conf.d/variables/
            0  11-01-2018 13:53   conf.d/enabled_vhosts/
            0  09-12-2018 12:53   conf.d/available_vhosts/
            0  09-12-2018 12:53   conf/
           88  09-12-2018 12:53   conf.modules.d/00-systemd.conf
         4913  09-12-2018 12:53   conf.dispatcher.d/available_farms/999_ams_publish_farm.any
          152  09-12-2018 12:53   conf.dispatcher.d/renders/ams_lc_renders.any
          490  09-12-2018 12:53   conf.dispatcher.d/clientheaders/ams_common_clientheaders.any
         1727  09-12-2018 12:53   conf.d/rewrites/base_rewrite.rules
           36  09-12-2018 12:53   conf.d/enabled_vhosts/aem_author.vhost
        11753  09-12-2018 12:53   conf/httpd.conf
          957  09-12-2018 12:53   conf.modules.d/00-proxy.conf
          944  09-12-2018 12:53   conf.dispatcher.d/available_farms/001_ams_lc_farm.any
          220  09-12-2018 12:53   conf.dispatcher.d/cache/ams_author_invalidate_allowed.any
           43  09-12-2018 12:53   conf.dispatcher.d/enabled_farms/999_ams_publish_farm.any
          516  09-12-2018 12:53   conf.d/welcome.conf
           37  09-12-2018 12:53   conf.d/enabled_vhosts/aem_publish.vhost
        13077  09-12-2018 12:53   conf/magic
           96  09-12-2018 12:53   conf.modules.d/02-dispatcher.conf
         2601  09-12-2018 12:53   conf.dispatcher.d/available_farms/000_ams_author_farm.any
          837  09-12-2018 12:53   conf.dispatcher.d/cache/ams_author_cache.any
           42  09-12-2018 12:53   conf.dispatcher.d/enabled_farms/000_ams_author_farm.any
         2926  09-12-2018 12:53   conf.d/autoindex.conf
         2555  09-12-2018 12:53   conf.d/available_vhosts/aem_lc.vhost
           41  09-12-2018 12:53   conf.modules.d/00-lua.conf
         2234  09-12-2018 12:53   conf.dispatcher.d/filters/ams_publish_filters.any
          220  09-12-2018 12:53   conf.dispatcher.d/cache/ams_publish_invalidate_allowed.any
          402  09-12-2018 12:53   conf.dispatcher.d/dispatcher.any
          573  09-12-2018 12:53   conf.d/whitelists/000_base_whitelist.rules
          871  09-12-2018 12:53   conf.d/available_vhosts/aem_flush.vhost
          139  09-12-2018 12:53   conf.modules.d/00-dav.conf
          742  09-12-2018 12:53   conf.dispatcher.d/filters/ams_author_filters.any
          557  09-12-2018 12:53   conf.dispatcher.d/cache/ams_publish_cache.any
          105  09-12-2018 12:53   conf.dispatcher.d/vhosts/ams_lc_vhosts.any
          101  09-12-2018 12:53   conf.dispatcher.d/vhosts/ams_publish_vhosts.any
         3582  09-12-2018 12:53   conf.d/dispatcher_vhost.conf
         2529  09-12-2018 12:53   conf.d/available_vhosts/aem_publish.vhost
          742  09-12-2018 12:53   conf.modules.d/00-mpm.conf
           88  09-12-2018 12:53   conf.dispatcher.d/filters/ams_lc_filters.any
          177  09-12-2018 12:53   conf.dispatcher.d/clientheaders/ams_lc_clientheaders.any
          366  09-12-2018 12:53   conf.d/README
         2723  09-12-2018 12:53   conf.d/available_vhosts/aem_author.vhost
         3739  09-12-2018 12:53   conf.modules.d/00-base.conf
          138  09-12-2018 12:53   conf.dispatcher.d/renders/ams_author_renders.any
           44  09-12-2018 12:53   conf.dispatcher.d/clientheaders/ams_publish_clientheaders.any
          112  09-12-2018 12:53   conf.dispatcher.d/vhosts/ams_author_vhosts.any
          580  09-12-2018 12:53   conf.d/variables/ams_default.vars
           35  09-12-2018 12:53   conf.d/enabled_vhosts/aem_flush.vhost
         1252  09-12-2018 12:53   conf.d/userdir.conf
          451  09-12-2018 12:53   conf.modules.d/01-cgi.conf
          321  09-12-2018 12:53   conf.dispatcher.d/renders/ams_publish_renders.any
          170  09-12-2018 12:53   conf.dispatcher.d/clientheaders/ams_author_clientheaders.any
          220  09-12-2018 12:53   conf.d/rewrites/xforwarded_forcessl_rewrite.rules
         1753  09-12-2018 12:53   conf.d/available_vhosts/aem_health.vhost
    ---------                     -------
        69017                     66 files
    

本頁內容