github.com/m3db/m3@v1.5.0/scripts/vagrant/shared/tunnel_vagrant.sh (about)

     1  #!/bin/bash
     2  
     3  set -xe
     4  
     5  export BOX="ubuntu/xenial64"
     6  PROVIDER=${PROVIDER:-virtualbox}
     7  
     8  if [[ "$GRAFANA_PORT" == "" ]]; then
     9      GRAFANA_PORT="3333"
    10  fi
    11  
    12  if [[ "$PROVIDER" != "virtualbox" ]]; then
    13      if [[ "$USER" == "" ]]; then
    14          echo "USER env var not set"
    15          exit 1
    16      fi
    17      if [[ "$SSH_KEY" == "" ]]; then
    18          echo "SSH_KEY env var not set"
    19          exit 1
    20      fi
    21  fi
    22  
    23  if [[ "$PROVIDER" == "google" ]]; then
    24      export BOX="google/gce"
    25  
    26      if [[ "$GOOGLE_PROJECT_ID" == "" ]]; then
    27          echo "GOOGLE_PROJECT_ID env var not set"
    28          exit 1
    29      fi
    30      if [[ "$GOOGLE_JSON_KEY_LOCATION" == "" ]]; then
    31          echo "GOOGLE_JSON_KEY_LOCATION env var not set"
    32          exit 1
    33      fi
    34      if [[ "$USER" == "" ]]; then
    35          echo "USER env var not set"
    36          exit 1
    37      fi
    38      if [[ "$SSH_KEY" == "" ]]; then
    39          echo "SSH_KEY env var not set"
    40          exit 1
    41      fi
    42  fi
    43  
    44  if [[ "$PROVIDER" == "azure" ]]; then
    45      export BOX="azure"
    46  
    47      if [[ "$AZURE_TENANT_ID" == "" ]]; then
    48          echo "AZURE_TENANT_ID env var not set"
    49          exit 1
    50      fi
    51      if [[ "$AZURE_CLIENT_ID" == "" ]]; then
    52          echo "AZURE_CLIENT_ID env var not set"
    53          exit 1
    54      fi
    55      if [[ "$AZURE_CLIENT_SECRET" == "" ]]; then
    56          echo "AZURE_CLIENT_SECRET env var not set"
    57          exit 1
    58      fi
    59      if [[ "$AZURE_SUBSCRIPTION_ID" == "" ]]; then
    60          echo "AZURE_SUBSCRIPTION_ID env var not set"
    61          exit 1
    62      fi
    63  fi
    64  
    65  # Run tunnels
    66  echo "Tunnelling"
    67  echo "Grafana available at http://localhost:$GRAFANA_PORT"
    68  vagrant ssh $MACHINE --no-tty --\
    69      -L $GRAFANA_PORT:localhost:3000 \
    70      -L 7201:localhost:7201