Skip to content

Instantly share code, notes, and snippets.

@VJftw
Last active October 29, 2019 12:36
Show Gist options
  • Select an option

  • Save VJftw/0e3607c5ce7caa85ff9125658dc1fac5 to your computer and use it in GitHub Desktop.

Select an option

Save VJftw/0e3607c5ce7caa85ff9125658dc1fac5 to your computer and use it in GitHub Desktop.
Jenkins AWS EC2 Slave Plugin Init Script
# AMI: ami-f95ef58a (Standard Ubuntu 14.04)
# - Remote user: ubuntu
# - Remote FS root: /var/jenkins
# - Spot instance: true
sudo apt-get update -y
sudo apt-get install -y apt-transport-https ca-certificates
echo "--> Setting up Docker repository"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee -a /etc/apt/sources.list.d/docker.list
echo "--> Installing Docker, Python, Java, Git, pv"
sudo apt-get -y update
sudo apt-get install -y \
linux-image-extra-$(uname -r) \
docker-engine \
openjdk-7-jdk \
git \
python3 \
python3-dev \
pv
echo "--> Adding user to Docker group"
sudo groupadd docker
sudo usermod -aG docker ubuntu
echo "--> Installing pip, invoke, docker-py, invoke-docker-flow"
sudo curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo pip install \
invoke \
docker-py \
invoke-docker-flow
echo "--> Starting Docker"
sudo service docker start
echo ""
echo "--> Creating Jenkins Workspace"
echo ""
sudo mkdir -p /var/jenkins
sudo chown -R ubuntu:ubuntu /var/jenkins
sudo chmod -R 770 /var/jenkins
echo ""
echo "--> Done!"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment