Cloud, Managed Services

AEM Auto Provisioning and Configuring with Chef in AWS

Purpose:

Our goal is to achieve a single/multiple server environment set-ups along with AEM and Dispatcher setup on AWS servers using chef.

Business solution: 

With this process, we can automate the Server creation, installation, and configuration of AEM (Author, Publish and Dispatcher). This process will save a lot of time and will help to overcome manual errors.

Prerequisites:

  1. Jenkins Server
  2. AWS SDK (install in Jenkins with AWS Access keys)
  3. Chef workstation (install in Jenkins with Chef server starter kit)
  4. Chef Server

Architectural Specifications :

Process:

  1. Build a form using parameterized build option in Jenkins as shown in the screenshot.
  2. Create a shell script to spin servers and configure servers based on above parameters. Following are some commands to spin servers using AWS CLI and to capture Public IP Address and Chef bootstrap commands to configure AEM.

To Spin AEM instances:

# aws ec2 run-instances –image-id  <amazon machine id> –count <No of servers> –instance-type <Instancetype> –key-name <keyname> –security-group-ids <securitygroupid> –subnet-id <subnet-id>

 

To Capture Public IP Address:

# aws ec2 describe-instances –instance-ids | grep ‘Value\|PublicIpAddress’ | cut -d “\”” -f4 | sed ‘s/\n/ /’

Chef Boot Strap command to Configure AEM:

# sudo knife bootstrap $ip -N $ip -x root -P $password –run-list recipe[aem-pub]

Configure the jenkins user with sudo access to execute knife and AWS commands. Place chef-repo directory in jenkins home directory.

Replication Agent Configration:

Following is the curl command to configure AEM replication agent.

agent_port=”4503″

agent_host=”$Publish_ip”

agent_title=”Default Agent”

agent_name=”publish”

agent_url=”http://${agent_host}:${agent_port}/bin/receive?sling:authRequestLogin=1″

agent_password=”admin”

agent_user=”admin”

curl -s -u admin:admin1 -X POST \

–data-urlencode “./sling:resourceType=cq/replication/components/agent” \

–data-urlencode “./jcr:lastModified=” \

–data-urlencode “./jcr:lastModifiedBy=” \

–data-urlencode “_charset_=utf-8” \

–data-urlencode “:status=browser” \

–data-urlencode “./jcr:title=${agent_title}” \

–data-urlencode “./jcr:description=” \

–data-urlencode “./enabled=true” \

–data-urlencode “./enabled@Delete=” \

–data-urlencode “./serializationType=durbo” \

–data-urlencode “./retryDelay=60000” \

–data-urlencode “./userId=” \

–data-urlencode “./logLevel=info” \

–data-urlencode “./reverseReplication@Delete=” \

–data-urlencode “./transportUri=${agent_url}” \

–data-urlencode “./transportUser=${agent_user}” \

–data-urlencode “./transportPassword=${agent_password}” \

–data-urlencode “./transportNTLMDomain=” \

–data-urlencode “./transportNTLMHost=” \

–data-urlencode “./ssl=” \

–data-urlencode “./protocolHTTPExpired@Delete=” \

–data-urlencode “./proxyHost=” \

–data-urlencode “./proxyPort=” \

–data-urlencode “./proxyUser=” \

–data-urlencode “./proxyPassword=” \

–data-urlencode “./proxyNTLMDomain=” \

–data-urlencode “./proxyNTLMHost=” \

–data-urlencode “./protocolInterface=” \

–data-urlencode “./protocolHTTPMethod=” \

–data-urlencode “./protocolHTTPHeaders@Delete=” \

–data-urlencode “./protocolHTTPConnectionClose@Delete=true” \

–data-urlencode “./protocolConnectTimeout=” \

–data-urlencode “./protocolSocketTimeout=” \

–data-urlencode “./protocolVersion=” \

–data-urlencode “./triggerSpecific@Delete=” \

–data-urlencode “./triggerModified@Delete=” \

–data-urlencode “./triggerDistribute@Delete=” \

–data-urlencode “./triggerOnOffTime@Delete=” \

–data-urlencode “./triggerReceive@Delete=” \

–data-urlencode “./noStatusUpdate@Delete=” \

–data-urlencode “./noVersioning@Delete=” \

–data-urlencode “./queueBatchMode@Delete=” \

–data-urlencode “./queueBatchWaitTime=” \

–data-urlencode “./queueBatchMaxSize=” \

http://$Author_ip:4502/etc/replication/agents.author/${agent_name}/jcr:content

 

Dispatcher Flush Agent Configuration:

 

flush_title=”Dispatcher Flush”

flush_name=”flush”

flush_front_fqdn=”$Dispatcher_ip”

flush_front_port=”80″

echo $flush_title $flush_name $flush_front_fqdn $flush_front_port

curl -u admin:admin1 –head http://$Dispatcher_ip:4503

curl -u admin:admin1 -X POST \

–data-urlencode “./sling:resourceType=cq/replication/components/agent” \

–data-urlencode “./jcr:lastModified=” \

–data-urlencode “./jcr:lastModifiedBy=” \

–data-urlencode “_charset_=utf-8” \

–data-urlencode “:status=browser” \

–data-urlencode “./jcr:title=${flush_title}” \

–data-urlencode “./jcr:description=Agent that sends flush requests to the dispatcher.” \

–data-urlencode “./enabled=true” \

–data-urlencode “./enabled@Delete=” \

–data-urlencode “./serializationType=flush” \

–data-urlencode “./retryDelay=60000” \

–data-urlencode “./userId=” \

–data-urlencode “./logLevel=error” \

–data-urlencode “./reverseReplication@Delete=” \

–data-urlencode “./transportUri=http://${flush_front_fqdn}:${flush_front_port}/dispatcher/invalidate.cache” \

–data-urlencode “./transportUser=” \

–data-urlencode “./transportPassword=” \

–data-urlencode “./transportNTLMDomain=” \

–data-urlencode “./transportNTLMHost=” \

–data-urlencode “./ssl=” \

–data-urlencode “./protocolHTTPExpired@Delete=” \

–data-urlencode “./proxyHost=” \

–data-urlencode “./proxyPort=” \

–data-urlencode “./proxyUser=” \

–data-urlencode “./proxyPassword=” \

–data-urlencode “./proxyNTLMDomain=” \

–data-urlencode “./proxyNTLMHost=” \

–data-urlencode “./protocolInterface=” \

–data-urlencode “./protocolHTTPMethod=” \

–data-urlencode “./protocolHTTPHeaders@Delete=” \

–data-urlencode “./protocolHTTPConnectionClose@Delete=true” \

–data-urlencode “./protocolConnectTimeout=” \

–data-urlencode “./protocolSocketTimeout=” \

–data-urlencode “./protocolVersion=” \

–data-urlencode “./triggerSpecific@Delete=” \

–data-urlencode “./triggerModified@Delete=” \

–data-urlencode “./triggerDistribute@Delete=” \

–data-urlencode “./triggerOnOffTime@Delete=” \

–data-urlencode “./triggerReceive@Delete=” \

–data-urlencode “./noStatusUpdate@Delete=” \

–data-urlencode “./noVersioning@Delete=” \

–data-urlencode “./queueBatchMode@Delete=” \

–data-urlencode “./queueBatchWaitTime=” \

–data-urlencode “./queueBatchMaxSize=” \

http://$Author_ip:4502/etc/replication/agents.author/${flush_name}/jcr:content

Observations:

This process will create servers in AWS and install the Adobe AEM and dispatcher. And configure the Replication agents and Dispatcher flush agents.

About The Author

Leave a Reply

*