-
-
Save callado4/3662725 to your computer and use it in GitHub Desktop.
[ClearServe] Scripts related to Jenkins client setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if running bash | |
if [ -n "$BASH_VERSION" ]; then | |
# include .bashrc if it exists | |
if [ -f "$HOME/.bashrc" ]; then | |
. "$HOME/.bashrc" | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# As root ( via `sudo su -` ): | |
# Initialize ephemeral storage | |
curl https://raw.github.com/gist/3085368/ephemeral > /etc/init.d/ephemeral | |
chmod +x /etc/init.d/ephemeral | |
ln -s ../init.d/ephemeral /etc/rcS.d/S10ephemeral | |
/etc/init.d/ephemeral | |
ln -s /mnt/jenkins /var/jenkins | |
ln -s /mnt/mongodb /var/lib/mongodb | |
ln -s /mnt/tmp /tmp | |
# Set logrotate to keep only one unit (day or week) of each log | |
for f in /etc/logrotate.d/* /etc/logrotate.conf ; do | |
sed -i 's/rotate [0-9]*$/rotate 1/' $f | |
done | |
apt-get update | |
apt-get install -y git build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev libreadline-dev libxml2-dev autoconf libxslt-dev xvfb libgl1-mesa-dri xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic | |
# Set up Xvfb (virtual framebuffer) | |
curl https://raw.github.com/gist/3085368/xvfb > /etc/init.d/xvfb | |
chmod +x /etc/init.d/xvfb | |
update-rc.d xvfb defaults | |
service xvfb start | |
apt-get install -y openjdk-6-jdk | |
apt-get install -y imagemagick libmagick9-dev | |
# Firefox setup (install dependencies, then uninstall to downgrade) | |
apt-get install -y firefox | |
apt-get remove -y firefox firefox-globalmenu | |
wget http://releases.mozilla.org/pub/mozilla.org/firefox/releases/12.0/linux-x86_64/en-US/firefox-12.0.tar.bz2 -O /tmp/firefox.tar.bz2 | |
cd /usr/local | |
tar xjf /tmp/firefox.tar.bz2 | |
cd bin | |
ln -s ../firefox/firefox . | |
ln -s ../firefox/firefox-bin . | |
# Set up MongoDB | |
curl https://raw.github.com/gist/3085368/sources.list.10gen >> /etc/apt/sources.list | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
apt-get update | |
apt-get install -y mongodb-10gen | |
update-rc.d mongodb defaults | |
service mongodb start | |
# Set up Redis | |
apt-get install -y redis-server | |
# User-level setup | |
useradd -k /etc/skel -m -s /bin/bash jenkins | |
mkdir /home/jenkins/.ssh | |
cp /home/ubuntu/.ssh/authorized_keys /home/jenkins/.ssh/authorized_keys | |
chown -R jenkins:jenkins /home/jenkins/.ssh | |
chmod 700 /home/jenkins/.ssh | |
chmod 600 /home/jenkins/.ssh/authorized_keys | |
curl https://raw.github.com/gist/3085368/sudoers.wheel >> /etc/sudoers | |
groupadd wheel | |
usermod -G wheel jenkins | |
mkdir -p /var/jenkins/workspace | |
chown -R jenkins:jenkins /var/jenkins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# As user jenkins ( via `sudo su - jenkins` ): | |
sudo su -l jenkins | |
ssh-keygen -q -t rsa -N "" -f .ssh/id_rsa | |
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
rvm install 1.9.2 | |
rvm install 1.9.3 | |
git clone git://github.com/creationix/nvm.git ~/.nvm | |
curl https://raw.github.com/gist/3085368/bash_login.jenkins > /home/jenkins/.bash_login | |
mv /home/jenkins/.bashrc /home/jenkins/.bashrc~ | |
curl https://raw.github.com/gist/3085368/bashrc.jenkins > /home/jenkins/.bashrc | |
cat /home/jenkins/.bashrc~ >> /home/jenkins/.bashrc | |
rm /home/jenkins/.bashrc~ | |
nvm install v0.6.18 | |
curl https://raw.github.com/gist/3085368/ssh_config >> /home/jenkins/.ssh/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
. ~/.nvm/nvm.sh | |
if [ -z "$PS1" ]; then | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
PATH=node_modules/.bin:$PATH | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Initialize ephemeral storage on /mnt | |
mkdir -p /mnt/jenkins/workspace | |
chown -R jenkins:jenkins /mnt/jenkins | |
mkdir -p /mnt/mongodb | |
chown mongodb:mongodb /mnt/mongodb | |
mkdir -p /mnt/tmp | |
chmod 1777 /mnt/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 10gen MongoDB repository | |
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host github.com | |
StrictHostKeyChecking no | |
Host heroku.com | |
StrictHostKeyChecking no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%wheel ALL=(ALL) NOPASSWD: ALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
XVFB=/usr/bin/Xvfb | |
XVFBARGS=":99 -screen 0 1024x768x24 -fbdir /var/run -ac" | |
PIDFILE=/var/run/xvfb.pid | |
case "$1" in | |
start) | |
echo -n "Starting virtual X frame buffer: Xvfb" | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping virtual X frame buffer: Xvfb" | |
start-stop-daemon --stop --quiet --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
*) | |
echo "Usage: /etc/init.d/xvfb {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment