Last active
August 30, 2019 06:19
-
-
Save orlea/1151b27245f89cfff4dce95f4a75fbbd to your computer and use it in GitHub Desktop.
EC2 SpotInstanceからdocker swarmに自動参加, EFSマウント
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 | |
apt update | |
DEBIAN_FRONTEND=noninteractive apt upgrade -yq | |
apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
apt update | |
apt install prometheus-node-exporter docker-ce docker-ce-cli containerd.io nfs-common -y | |
mkdir /mnt/efs | |
echo "<AWS-EFS-Address>:/ /mnt/efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport nofail 0 0" >> /etc/fstab | |
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport <AWS-EFS-Address>:/ /mnt/efs | |
docker swarm join --token <token> <manager-ip:port> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment