Skip to content

Instantly share code, notes, and snippets.

@kylegibson
Forked from jlward/setup_slave.sh
Last active October 11, 2015 12:28
Show Gist options
  • Save kylegibson/3859018 to your computer and use it in GitHub Desktop.
Save kylegibson/3859018 to your computer and use it in GitHub Desktop.
Configure Jenkin slave
#!/bin/sh
main() {
configure_ssh_known_hosts
configure_mysql_ram_disk
configure_idle_tracking
}
configure_ssh_known_hosts() {
echo configuring ssh known hosts
# Fetch github's SSH host information and add it to known_hosts to
# prevent git clone from asking whether it is valid or not
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
# Also add github.com's ip address because it seems to be breaking otherwise
ssh-keyscan -t rsa $(dig +short A github.com) >> $HOME/.ssh/known_hosts
# Hard-code this IP documented by github. We haven't experienced a failure as a result of this, but just in case...
# https://help.github.com/articles/error-permission-denied-publickey#check-that-you-are-connecting-to-the-correct-server
ssh-keyscan -t rsa 207.97.227.239 >> $HOME/.ssh/known_hosts
chmod 600 $HOME/.ssh/known_hosts
chown ubuntu.ubuntu $HOME/.ssh/known_hosts
}
configure_mysql_ram_disk() {
echo configuring mysql ram disk
sudo service mysql stop;
sudo cp -pRL /var/lib/mysql /dev/shm/mysql;
sudo cat > /etc/mysql/conf.d/ramdisk.cnf << EOF
[mysqld]
datadir = /dev/shm/mysql
EOF
sudo service mysql start;
}
configure_idle_tracking() {
echo configuring idle tracking
mkdir -p /tmp/idle-tracking
chmod 777 /tmp/idle-tracking
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment