Skip to content

Commit

Permalink
Add clustering support to Puppet AWS scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Woods committed Jun 21, 2013
1 parent ca39218 commit 47a4cf8
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 8 deletions.
5 changes: 5 additions & 0 deletions modules/tomcat7/lib/facter/private-ip.rb
@@ -0,0 +1,5 @@
Facter.add("ip_address") do
setcode do
Facter::Util::Resolution.exec('/usr/bin/curl http://169.254.169.254/latest/meta-data/local-ipv4')
end
end
1 change: 1 addition & 0 deletions modules/tomcat7/manifests/fcrepo-webapp.pp
Expand Up @@ -14,6 +14,7 @@
source => "/tmp/${war}",
require => [Exec['download'],
Package['tomcat7'],
File['/etc/default/tomcat7'],
],
}

Expand Down
16 changes: 11 additions & 5 deletions modules/tomcat7/manifests/init.pp
Expand Up @@ -41,12 +41,18 @@
$install_admin = true,
$data_dir = '/opt/fcrepo4-data',
$repo_config = 'classpath:/config/async-indexing/repository.json',
# $repo_config = 'classpath:/config/clustered/repository.json',
$etc_default_tomcat = 'tomcat7/default-tomcat7.erb',
# $etc_default_tomcat = 'tomcat7/default-tomcat7-clustered.erb',
) {

include yourkit

$yourkitdir = "$yourkit::yourkit"
$jre_package = "${jre}-jre-headless"
$private_ip = "${ip_address}"

notify {"$ip_address":}

package { 'tomcat7':
ensure => installed,
Expand All @@ -65,9 +71,9 @@

file { '/etc/tomcat7/server.xml':
owner => 'root',
require => Package['tomcat7'],
notify => Service['tomcat7'],
content => template('tomcat7/server.xml.erb'),
notify => Service['tomcat7'],
require => Package['tomcat7'],
}

file { $data_dir:
Expand All @@ -80,9 +86,9 @@

file { '/etc/default/tomcat7':
owner => 'root',
require => Package['tomcat7'],
content => template("${etc_default_tomcat}"),
notify => Service['tomcat7'],
content => template('tomcat7/default-tomcat7.erb'),
require => Package['tomcat7'],
}

service { 'tomcat7':
Expand All @@ -93,6 +99,6 @@
File['/etc/default/tomcat7'],
Exec['untar yourkit'],
],
}
}

}
85 changes: 85 additions & 0 deletions modules/tomcat7/templates/default-tomcat7-clustered.erb
@@ -0,0 +1,85 @@
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat7.
TOMCAT7_USER=tomcat7

# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat7.
TOMCAT7_GROUP=tomcat7

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk

# You may pass JVM startup parameters to Java here. If unset, the default
# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC
#
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved
# response time). If you use that option and you run Tomcat on a machine with
# exactly one CPU chip that contains one or two cores, you should also add
# the "-XX:+CMSIncrementalMode" option.
#JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
JAVA_OPTS="-server -Xmx2048m -XX:MaxPermSize=256m -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.index.location=<%= data_dir %>/mode/indexes"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.CacheDirPath=<%= data_dir %>/ispn"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.alternative.CacheDirPath=<%= data_dir %>/ispn-alt"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.binary.CacheDirPath=<%= data_dir %>/ispn-binary"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.binary.alternative.CacheDirPath=<%= data_dir %>/ispn-binary-alt"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.activemq.dir=<%= data_dir %>/active-mq"
JAVA_OPTS="${JAVA_OPTS} -Dcom.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.default.objectStoreDir=<%= data_dir %>/object-store-default"
JAVA_OPTS="${JAVA_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=<%= data_dir %>/object-store"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=<%= repo_config %>"

###
# Clustering
###
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.infinispan.cache_configuration=config/infinispan/clustered/infinispan.xml"

JAVA_OPTS="${JAVA_OPTS} -Djgroups.tcp.address=<%= private_ip %>"

JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.numOwners=2 -Djava.net.PreferIPv4Stack=true"

# The jgroups-ec2.xml file is included in ispn's jars
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.jgroups.configuration=jgroups-ec2.xml"

# This property overwrites the S3 bucketname variable in jgroups-ec2.xml
JAVA_OPTS="${JAVA_OPTS} -Djgroups.s3.bucket=fcrepo4-cluster-0"


# YourKit Profiling
#JAVA_OPTS="${JAVA_OPTS} -agentpath:/opt/<%= yourkitdir %>/bin/linux-x86-64/libyjpagent.so"

#set fcrepo4 baseUrl for fixity-service
JAVA_OPTS="${JAVA_OPTS} -Dorg.fcrepo.fixity.fcrepo.url=http://localhost:8080/fcrepo/rest -Dorg.fcrepo.fixity.brokerurl=tcp://localhost:61616"


#setup logging config
JAVA_OPTS="${JAVA_OPTS} -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties"


# To enable remote debugging uncomment the following line.
# You will then be able to use a java debugger on port 8000.
#JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=javac

# Use the Java security manager? (yes/no, default: no)
#TOMCAT7_SECURITY=no

# Number of days to keep logfiles in /var/log/tomcat7. Default is 14 days.
#LOGFILE_DAYS=14
# Whether to compress logfiles older than today's
#LOGFILE_COMPRESS=1

# Location of the JVM temporary directory
# WARNING: This directory will be destroyed and recreated at every startup !
#JVM_TMP=/tmp/tomcat7-temp

# If you run Tomcat on port numbers that are all higher than 1023, then you
# do not need authbind. It is used for binding Tomcat to lower port numbers.
# NOTE: authbind works only with IPv4. Do not enable it when using IPv6.
# (yes/no, default: no)
#AUTHBIND=no
6 changes: 3 additions & 3 deletions site/site.pp
@@ -1,9 +1,9 @@
# This file is used by the cloud-init magic.
node default {

class { 'tomcat7':
jre => 'openjdk-7',
}
class { 'tomcat7':
jre => 'openjdk-7',
}

tomcat7::fcrepo-webapp { "fcrepo webapp":
url => 'http://ci.fcrepo.org/jenkins/job/fcrepo4/lastSuccessfulBuild/org.fcrepo\$fcrepo-webapp/artifact/org.fcrepo/fcrepo-webapp/4.0-SNAPSHOT/fcrepo-webapp-4.0-SNAPSHOT.war',
Expand Down

0 comments on commit 47a4cf8

Please sign in to comment.