2016-08-24 73 views
2

我一直使用包管理器命令将AEM包部署到作为连续部署管道的一部分的作者节点。我现在将其扩展为直接部署到发布节点。我需要(根据节点所有者)以略微不同的方式做到这一点。如何通过REST API将AEM发布节点和作者节点分开

因为我编程这些交互,并且必须支持一大堆节点,所以我想知道管道是否可以调用某个端点,这对于作者或发布来说是独一无二的,所以我可以检测到这次选择了哪个端点?

对于上下文,这里是我正在做的调用的一个例子。

curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/samplepackage.zip?cmd=uninstall 

我很遗憾我还没有熟悉AEM而不是包管理器API。我从AEM CQ5 Tutorials得到了这个例子,但是没有发现任何直接有用的东西,也许是因为我不确定REST API与哪种节点有关。

如果我可以找到一个便宜且无害的GET,这对于其中一个或另一个而言是独特的,我将对其进行排序。

+0

您可以获得http://author.local.telegraph.co。uk:4502/system/console/status-slingsettings.json'来检查运行模式,但是你需要提供系统控制台的证书。无论如何,你为什么需要这样做?部署AEM实例时,将其设置为作者或发布者,并且以后无法更改。为了针对多个AEM实例执行脚本,无论如何都需要一个列表。该列表可能包含必要的元数据(无论实例是AEM作者还是发布者) – toniedzwiedz

+0

原因是经济。我不是脚本编写人员,管道实际上是一个支持N部署技术的复杂系统,AEM只是其中之一。理想情况下,系统可以存储一些额外的数据,如节点类型,但询问端点可能更便宜。我们可能会添加一个功能来存储节点类型,或者我们可能会这样做,这取决于我们得到的答案。 –

回答

1

我已经使用这个SlingSettings API来获取吊绳运行模式,您可以使用它来确定它是否是authorpublish。这是一个非常轻量级的通话。

http(s):<host:port>/system/console/status-slingsettings.json

0

AEM提供,除非你有不同的部署将这些实例部署包的runmode不可知的方式。

在大多数常规用例中,部署包对作者和发布都是相同的,部署路径也是如此,所有更改都是主机。我们为部署目的构建一个单独的pom项目,它可以将任何类型的包直接推送到指定为CI Job参数的任何节点。在我们的例子中,我们只用它来部署一个完整的应用程序包。

POM看起来是这样的 -

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>cms-parent</artifactId> 
     <groupId>com.myproject.cms</groupId> 
     <version>1.0.2</version> 
    </parent> 

    <artifactId>cms-deploy</artifactId> 
    <groupId>com.myproject.cms.deploy</groupId> 
    <packaging>pom</packaging> 
    <version>1.0.0</version> 
    <name> 
     AEM :: Deploy 
    </name> 

    <properties> 
     <app.cms.myproject.complete.version>1.0.0-SNAPSHOT</app.cms.myproject.complete.version> 
    </properties> 

    <build> 
     <plugins> 
      <!-- additionally deploy three further content-packages which are not part of the complete-package --> 
      <plugin> 
       <groupId>com.day.jcr.vault</groupId> 
       <artifactId>content-package-maven-plugin</artifactId> 
       <executions> 
        <execution> 
         <!-- override the default execution defined in the cq-parent by binding it to some invalid phase --> 
         <id>default-package</id> 
         <goals> 
          <goal>package</goal> 
         </goals> 
         <phase>foobar</phase> 
        </execution> 
        <execution> 
         <!-- override the default execution for install-package, which is called whenever you call deploy --> 
         <id>install-package</id> 
         <goals> 
          <goal>install</goal> 
         </goals> 
         <phase>foobar</phase> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
    <profiles> 

     <profile> 
      <id>install-myproject-complete</id> 
      <build> 
       <plugins> 
        <plugin> 
         <artifactId>content-package-maven-plugin</artifactId> 
         <groupId>com.day.jcr.vault</groupId> 
         <executions> 
          <!-- deploy the scripts and classes (part of the release) --> 
          <execution> 
           <id>install-myproject-complete</id> 
           <goals> 
            <goal>install</goal> 
           </goals> 
           <configuration> 
            <artifactId>myproject-complete</artifactId> 
            <groupId>com.myproject.cms.msites</groupId> 
            <version>${app.cms.myproject.complete.version}</version> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 

的,你可以创建CI Maven项目(我指的是詹金斯作为CI,你可以适应您的服务器),并设置它作为一个参数化建设接受hostdeployment version Build Params

下一步将配置源代码管理指向上述聚甲醛项目在供应链管理和配置Maven构建步骤 -

enter image description here

在目标和选项指定 - 对于作者的部署 -

-U clean install -Pinstall-myproject-complete -Dcrx.host=${host}-author.mysite.com -Dcrx.port=4502 -e -Dapp.cms.myproject.complete.version=${version} 

对于发布部署 -

-U clean install -Pinstall-myproject-complete -Dcrx.host=${host}-publish.mysite.com -Dcrx.port=4503 -e -Dapp.cms.myproject.complete.version=${version} 

这是基地配置,你可以进一步定制接受整个node_name/ip以及端口信息以保持单个pipleline部署

+0

感谢您的详细回复,但客户机构*部署过程的详细信息*对于每种节点类型都不相同。抱歉。 –

相关问题