Script to start AWS EC2 with Docker and commands to start SWARM and Jenkinks for CI
Last active
July 7, 2017 07:33
-
-
Save DariuszLuber/6df91251f999f75fa587896047df7c16 to your computer and use it in GitHub Desktop.
AWS - create Docker Swarm
This file contains hidden or 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 | |
sudo apt-get update -y | |
# Docker 1.13 prepare procedure | |
sudo apt-get install --no-install-recommends \ | |
apt-transport-https \ | |
curl \ | |
software-properties-common | |
sudo apt-get install -y --no-install-recommends \ | |
linux-image-extra-$(uname -r) \ | |
linux-image-extra-virtual | |
curl -fsSL 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | sudo apt-key add | |
sudo add-apt-repository \ | |
"deb https://packages.docker.com/1.13/apt/repo/ \ | |
ubuntu-$(lsb_release -cs) \ | |
main" | |
sudo apt-get update -y | |
sudo apt-get install -y docker-engine=1.13.1~cs3-0~ubuntu-xenial \ | |
git-core | |
#RUN Swarm Visualizer | |
sudo docker run -it -d --name myvisualizer -p 4000:8080 -v /var/run/docker.sock:/var/run/docker.sock dockersamples/visualizer |
This file contains hidden or 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
#INIT SWARM MASTER - Set ip addres which will be assigned to your VM used for master | |
sudo docker swarm init --advertise-addr 10.0.1.100 | |
#To get token for another Swarm master run command | |
#docker swarm join-token master | |
#To get token Swarm worker run command | |
#docker swarm join-token worker | |
#RUN SERVICE | |
docker service create \ | |
--replicas 10 \ | |
--name nginx \ | |
--update-delay 10s \ | |
--update-parallelism 2 \ | |
nginx:latest |
This file contains hidden or 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
#RUN Jenkins | |
#Initial password in /var/jenkins_home/secrets/initialAdminPassword | |
sudo mkdir /var/jenkins_home | |
sudo chmod 777 /var/jenkins_home | |
sudo docker run --name myjenkins -p 4100:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home jenkins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment