Skip to content

Instantly share code, notes, and snippets.

@nieldw
Created October 10, 2016 16:07
Show Gist options
  • Save nieldw/df5b672ffd70a88c341be24660d817e0 to your computer and use it in GitHub Desktop.
Save nieldw/df5b672ffd70a88c341be24660d817e0 to your computer and use it in GitHub Desktop.
Install azurefile docker volume driver on ubuntu with upstart
#!/bin/bash
# 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 driver sources"
wget https://github.com/Azure/azurefile-dockervolumedriver/archive/v0.5.1.tar.gz
echo "# Extract the config files"
tar f v0.5.1.tar.gz --get azurefile-dockervolumedriver-0.5.1/contrib/init/upstart/azurefile-dockervolumedriver.conf
tar f v0.5.1.tar.gz --get azurefile-dockervolumedriver-0.5.1/contrib/init/upstart/azurefile-dockervolumedriver.default
echo "# Install the driver"
cd /usr/bin/
wget https://github.com/Azure/azurefile-dockervolumedriver/releases/download/v0.5.1/azurefile-dockervolumedriver
chmod +x /usr/bin/azurefile-dockervolumedriver
cp /tmp/azf/azurefile-dockervolumedriver-0.5.1/contrib/init/upstart/azurefile-dockervolumedriver.conf /etc/init/azurefile-dockervolumedriver.conf
cp /tmp/azf/azurefile-dockervolumedriver-0.5.1/contrib/init/upstart/azurefile-dockervolumedriver.default /etc/default/azurefile-dockervolumedriver
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"
initctl reload-configuration
initctl start azurefile-dockervolumedriver
initctl status azurefile-dockervolumedriver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment