Skip to content

Instantly share code, notes, and snippets.

@jmakeig
Created March 4, 2013 20:52
Show Gist options
  • Save jmakeig/5085547 to your computer and use it in GitHub Desktop.
Save jmakeig/5085547 to your computer and use it in GitHub Desktop.
#! /bin/bash
# Script to bootstrap an instance of timbrrr with actual data.
# Author: Justin Makeig <jmakeig@marklogic.com>
# Assumptions:
# - UNIX and bash. This should also be possible for Windows, but the syntax might be slightly different
# - Ports 9001 is available for an HTTP app server and 9002 is available for an XDBC server
# - mlcp is downloaded and installed at $MLCPPATH below
# Variables: change to suit your envrionment
# The user doing the inserting and configuration update. It assumes admin role today.
ADMINUSER="admin"
ADMINPASS="admin"
# The MarkLogic hostname against which to run the Configuration Manager and the mlcp process
MLHOST="localhost"
# The local path to the mlcp.sh script
MLCPPATH=~/lib/MarkLogic/marklogic-contentpump-1.0.2/bin
# The mlcp command used to do the export
# "$MLCPPATH"/mlcp.sh export -host localhost -port 9002 -username "$ADMINUSER" -password "$ADMINPASS" -mode local -output_file_path ./timbrrr -output_type archive
# Create a directory into which we'll download and from which we'll import into the database
mkdir timbrrr
cd timbrrr
# Download the mlcp archives from S3
curl -O https://s3-eu-west-1.amazonaws.com/timbrrr/20130304120350-0800-0000{00,02,03,04,08,09,10,11,16,17,19}-XML.zip
curl -O https://s3-eu-west-1.amazonaws.com/timbrrr/20130304120350-0800-0000{01,05,06,07,12,13,14,15,18,20,21}-TEXT.zip
# Download the configuration package for the HTTP app server that runs the code and the XDBC app server that does the mlcp loading
curl -O https://s3-eu-west-1.amazonaws.com/timbrrr/timbrrr-apserver_db.xml
# Install the above package to create or update the timbrrr and two app servers (HTTP and XDBC)
curl --anyauth --user "$ADMINUSER":"$ADMINPASS" -H "Content-Type: application/xml" --data-binary @timbrrr-apserver_db.xml http://"$MLHOST":8002/manage/v1/package/install
# Finally import the content from the archives that were downloaded above
"$MLCPPATH"/mlcp.sh import -host localhost -port 9002 -username "$ADMINUSER" -password "$ADMINPASS" -mode local -input_file_path ~/tmp/timbrrr -input_file_type archive
# Cross fingers that this all worked here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment