github.com/m3db/m3@v1.5.0/scripts/vagrant/provision/setup_privileged.sh (about)

     1  #!/bin/bash
     2  
     3  # Use with Ubuntu 16.x+
     4  set -xe
     5  
     6  apt-get update
     7  
     8  DOCKER_CONFIG_FILE=daemon.json
     9  
    10  # Mount nvme devices (if present)
    11  DISKS=$(lsblk | grep nvme | awk '{ print "/dev/"$1 }')
    12  if [[ "$DISKS" != "" ]]; then
    13      VG=nvme_vg
    14      LV=nvme_lv
    15      vgcreate $VG $DISKS
    16      # This gets the size in GB.
    17      SIZE_GB=$(vgs | grep $VG | awk '{ print $6 }' | tr -dc 0-9 | xargs expr 10 "*")
    18      lvcreate -L "$SIZE_GB"G --name $LV $VG
    19      mkfs -t ext4 /dev/$VG/$LV
    20      mkdir -p /mnt/nvme
    21      mount /dev/$VG/$LV /mnt/nvme
    22      DOCKER_CONFIG_FILE=daemon_nvme.json
    23  fi
    24  
    25  DOCKER_USER=${DOCKER_USER:-$USER}
    26  
    27  # Copy over docker daemon config
    28  mkdir /etc/docker
    29  cp /home/$DOCKER_USER/docker/$DOCKER_CONFIG_FILE /etc/docker/daemon.json
    30  
    31  # Install git
    32  apt-get install -y git
    33  
    34  # Install utilities
    35  apt-get install -y tmux curl jq htop
    36  
    37  # Install docker
    38  apt-get install -y containerd docker.io
    39  usermod -aG docker $DOCKER_USER
    40  
    41  # Install kubectl
    42  snap install kubectl --classic
    43  ln -s /snap/bin/kubectl /usr/bin/kubectl