Skip to content

Instantly share code, notes, and snippets.

@stovak
Created November 20, 2011 16:50
Show Gist options
  • Save stovak/1380472 to your computer and use it in GitHub Desktop.
Save stovak/1380472 to your computer and use it in GitHub Desktop.
RightScript to install LAMP/drush/Drush make
#!/bin/bash -ex
logger -t RightScale "\n\nStarting Script..."
/usr/bin/apt-get update
logger -t RightScale "\n\nApt-Get Update..."
/usr/bin/apt-get -y -q upgrade
logger -t RightScale "\n\nAutoremove/Autoclean..."
/usr/bin/apt-get autoremove
/usr/bin/apt-get autoclean
logger -t RightScale "\n\nInstalling Apache..."
/usr/bin/apt-get -y -q install chkconfig imagemagick apache2 apache2-mpm-prefork
/sbin/chkconfig --add 35 apache2
logger -t RightScale "\n\nInstalling MySQL..."
/usr/bin/apt-get -y -q install mysql-client-5.1 mysql-server-5.1
/sbin/chkconfig --add 35 mysql
logger -t RightScale "\n\nInstalling PHP..."
/usr/bin/apt-get -y -q install php5 php5-cli php5-mysql libapache2-mod-php5 php5-mcrypt php5-curl php5-gd php-pear
/usr/sbin/service apache2 restart
/usr/bin/pear upgrade
logger -t RightScale "\n\nInstalling Drush..."
/usr/bin/pear channel-discover pear.drush.org
/usr/bin/pear install drush/drush
logger -t RightScale "\n\nInstalling Jenkins..."
/usr/bin/wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
/bin/sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
/usr/bin/apt-get update
/usr/bin/apt-get -y install jenkins > $LOGFILE 2>&1 &
logger -t RightScale "\n\Adding Jenkins Proxy..."
/usr/sbin/a2enmod proxy
/usr/sbin/a2enmod proxy_http
/usr/sbin/a2enmod vhost_alias
/bin/sed -i 's/--webroot/--prefix=\/build\ --webroot/g' /etc/default/jenkins
logger -t RightScale "\n\Forcing Jenkins Reload..."
/usr/sbin/service jenkins force-reload
_old="<\/VirtualHost>"
_new="\n\<Proxy \*\>\nOrder deny,allow\nAllow from all\n<\/Proxy>\nProxyPreserveHost on\nProxyPass \/build http:\/\/localhost:8080\/build\n\<\/VirtualHost\>\n"
/bin/sed -i "s/$_old/$_new/g" /etc/apache2/sites-available/default
/usr/sbin/service apache2 restart
chown -R jenkins.adm /var/www
logger -t RightScale "\n\Adding Jenkins jobs..."
su jenkins
/usr/bin/git config --global user.email "$ADMIN_EMAIL_ADDRESS"
/usr/bin/git config --global user.name "Jenkins auto-build bot"
/bin/mkdir ~/.drush
cd ~/.drush
/usr/bin/git clone --branch 6.x-2.x http://git.drupal.org/project/drush_make.git
cd ~/jobs
git clone http://github.com/stovak/dpk_jenkins
cp -R dpk_jenkins/* .
rm -Rf dpk_jenkins
exit
logger -t RightScale "\n\Forcing Jenkins Reload..."
/usr/sbin/service jenkins force-reload
rm /var/www/index.html
cat "<?php phpinfo();" > /var/www/index.php
@stovak
Copy link
Author

stovak commented Nov 20, 2011

It's not replacing old for new

@celeduc
Copy link

celeduc commented Sep 25, 2012

that "su jenkins" doesn't actually work for you, does it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment