Skip to content

Instantly share code, notes, and snippets.

@newbamboo
Created January 6, 2009 10:45
Show Gist options
  • Save newbamboo/43765 to your computer and use it in GitHub Desktop.
Save newbamboo/43765 to your computer and use it in GitHub Desktop.
(
cat <<'EOF'
nameserver 192.168.1.10
EOF
) > /etc/resolv.conf
echo "Setting up newbamboo user and home dir...."
echo "newbamboo:password:1000:1000:New Bamboo,,,:/home/newbamboo:/bin/bash" > /etc/newusers
newusers /etc/newusers
mkdir /home/newbamboo
echo "Adding github.com to known hosts..."
mkdir /home/newbamboo/.ssh
(
cat <<'EOF'
|1|8eqN4xuoGvB12TBLB+kGArZfdUU=|8z8fE4/MfCToiwu6LL2cJns2gQQ= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|dLxXwkqxcBrkLSbmVrIsZB1s81c=|aLepgeWvVbyK/DHTwN5EikJx1zA= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
EOF
) > /home/newbamboo/.ssh/known_hosts
(
cat <<'EOF'
gem: --no-rdoc --no-ri -s http://gems.nbwd.co.uk
EOF
) > /home/newbamboo/.gemrc
chown newbamboo:newbamboo -R /home/newbamboo
# Add unstable packages so we can get ruby 1.8.6 (http://randomba.org/2008/01/installing-ruby-186-on-debian-etch-stable/)
# Also use Dom0's apt-proxy
(
cat <<'EOF'
deb http://192.168.1.10:9999/debian/ etch main contrib non-free
deb-src http://192.168.1.10:9999/debian/ etch main contrib non-free
deb http://www.backports.org/debian etch-backports main contrib non-free
EOF
) > /etc/apt/sources.list
wget -O - http://backports.org/debian/archive.key | apt-key add -
apt-get update
# Install Ruby 1.8.6 from backports
apt-get -y --force-yes -t etch-backports install ruby1.8 ruby1.8-dev libopenssl-ruby1.8 git-core
ln -s /usr/bin/ruby1.8 /usr/bin/ruby
# All other packages
apt-get install -y --force-yes build-essential irb apache2-mpm-prefork apache2-prefork-dev apache2.2-common apache2-utils libexpat1 ssl-cert memcached dbconfig-common mysql-client mysql-server libmysqlclient15-dev libsqlite3-0 libsqlite3-dev
# Add if you want rmgack: libmagick9-dev
# Removed postfix and mailutils because it has an interactive installation
# Rubygems
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
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem
gem update --system
cd ..
rm -rf rubygems-1.3.1 rubygems-1.3.1.tgz
# Standard gems
gem install BlueCloth
gem install capistrano
gem install dm-tags
gem install data_objects do_sqlite3 do_mysql dm-core dm-more
gem install hpricot
gem install memcache-client
gem install merb
gem install rails
gem install mongrel
gem install mysql
gem install RedCloth
gem install rspec
gem install ultrasphinx
gem install ruby-openid will_paginate
gem install ruby-debug rspec-rails
# Add if you want rmgack: gem install rmagick -v=1.15.10
gem install image_science
gem install passenger
gem install rubigen
# gem install god
echo "Setting up Phusion Passenger..."
yes | passenger-install-apache2-module
echo "Configuring Apache..."
(
cat <<'EOF'
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /usr/bin/ruby1.8
PassengerMaxPoolSize 2
PassengerDefaultUser newbamboo
EOF
) > /etc/apache2/mods-available/passenger.load
ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
(
cat <<'EOF'
<VirtualHost *:80>
DocumentRoot /var/www/app/current/public
<Location "/">
AuthType Basic
AuthName "Restricted Area"
AuthBasicProvider file
AuthUserFile /var/www/htpasswd
require valid-user
</Location>
</VirtualHost>
EOF
) > /etc/apache2/sites-available/app
rm /etc/apache2/sites-enabled/000-default
ln -s /etc/apache2/sites-available/app /etc/apache2/sites-enabled/000-app
/etc/init.d/apache2 restart
echo "Setting up /var/www/app dir for Capistrano..."
mkdir /var/www/app
mkdir /var/www/app/shared
mkdir /var/www/app/shared/system
mkdir /var/www/app/shared/pids
mkdir /var/www/app/shared/log
mkdir /var/www/app/releases
chown newbamboo:newbamboo -R /var/www/app
echo "Setting up basic auth..."
echo "Added default login newbamboo / password"
echo ""
echo "Please enter a username for the client to use:"
read USERNAME
echo "And now a password:"
read PASSWORD
sudo htpasswd -b -c /var/www/htpasswd $USERNAME $PASSWORD
sudo htpasswd -b /var/www/htpasswd newbamboo password
echo ""
echo "---------------------------"
echo ""
echo "You're nearly ready to go!"
echo "(1) deploy your app to /var/www/app/current"
echo "(2) sudo /etc/init.d/apache2 restart"
echo "(3) visit http://`hostname`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment