Permalink
Browse files

made smaller bootstrap.sh.erb, put ubuntu installs in lib diretory

  • Loading branch information...
1 parent e9e1f95 commit 2c6834086ab8613714762964b6f4446a3160fc11 Pete Skomoroch committed May 22, 2009
View
@@ -273,6 +273,8 @@ def terminate_cluster
# TODO, refactor - pulling out blocks to helper methods terminate_nodes, delete_security_groups, etc
+ # TODO: only terminate nodes which are in not in shutting down or terminated state...
+
self.nextstep! # cancellation_requested -> cancelling_job
puts 'background cluster shutdown initiated...'
@@ -1,40 +1,26 @@
#!/bin/bash
#
-# ubuntu MPI cluster installs and config https://help.ubuntu.com/community/MpichCluster
-#
+# Basic bootstrap script run on boot in the master node
+# Warning: don't add more commands to this file, user-data space is limited
apt-get -y update
apt-get -y upgrade
-
-useradd -d /home/elasticwulf -m elasticwulf
-usermod -G admin elasticwulf
-
-apt-get -y install build-essential
-apt-get -y install libboost-serialization-dev
-apt-get -y install libexpat1-dev
-apt-get -y install libopenmpi1 openmpi-bin openmpi-common
-apt-get -y install libopenmpi-dev
-
-cat <<EOF >> /mnt/hello.c
-#include <stdio.h>
-#include <mpi.h>
-
-int main(int argc, char *argv[]) {
- int numprocs, rank, namelen;
- char processor_name[MPI_MAX_PROCESSOR_NAME];
-
- MPI_Init(&argc, &argv);
- MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Get_processor_name(processor_name, &namelen);
-
- printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
-
- MPI_Finalize();
- }
-EOF
-
-mpicc /mnt/hello.c -o /mnt/hello
-
-### check processors available
-# cat /proc/cpuinfo
-mpirun --mca btl ^openib -np 2 hello
+apt-get -y install git-core
+# TODO: optionally put this home directory on an EBS volume for snapshots/NFS mounting...
+
+groupadd elasticwulf
+useradd -d /mnt/elasticwulf -m elasticwulf -g elasticwulf elasticwulf
+ln -s /mnt/elasticwulf /home/elasticwulf
+chmod 775 -R /home/elasticwulf/
+chown -R elasticwulf:elasticwulf /home/elasticwulf
+addgroup admin
+adduser elasticwulf admin
+echo '' >> /etc/sudoers
+echo '# Members of the admin group may gain root ' >> /etc/sudoers
+echo '%admin ALL=NOPASSWD:ALL' >> /etc/sudoers
+
+# Fetch latest elasticwulf code
+cd /home/elasticwulf
+su - elasticwulf -c "git clone git://github.com/datawrangling/elasticwulf-service.git"
+# kick off larger boot script:
+# TODO: need to render AWS keys, job_id, REST url, repo into this ERB & pass to scripts
+bash /home/elasticwulf/elasticwulf-service/lib/bootscripts/ubuntu_installs.sh
@@ -4,7 +4,7 @@
set :application, "elasticwulf-service"
set :scm, :git
-set :repository, "git://github.com/datawrangling/#{application}.git"
+set :repository, "git://github.com/datawrangling/elasticwulf-service.git"
set :branch, "master"
default_run_options[:shell] = false
@@ -0,0 +1,60 @@
+#!/bin/bash
+# ubuntu MPI cluster installs and config https://help.ubuntu.com/community/MpichCluster
+apt-get -y install build-essential
+apt-get -y install libboost-serialization-dev
+apt-get -y install libexpat1-dev
+apt-get -y install libopenmpi1 openmpi-bin openmpi-common
+apt-get -y install libopenmpi-dev
+
+su - elasticwulf -c "
+cat <<EOF >> /home/elasticwulf/hello.c
+#include <stdio.h>
+#include <mpi.h>
+
+int main(int argc, char *argv[]) {
+ int numprocs, rank, namelen;
+ char processor_name[MPI_MAX_PROCESSOR_NAME];
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Get_processor_name(processor_name, &namelen);
+
+ printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
+
+ MPI_Finalize();
+ }
+EOF"
+
+# Quick test of MPI
+su - elasticwulf -c "mpicc /home/elasticwulf/hello.c -o /home/elasticwulf/hello"
+### check number of processors available
+# cat /proc/cpuinfo
+su - elasticwulf -c "mpirun --mca btl ^openib -np 2 /home/elasticwulf/hello"
+
+# ruby and ruby gems...
+apt-get -y install ruby-full build-essential
+wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
+tar xzvf rubygems-1.3.1.tgz
+cd rubygems-1.3.1
+sudo ruby setup.rb
+sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
+sudo gem update --system
+
+gem install right_http_connection --no-rdoc --no-ri
+gem install right_aws --no-rdoc --no-ri
+gem install activeresource --no-ri --no-rdoc
+
+# TODO: will we have a client gem???
+
+# then we run a "GET" to get all the job properties for that id on the master node.
+# we can fetch the indicated files from s3, (the buckets should be owned by the same AWS key)
+# need to trigger /nextstep at start of job
+# then run the mpi command / bash script indicated,
+# finally, we send the output files up to the s3 bucket indicated
+# when that is complete, we trigger nextstep again.
+
+# s3.put(bucket_name, 'S3keyname.forthisfile', File.open('localfilename.dat'))
+
+
+
@@ -1,45 +0,0 @@
-#!/bin/bash
-#
-# ubuntu MPI cluster installs and config https://help.ubuntu.com/community/MpichCluster
-#
-apt-get -y update
-apt-get -y upgrade
-
-useradd -d /home/elasticwulf -m elasticwulf
-usermod -G admin elasticwulf
-
-apt-get -y install build-essential
-apt-get -y install libboost-serialization-dev
-apt-get -y install libexpat1-dev
-apt-get -y install libopenmpi1 openmpi-bin openmpi-common
-apt-get -y install libopenmpi-dev
-
-cat <<EOF >> /mnt/hello.c
-#include <stdio.h>
-#include <mpi.h>
-
-int main(int argc, char *argv[]) {
- int numprocs, rank, namelen;
- char processor_name[MPI_MAX_PROCESSOR_NAME];
-
- MPI_Init(&argc, &argv);
- MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Get_processor_name(processor_name, &namelen);
-
- printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
-
- MPI_Finalize();
- }
-EOF
-
-mpicc /mnt/hello.c -o /mnt/hello
-
-### check processors available
-# cat /proc/cpuinfo
-mpirun --mca btl ^openib -np 2 hello
-
-
-
-
-

0 comments on commit 2c68340

Please sign in to comment.