Last active
April 28, 2022 14:18
-
-
Save donchev7/9266ae2357306d8765c4b99ae450449e to your computer and use it in GitHub Desktop.
agent setup
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 | |
set -e | |
sudo rm -rf /var/lib/apt/lists/* | |
apt-get update | |
apt-cache gencaches | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common \ | |
apt-transport-https \ | |
lsb-release \ | |
wget \ | |
gnupg | |
wget http://archive.ubuntu.com/ubuntu/pool/main/z/zip/zip_3.0-11build1_amd64.deb -P /tmp | |
dpkg --force-all -i /tmp/zip_3.0-11build1_amd64.deb | |
wget http://security.ubuntu.com/ubuntu/pool/main/u/unzip/unzip_6.0-21ubuntu1.1_amd64.deb -P /tmp | |
dpkg --force-all -i /tmp/unzip_6.0-21ubuntu1.1_amd64.deb | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
apt-key fingerprint 0EBFCD88 | grep "9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88" | |
if [ $? -eq 0 ] | |
then | |
echo "All good" | |
else | |
echo "Wrong fingerprint" | |
exit 1 | |
fi | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
curl -sL https://packages.microsoft.com/keys/microsoft.asc | | |
gpg --dearmor | | |
sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null | |
apt-key fingerprint EB3E94ADBE1229CF | grep "BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF" | |
if [ $? -eq 0 ] | |
then | |
echo "All good" | |
else | |
echo "Wrong fingerprint" | |
exit 1 | |
fi | |
MENDER_ARTIFACT_TOOL=/tmp/mender-artifact | |
curl https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/master/linux/mender-artifact --output $MENDER_ARTIFACT_TOOL --silent | |
chmod +x $MENDER_ARTIFACT_TOOL | |
if [ ! -f $MENDER_ARTIFACT_TOOL ]; then | |
echo "ERROR: Mender Artifact Tool: '${MENDER_ARTIFACT_TOOL}' not found." | |
else | |
echo "Downloaded mender-artifact tool" | |
fi | |
cp $MENDER_ARTIFACT_TOOL /usr/bin/ | |
AZ_REPO=$(lsb_release -cs) | |
add-apt-repository \ | |
"deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ \ | |
$(lsb_release -cs) main" | |
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - | |
apt-get update | |
apt-get install -y docker-ce docker-ce-cli containerd.io azure-cli nodejs | |
mkdir -p /mnt/docker | |
cat <<EOF > /etc/docker/daemon.json | |
{ | |
"data-root": "/mnt/docker" | |
} | |
EOF | |
echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf | |
sysctl -p | |
usermod -aG docker azureuser || true | |
systemctl restart docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment