Dispatcher 配置 manage-your-dispatcher-configurations
了解如何使用 Cloud Manager 部署 Dispatcher 配置文件
使用 Cloud Manager 部署 Dispatcher 配置 deploying-dispatcher-configurations
如果Web服务器和Dispatcher配置文件与标准AEM内容包一起存储在Git存储库中,则Cloud Manager可以部署这些文件。
若要使用此功能,Maven内部版本将生成一个.zip文件,其中至少包含两个目录: conf和conf.d。 可以使用 maven-assembly-plugin 生成此 .zip 文件。
Cloud Manager 使用内置的项目创建向导生成的项目具有自动创建的正确的 Maven 项目结构。 如果您不熟悉Adobe Managed Services (AMS),建议您使用此方法。
当您部署到 Dispatcher 实例时,实例上的目录会被 Git 存储库中的目录替换。 要在/etc/sysconfig/httpd中正确设置相应的环境变量,请与您的客户成功团队协作,因为Web服务器和Dispatcher配置文件通常需要特定于环境的详细信息。
适用于现有托管服务客户的 Dispatcher 配置 steps-for-configuring-dispatcher
要完成初始Dispatcher配置,请执行以下操作:
- 从客户成功团队获取当前生产配置文件。
- 删除特定于环境的数据(如发布渲染程序IP),并将其替换为变量。
- 在每个目标Dispatcher的键值对中定义所需的变量,并将其添加到每个实例上的变量文件夹中。
- 在暂存环境中测试更新的配置。
- 测试后,请请求客户成功团队部署到生产环境。
- 将文件提交到 Git 存储库。
- 通过 Cloud Manager 进行部署。
示例 example
虽然特定的文件和目录结构会因项目的具体情况而异,但此示例清晰地说明了如何构建项目以包含Apache和Dispatcher配置。
-
创建一个名为
dispatcher的子目录。在此处使用任意名称,但在此步骤中创建的目录名称必须与步骤1中使用的名称相同。
-
此子目录包含一个Maven模块,该模块使用
maven-assembly-plugin构建Dispatcher .zip文件。 在dispatcher目录中,创建一个包含此内容的pom.xml文件,并根据需要更改parent引用、artifactId和name。code language-xml <?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和name可以是其他值。 此处以
dispatcher为例。
- 与步骤1中一样,artifactId和name可以是其他值。 此处以
-
maven-assembly-plugin需要descriptor才能定义.zip文件的创建方式。 要创建此描述符,请在dispatcher子目录中创建一个名为assembly.xml的文件,该文件包含以下内容。 请注意,上述pom.xml文件中的第 26 行引用了此文件名。code language-xml <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> -
在 Dispatcher 子目录中创建一个名为
src的子目录(如上面第 11 行的 Assembly 描述符中所引用)来存储实际的 Apache 和 Dispatcher 配置。 在此src目录中,创建名为conf、conf.d、conf.dispatcher.d和conf.modules.d的目录。 -
在
conf、conf.d、conf.dispatcher.d和conf.modules.d目录中填入您的配置文件。 例如,默认配置包含这些文件和符号链接。code language-none 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 -
最后,在项目根目录下的
pom.xml文件中,添加一个<module>元素以包含Dispatcher模块。例如,如果现有模块列表为以下内容:
code language-xml <modules> <module>core</module> <module>ui.apps</module> <module>ui.content</module> </modules>将其更改为以下内容:
code language-xml <modules> <module>core</module> <module>ui.apps</module> <module>ui.content</module> <module>dispatcher</module> </modules>- 如步骤 1 中所述,
<module>元素的值必须与创建的目录名称匹配。
- 如步骤 1 中所述,
-
要进行测试,请在项目的根目录中运行
mvn clean package。 您会在输出中看到类似这样的行。code language-none [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您还可以解压缩此文件来查看其内容。
code language-shell $ 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