HTTPS clone URL
Subversion checkout URL
Clone this wiki locally
Deploylib is a scala tool for setting up and interacting with a cluster of compute nodes, either privately owned or on Amazon EC2. It is also integrates with Mesos, the cluster management platform, so it is capable of launching and managing Mesos masters, slaves, and Mesos applications. In particular, there is a framework for running and managing Java or Scala services (jars) and web services (wars via Jetty).
Install SCADS (see the "How to install and build SCADS" section of the wiki Home).
In addition to the prerequisites, you must set the following environment variables:
Once these variables are set different regions can be accessed by using the following objects (USEast1, USWest1, EUWest1, APNortheast1, APSoutheast1).
Your ssh keypair can be imported into EC2 using
The following ports need to be open in the default security group: 22, 2181, 5050, 8080, 8081, 9000. This can be done automatically by calling
The deploylib console can be started for any SCADS subproject by using running
bin/sbt <subproject>/deploy-console. The deploy-console contains a pointer to all the jars needed to execute the current project on a remote machine.
Deploylib is preconfigured to control both machines on EC2 and machines on the rcluster. Commands on sets of machines can be run in parallel by prepending function names with the letter p (ex: pmap, pforeach, pflatMap). For example:
scala> import deploylib.rcluster._ import deploylib.rcluster._ scala> (r2 !? "hostname").trim res3: java.lang.String = r2 scala> val inst = EC2West.runInstance scala> inst.publicDnsName scala> USWest1.activeInstances.pmap(_ !? "date").map(_.trim) res2: List[java.lang.String] = List(Sun Sep 25 03:57:27 UTC 2011, Sun Sep 25 03:57:27 UTC 2011, Sun Sep 25 03:57:27 UTC 2011, Sun Sep 25 03:57:28 UTC 2011, Sun Sep 25 03:57:28 UTC 2011)
You can use deploy lib to start and manage a Mesos cluster running on EC2. To familiarize yourself with Mesos, check out the Mesos homepage.
Create a cluster object by running
new mesos.Cluster(<region>), where region is either
EC2West. Here are a some of the most important functions you'll be using on a mesos cluster:
cluster.setup()- start ec2 instances, if they aren't running, and setup services for the mesos-master, zookeeper, and at least one mesos slave. Optionally specify
numSlavesto start more than one.
cluster.restart[Masters|Slaves|ZooKeepers]()- restart mesos services.
cluster.addSlaves(num)- Add slaves to a running mesos cluster.
cluster.stopAllInstances- stop all ec2 instances
More commands can be found in the scalaDoc for mesos.Cluster.
To start a scads storage node on EC2:
import org.apache.zookeeper.CreateMode val engineTask = ScalaEngineTask(cluster.zooKeeperRoot.getOrCreate("/home/marmbrus/scads").createChild("testCluster", mode=CreateMode.PERSISTENT_SEQUENTIAL).canonicalAddress).toJvmTask serviceScheduler !? RunExperimentRequest(engineTask :: Nil)