Created
September 20, 2019 00:37
-
-
Save takenoko-str/dfb7f11c0ef7a8e1111687b87b5c8118 to your computer and use it in GitHub Desktop.
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 | |
# install | |
sudo apt install -y awscli | |
sudo apt install -y jq | |
# setup | |
cat << EOF > ~/.aws/config | |
[default] | |
region = ap-northeast-1 | |
EOF | |
DEPLOYMENT_ENV=$1 | |
aws ssm get-parameters --name "${GIT_REPO_NAME}.${DEPLOYMENT_ENV}.env" \ | |
| jq -r ".Parameters[].Value" \ | |
| base64 --decode \ | |
> /home/ubuntu/.env |
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 | |
sudo apt-get -y remove docker docker-engine docker.io containerd runc | |
sudo apt-get update | |
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
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" | |
sudo apt-get update | |
sudo apt-get -y install docker-ce docker-ce-cli containerd.io | |
sudo gpasswd -a $USER docker | |
sudo systemctl restart docker.service | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
docker-compose --version | |
#git clone https://$GIT_USER:$GIT_PASSWD@bitbucket.org/$GIT_REPO_USER/$GIT_REPO_NAME.git |
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 | |
# https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/mon-scripts.html | |
# ディスク監視 | |
DATA_ROOT=/data | |
sudo apt-get update | |
sudo apt-get install unzip | |
sudo apt-get install libwww-perl libdatetime-perl | |
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O | |
unzip CloudWatchMonitoringScripts-1.2.2.zip && \ | |
rm CloudWatchMonitoringScripts-1.2.2.zip && \ | |
cd aws-scripts-mon | |
sudo echo "*/5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=$DATA_ROOT --from-cron" >> /var/spool/cron/crontabs/ubuntu | |
crontab -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment