#!/usr/bin/env bash # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 if [[ "$USER" != "vagrant" ]]; then echo "WARNING: This script is intended to be run from Nomad's Vagrant" read -rsp $'Press any key to continue anyway...\n' -n1 fi set -e if [[ ! -a /usr/local/bin/weave ]]; then echo "Installing weave..." sudo curl -L git.io/weave -o /usr/local/bin/weave sudo chmod a+x /usr/local/bin/weave fi weave launch || echo "weave running" eval "$(weave env)" if curl -s localhost:8500 > /dev/null; then echo "Consul running" else echo "Running Consul dev agent..." consul agent -dev > consul.out & fi if curl -s localhost:4646 > /dev/null; then echo "Nomad running" else echo "Running Nomad dev agent..." nomad agent -dev > nomad.out & fi sleep 5 echo "Running Redis with Weave in Nomad..." cat > redis-weave.nomad <