Is there a curl method to configure replication from author to publishers?
Solved! Go to Solution.
Views
Replies
Total Likes
I figured this out, and thought I would post what I have working.
This is a simple bash script that will create a author->publisher replication agent page and set the properties.
#!/bin/bash
if [ $# -ne 2 ] ; then
echo "Syntax Error!"
echo "$0 <publisher_hostname_to_replicate_to> <author hostname>"
exit 1
fi
AUTHOR_NAME=$2 # This is the hostname of the author.
PUBLISHER_NAME=$1 #This is the hostname of the publisher that the author will replicate to.
REPL_USER="admin" # This should be set to the publisher's replication user accountname.
REPL_PASSWORD="admin" # This should be set to the publisher's password for the replication user.
AUTHOR_PORT="4502"
PUBLISHER_PORT="4503"
AUTHOR="http://${AUTHOR_NAME}:${AUTHOR_PORT}"
PUBLISHER="http://${PUBLISHER_NAME}:${PUBLISHER_PORT}"
URI="${PUBLISHER}/bin/receive?sling:authRequestLogin=1"
#First, create the page.
curl -u admin:admin --data "status=browser&cmd=createPage&label=${PUBLISHER_NAME}&title=${PUBLISHER_NAME}&parentPath=/etc/replication/agents.author&template=/libs/cq/replication/templates/agent" ${AUTHOR}/bin/wcmcommand
# set the jcr properties.
curl -u admin:admin -F "jcr:primaryType=cq:Page" \
-F "jcr:primaryType=nt:unstructured" \
-F "jcr:content/jcr:title=${PUBLISHER_NAME}" \
-F "jcr:content/sling:resourceType=cq/replication/components/agent" \
-F "jcr:content/loglevel=info" \
-F "jcr:content/retryDelay=60000" \
-F "jcr:content/serializationType=durbo" \
-F "jcr:content/transportUser=admin" \
-F "jcr:content/transportUri=${URI}" \
-F "jcr:content/transportPassword=admin" \
-F "jcr:content/jcr:description=${PUBLISHER_NAME} replication" \
-F "jcr:content/enabled=true" \
${AUTHOR}/etc/replication/agents.author/${PUBLISHER_NAME}
Views
Replies
Total Likes
Hi,
as the replication agents are configured via standard JCR nodes, you can use the Sling Post Servlet to create the correct node structure with the required properties.
kind regards,
Jörg
Views
Replies
Total Likes
Are there any examples of that for replication?
Views
Replies
Total Likes
I figured this out, and thought I would post what I have working.
This is a simple bash script that will create a author->publisher replication agent page and set the properties.
#!/bin/bash
if [ $# -ne 2 ] ; then
echo "Syntax Error!"
echo "$0 <publisher_hostname_to_replicate_to> <author hostname>"
exit 1
fi
AUTHOR_NAME=$2 # This is the hostname of the author.
PUBLISHER_NAME=$1 #This is the hostname of the publisher that the author will replicate to.
REPL_USER="admin" # This should be set to the publisher's replication user accountname.
REPL_PASSWORD="admin" # This should be set to the publisher's password for the replication user.
AUTHOR_PORT="4502"
PUBLISHER_PORT="4503"
AUTHOR="http://${AUTHOR_NAME}:${AUTHOR_PORT}"
PUBLISHER="http://${PUBLISHER_NAME}:${PUBLISHER_PORT}"
URI="${PUBLISHER}/bin/receive?sling:authRequestLogin=1"
#First, create the page.
curl -u admin:admin --data "status=browser&cmd=createPage&label=${PUBLISHER_NAME}&title=${PUBLISHER_NAME}&parentPath=/etc/replication/agents.author&template=/libs/cq/replication/templates/agent" ${AUTHOR}/bin/wcmcommand
# set the jcr properties.
curl -u admin:admin -F "jcr:primaryType=cq:Page" \
-F "jcr:primaryType=nt:unstructured" \
-F "jcr:content/jcr:title=${PUBLISHER_NAME}" \
-F "jcr:content/sling:resourceType=cq/replication/components/agent" \
-F "jcr:content/loglevel=info" \
-F "jcr:content/retryDelay=60000" \
-F "jcr:content/serializationType=durbo" \
-F "jcr:content/transportUser=admin" \
-F "jcr:content/transportUri=${URI}" \
-F "jcr:content/transportPassword=admin" \
-F "jcr:content/jcr:description=${PUBLISHER_NAME} replication" \
-F "jcr:content/enabled=true" \
${AUTHOR}/etc/replication/agents.author/${PUBLISHER_NAME}
Views
Replies
Total Likes
Views
Likes
Replies