Last active
December 22, 2015 14:28
-
-
Save myster-t/6485559 to your computer and use it in GitHub Desktop.
AWS EC2 user data script to start beanstalkd instance (Amazon Linux instance type)
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 -ex | |
set -e -x | |
# Log output | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
# Update yum first | |
yum groupinstall "Development Tools" -y | |
yum update -y | |
# Download /etc/default/beanstalkd | |
curl -J -O https://gist.github.com/phaitour/6482469/download | |
tar -zxvf *.tar.gz | |
/bin/cp -f gist*/beanstalkd /etc/default/ | |
ln -s /etc/default/beanstalkd /etc/beanstalkd.conf | |
rm -rf gist* | |
# Download /etc/init/beanstalkd.conf | |
curl -J -O https://gist.github.com/phaitour/6482467/download | |
tar -zxvf *.tar.gz | |
/bin/cp -f gist*/beanstalkd.conf /etc/init/ | |
rm -rf gist* | |
# Create beanstalkd user | |
/usr/sbin/useradd -c "beanstalk user" -s /bin/false -r -m -d /var/lib/beanstalkd/ beanstalkd | |
# Compile latest version of beanstalkd | |
wget https://github.com/kr/beanstalkd/archive/v1.9.tar.gz | |
tar -zxvf v1.9.tar.gz | |
cd beanstalkd-1.9 | |
make | |
mv beanstalkd /usr/bin/beanstalkd-1.9 | |
cd /usr/bin | |
rm -rf beanstalkd | |
ln -s beanstalkd-1.9 beanstalkd | |
# Start beanstalks with upstart | |
initctl reload-configuration | |
initctl start beanstalkd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment