Skip to content

Instantly share code, notes, and snippets.

@ruxkor
Last active March 12, 2018 15:23
Show Gist options
  • Save ruxkor/bef9609385830eed7d6c92a981f3f27c to your computer and use it in GitHub Desktop.
Save ruxkor/bef9609385830eed7d6c92a981f3f27c to your computer and use it in GitHub Desktop.
Install the azurefile docker volume driver on ubuntu with systemd
#!/bin/bash -e
# Run with `sudo`
STORAGEACCOUNT_NAME=$1
STORAGEACCOUNT_KEY=$2
if [ -z "$1" ]; then echo "Storage Account Name not set..." && exit 2 ; fi
if [ -z "$2" ]; then echo "Storage Account Key not set..." && exit 2 ; fi
echo "# Install CIFS"
apt-get install -y cifs-utils
mkdir /tmp/azf
cd /tmp/azf
echo "# Download the volume driver"
wget -nv https://github.com/Azure/azurefile-dockervolumedriver/releases/download/v0.5.1/azurefile-dockervolumedriver
echo "# Download driver sources"
wget -nv https://github.com/Azure/azurefile-dockervolumedriver/archive/v0.5.1.tar.gz
echo "# Install the driver"
chmod +x ./azurefile-dockervolumedriver
cp -a ./azurefile-dockervolumedriver /usr/bin
echo "# Extract the config files"
tar f v0.5.1.tar.gz --get azurefile-dockervolumedriver-0.5.1/contrib/init/systemd/azurefile-dockervolumedriver.default
tar f v0.5.1.tar.gz --get azurefile-dockervolumedriver-0.5.1/contrib/init/systemd/azurefile-dockervolumedriver.service
echo "# Copy the config files"
mkdir -p /etc/systemd/system
cp ./azurefile-dockervolumedriver-0.5.1/contrib/init/systemd/azurefile-dockervolumedriver.default /etc/default/azurefile-dockervolumedriver
cp ./azurefile-dockervolumedriver-0.5.1/contrib/init/systemd/azurefile-dockervolumedriver.service /etc/systemd/system/azurefile-dockervolumedriver.service
echo "# Setting Storage Account Info"
sed -i "s|youraccount|$STORAGEACCOUNT_NAME|g" /etc/default/azurefile-dockervolumedriver
sed -i "s|yourkey|$STORAGEACCOUNT_KEY|g" /etc/default/azurefile-dockervolumedriver
echo "# Starting Services"
systemctl daemon-reload
systemctl enable azurefile-dockervolumedriver
systemctl start azurefile-dockervolumedriver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment