Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
Created March 30, 2010 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threedaymonk/349022 to your computer and use it in GitHub Desktop.
Save threedaymonk/349022 to your computer and use it in GitHub Desktop.
Build/status server setup
Setting up Hudson
Install the "Result-dependent shell script" plugin from http://github.com/downloads/threedaymonk/hudson_plugins/result-dependent-shell-script.hpi
Add an "Execute shell" task as the first task in the build process:
curl -d "project=${JOB_NAME}" -d "status=building" http://localhost:9292/build
Enable result-dependent shell script as a post-build action
When build fails:
AUTHOR=`git log HEAD^..HEAD --pretty=format:"%cn <%ce>" | head -n 1`
curl -d "project=${JOB_NAME}" -d "status=fail" -d "author=${AUTHOR}" http://localhost:9292/build
When build passes:
AUTHOR=`git log HEAD^..HEAD --pretty=format:"%cn <%ce>" | head -n 1`
curl -d "project=${JOB_NAME}" -d "status=pass" -d "author=${AUTHOR}" http://localhost:9292/build
# Start with Ubuntu server 9.10 64-bit
# Create a user account called "build" when prompted
# Become root
sudo su
# Add Chromium repository and install key
cat > /etc/apt/sources.list.d/chromium.list <<END
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
END
add-apt-key ppa:chromium-daily/ppa
# Install necessary packages
apt-get update
apt-get install \
openssh-server tcsh curl git-core exuberant-ctags avahi-autoipd \
avahi-daemon avahi-utils ttf-droid htop mingetty subversion \
chromium-browser xserver-xorg xinit x11-xserver-utils \
msttcorefonts xdotool awesome ruby irb rake build-essential \
libmysql-ruby libopenssl-ruby libjson-ruby libprogressbar-ruby \
ruby-dev mysql-server mysql-client wget curl checkinstall ri rdoc
# Gems
cd /tmp && \
curl -L http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz \
| tar zxv && \
cd rubygems-* && \
sudo checkinstall -y ruby setup.rb && \
sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
gem install --no-rdoc --no-ri \
sinatra haml json eventmachine em-http-request
# Install edash
su build
cd && \
git clone git://github.com/threedaymonk/edash.git && \
cd edash && \
git submodule update --init && \
exit
tee /etc/init.d/edash <<END
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
export RUBYOPT=rubygems
. /lib/lsb/init-functions
do_start () {
cd /home/build/edash
sudo -u build nohup scripts/server >/dev/null &
sudo -u build nohup rackup >/dev/null &
}
case "\$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '\$1' not supported" >\&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: \$0 start|stop" >\&2
exit 3
;;
esac
END
chmod +x /etc/init.d/edash
/etc/init.d/edash start
# Start edash at boot
update-rc.d edash defaults
# Create a frontend user and give it access to sound and video acceleration
useradd -d /home/frontend -G video,audio -s /bin/bash frontend
# Set up .xinitrc to start X straight into Chromium (no DE)
sudo -u frontend tee /home/frontend/.xinitrc <<END
#!/bin/bash
xset -dpms s off
xsetroot -solid black
awesome &
xdotool mousemove 3000 3000
(sleep 3; xsetroot -cursor blank-cursor blank-cursor) &
chromium-browser --app=http://127.0.0.1:9292/build
END
# Set up awesome to run Chromium full screen
sudo -u frontend mkdir -p /home/frontend/.config/awesome
sudo -u frontend tee /home/frontend/.config/awesome/rc.lua <<END
require("awful")
thistag = tag(1)
thistag.screen = 1
awful.layout.set(awful.layout.suit.max.fullscreen, thistag)
thistag.selected = true
END
# Make an invisible cursor
sudo -u frontend tee /home/frontend/blank-cursor <<END
#define nn1_width 16
#define nn1_height 16
static unsigned char nn1_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END
# Make frontend start an X server (and thereby chromium) immediately on login if tty is tty7
sudo -u frontend tee /home/frontend/.profile <<END
if [ \`tty\` = "/dev/tty7" ]; then
startx
fi
END
# Add a tty7 that logs in as frontend automatically at boot
cat > /etc/init/tty7.conf <<END
# tty7 - mingetty
#
# This service maintains a mingetty on tty7 from the point the system is
# started until it is shut down again.
start on runlevel [23]
stop on runlevel [!23]
respawn
exec /sbin/mingetty --autologin=frontend tty7
END
# Allow frontend to start X
sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
# Install Hudson
cat > /etc/apt/sources.list.d/hudson.list <<END
deb http://hudson-ci.org/debian binary/
END
curl -s http://hudson-ci.org/debian/hudson-ci.org.key | apt-key add -
apt-get update && \
apt-get install hudson
# Give Hudson an SSH key, name and email for git
git config --global user.email "build@buildbot.local"
git config --global user.name "buildbot"
su hudson
ssh-keygen -N "" -f ~/.ssh/id_rsa
# Start Hudson
/etc/init.d/hudson start
# Set up WiFi
sudo apt-get install bcmwl-kernel-source
cat > /etc/wpa_supplicant/wpa_supplicant.conf <<END
network={
ssid="Made By Many"
psk="..."
scan_ssid=1
}
END
cat >> /etc/modules <<END
wl
ieee80211_crypt
ieee80211_crypt_tkip
ieee80211_crypt_ccmp
ieee80211_crypt_wep
END
# Edit /etc/modprobe.d/blacklist.conf
blacklist b43
blacklist b43legacy
blacklist b43-legacy
# blacklist ssb
cat > /etc/network.interfaces <<END
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth1
iface eth1 inet dhcp
pre-up wpa_supplicant -B -ieth1 -c /etc/wpa_supplicant/wpa_supplicant.conf -Dwext
pre-up sleep 5
post-down killall -q wpa_supplicant
END
# Reboot and check
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment