Permalink
Browse files

Spike to try out the travis cookbooks

  • Loading branch information...
Brian Cunnie & Matthew Kocher
Brian Cunnie & Matthew Kocher committed Dec 8, 2011
1 parent e31c638 commit 9d776b8904cdae986f2efb1242d5841e871e522d
@@ -3,55 +3,50 @@
env | grep -q "APP_USER=" || echo "Please set APP_USER environment variable"
# perl -e 'print crypt("password", "salt"),"\n"'
-getent passwd $APP_USER >/dev/null 2>&1 || useradd $APP_USER -p DEADBEEFSCRYPTEDPASSWORD #sa3tHJ3/KuYvI would be password
+sudo getent passwd $APP_USER >/dev/null 2>&1 || sudo useradd $APP_USER -s /bin/bash -p DEADBEEFSCRYPTEDPASSWORD #sa3tHJ3/KuYvI would be password
-# copy root's authorized keys to APP_USER
-mkdir -p /home/$APP_USER/.ssh
-touch /home/$APP_USER/.ssh/authorized_keys
-chmod 700 /home/$APP_USER/.ssh
-chmod 600 /home/$APP_USER/.ssh/authorized_keys
-chown -R $APP_USER /home/$APP_USER/.ssh
-authorized_keys_string=`cat /root/.ssh/authorized_keys`
-grep -sq "$authorized_keys_string" /home/$APP_USER/.ssh/authorized_keys || cat /root/.ssh/authorized_keys >> /home/$APP_USER/.ssh/authorized_keys
+sudo groupadd vagrant
+sudo useradd vagrant -s /bin/bash -p DEADBEEFSCRYPTEDPASSWORD -g vagrant -m
+
+# copy root's authorized keys to APP_USER
+sudo mkdir -p /home/$APP_USER/.ssh
+sudo touch /home/$APP_USER/.ssh/authorized_keys
+sudo chmod 700 /home/$APP_USER/.ssh
+sudo chmod 600 /home/$APP_USER/.ssh/authorized_keys
+sudo chown -R $APP_USER /home/$APP_USER
+authorized_keys_string=`cat /home/ubuntu/.ssh/authorized_keys`
+sudo grep -sq "$authorized_keys_string" /home/$APP_USER/.ssh/authorized_keys || cat /home/ubuntu/.ssh/authorized_keys | sudo tee -a /home/$APP_USER/.ssh/authorized_keys
## enable ssh password auth
-perl -p -i -e 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
-/etc/init.d/sshd reload
+sudo perl -p -i -e 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
+sudo restart ssh
-# install epel
-rpm -q epel-release-5-4.noarch || rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
+# get the latest servers
+sudo apt-get update -q
# install git
-yum -y install git
+sudo apt-get install --install-suggests --assume-yes -q git
-# rvm prereqs
-yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libffi-devel openssl-devel iconv-devel java
-
-# passwordless sudo
-sudo_string='ALL ALL = (ALL) NOPASSWD: ALL'
-grep "$sudo_string" /etc/sudoers || echo "$sudo_string" >> /etc/sudoers
+# mri ruby prereqs
+sudo apt-get install --install-suggests --assume-yes -q build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
-cat <<'BOOTSTRAP_AS_USER' > /home/$APP_USER/bootstrap_as_user.sh
-set -e
+# jruby
+sudo apt-get install --install-suggests --assume-yes -q curl g++ openjdk-6-jre-headless ant openjdk-6-jdk
-export APP_USER=$1
+curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer -o /tmp/rvm-installer
+sudo chmod +x /tmp/rvm-installer
+sudo /tmp/rvm-installer --version latest
-mkdir -p /home/$APP_USER/rvm/src
-curl -Lskf http://github.com/wayneeseguin/rvm/tarball/0f7135af8f0b6139716637d242a82442dd7fef09 | tar xvz -C/home/$APP_USER/rvm/src --strip 1
-cd "/home/$APP_USER/rvm/src" && ./install
-
-rvm_include_string='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'
-grep "$rvm_include_string" ~/.bashrc || echo "$rvm_include_string" >> ~/.bashrc
-
-cat <<'RVMRC_CONTENTS' > ~/.rvmrc
+cat <<'RVMRC_CONTENTS' | sudo tee /etc/rvmrc
rvm_install_on_use_flag=1
rvm_trust_rvmrcs_flag=1
rvm_gemset_create_on_use_flag=1
RVMRC_CONTENTS
-BOOTSTRAP_AS_USER
-chmod a+x /home/$APP_USER/bootstrap_as_user.sh
-su - $APP_USER /home/$APP_USER/bootstrap_as_user.sh $APP_USER
-rm /home/$APP_USER/bootstrap_as_user.sh
+sudo usermod -G root,admin,rvm $APP_USER
+
+# passwordless sudo
+sudo_string='ALL ALL = (ALL) NOPASSWD: ALL'
+sudo grep "$sudo_string" /etc/sudoers || echo "$sudo_string" | sudo tee -a /etc/sudoers
@@ -7,7 +7,6 @@
raise "rvm_ruby_string not set - are you using RVM" unless ENV['rvm_ruby_string']
set :rvm_ruby_string, ENV['rvm_ruby_string']
- set :rvm_type, :user
set :app_name, ci_conf['app_name']
set(:app_dir) { "/var/#{stage}/#{app_name}" }
set :user, ci_conf['app_user']
@@ -18,19 +17,19 @@
desc "check for server availability - run this task in a loop to see if the slice is ready to connect to"
task :check_for_server_availability do
ci_setup
- set :user, "root"
+ set :user, "ubuntu"
run "echo Server is available"
end
desc "bootstrap"
task :bootstrap do
ci_setup
app_user = user
- set :user, "root"
+ set :user, "ubuntu"
set :default_shell, "/bin/bash"
- upload "script/bootstrap_server.sh", "/root/bootstrap_server.sh"
- run "chmod a+x /root/bootstrap_server.sh"
- run "APP_USER=#{app_user} /root/bootstrap_server.sh"
+ upload "script/bootstrap_server.sh", "/home/ubuntu/bootstrap_server.sh"
+ run "chmod a+x /home/ubuntu/bootstrap_server.sh"
+ run "APP_USER=#{app_user} /home/ubuntu/bootstrap_server.sh"
end
desc "setup and run chef"
@@ -0,0 +1,39 @@
+travis_yaml = <<eos
+json:
+ rvm:
+ default: 1.8.7
+ rubies:
+ - name: 1.9.3
+ - name: rbx-head
+ arguments: --branch 2.0.testing
+ using: 1.8.7
+ - name: rbx-head
+ arguments: -n d19 --branch 2.0.testing -- --default-version=1.9
+ using: 1.9.3
+ check_for: rbx-head-d19
+ - name: 1.8.7
+ - name: jruby
+ - name: ree
+ - name: 1.9.2
+ - name: ruby-head
+ - name: 1.8.6
+ gems:
+ - bundler
+ - rake
+ - chef
+ aliases:
+ rbx: rbx-head
+ rbx-2.0: rbx-head
+ rbx-2.0.0pre: rbx-head
+ rbx-18mode: rbx-head
+ rbx-19mode: rbx-head-d19
+ mysql:
+ server_root_password: ""
+ postgresql:
+ max_connections: 256
+ travis_build_environment:
+ use_tmpfs_for_builds: false
+eos
+
+travis_config = YAML.load(travis_yaml)
+default.merge(travis_config['json'])
@@ -1,10 +1,12 @@
-include_recipe "pivotal_server::imagemagick"
-include_recipe "pivotal_server::sqlite"
-include_recipe "pivotal_server::libxml_prereqs"
-include_recipe "pivotal_server::nginx"
-include_recipe "pivotal_server::file"
-include_recipe "pivotal_server::curl_devel"
-include_recipe "pivotal_server::ca_cert"
-include_recipe "pivotal_server::node_js"
-include_recipe "pivotal_ci::id_rsa"
-include_recipe "pivotal_ci::jenkins"
+# include_recipe "pivotal_server::imagemagick"
+# include_recipe "pivotal_server::sqlite"
+# include_recipe "pivotal_server::libxml_prereqs"
+# include_recipe "pivotal_server::nginx"
+# include_recipe "pivotal_server::file"
+# include_recipe "pivotal_server::curl_devel"
+# include_recipe "pivotal_server::ca_cert"
+# include_recipe "pivotal_server::node_js"
+# include_recipe "pivotal_ci::id_rsa"
+# include_recipe "pivotal_ci::jenkins"
+
+execute "touch /tmp/help_im_stuck_in_the_machine"
@@ -1,8 +1,80 @@
cookbook_paths:
- ./chef/cookbooks/
+- ./chef/cookbooks-travis/
recipes:
# - pivotal_server::mysql_5_5
-- pivotal_server::postgres
+# - pivotal_server::postgres
+- travis_build_environment
+- apt
+- build-essential
+- networking_basic
+- openssl
+- sysctl
+- git
+- scons
+#
+# additional libraries needed to run headless WebKit,
+# build parsers, for ossp-uuid to work and so on
+#
+- libqt4
+- libgdbm
+- libncurses
+- libossp-uuid
+- ragel
+- imagemagick
+#
+# JDK and related build toolchain
+#
+- java
+- ant
+- maven
+#
+# Ruby via RVM (default Debian installations are secure at the cost of
+# being unusable without PATH tweaking, for our VMs we can just go with RVM.
+# This includes rubygems, bundler and rake.
+#
+- rvm
+- rvm::multi
+#
+# Python and pip
+#
+- python
+- python::pip
+#
+# Node.js
+#
+- nodejs::multi
+#
+# Data stores
+#
+- sqlite
+- postgresql::client
+- postgresql::server
+- mysql::client
+- mysql::server
+- redis
+- riak
+- mongodb
+- couchdb
+- memcached
+#
+# Messaging
+#
+- rabbitmq::with_management_plugin
+#
+# Search
+#
+- sphinx::all
+#
+# Headless WebKit, browsers, Selenium toolchain, etc
+#
+- xserver
+- firefox
+#
+# Debugging & support
+#
+- emacs::nox
+- vim
- pivotal_ci::default
env_variable_switches:
APP_NAME:
View
@@ -59,7 +59,7 @@ namespace :ci do
puts "Launching server... (this costs money until you stop it)"
server = aws_connection.servers.create(
- :image_id => 'ami-d4de25bd',
+ :image_id => 'ami-e358958a',
:flavor_id => server_config['flavor_id'] || 'm1.large',
:key_name => ec2_key_pair_name,
:groups => [security_group_name]

0 comments on commit 9d776b8

Please sign in to comment.