Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

### This file is executed by 'make tools'. You do not need to execute it directly.

source ./dev.env

# Outline of this file.
# 0. Initialization and helper methods.
# 1. Installation of dependencies.
Expand All @@ -29,17 +31,8 @@ BUILD_CONSUL=${BUILD_CONSUL:-1}
# 0. Initialization and helper methods.
#

function fail() {
echo "ERROR: $1"
exit 1
}

[[ "$(dirname "$0")" = "." ]] || fail "bootstrap.sh must be run from its current directory"

# Create main directories.

source ./dev.env

# install_dep is a helper function to generalize the download and installation of dependencies.
#
# If the installation is successful, it puts the installed version string into
Expand Down
4 changes: 2 additions & 2 deletions build.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

source ./tools/shell_functions.inc

go version &>/dev/null || fail "Go is not installed or is not on \$PATH"
goversion_min 1.12 || fail "Go is not version 1.12+"
go version >/dev/null 2>&1 || fail "Go is not installed or is not in \$PATH. See https://vitess.io/contributing/build-from-source for install instructions."
goversion_min 1.12 || fail "Go is not version 1.12+. See https://vitess.io/contributing/build-from-source for install instructions."

mkdir -p dist
mkdir -p bin
Expand Down
6 changes: 1 addition & 5 deletions examples/local/101_initial_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ set -e

# shellcheck disable=SC2128
script_root=$(dirname "${BASH_SOURCE}")

if [[ $EUID -eq 0 ]]; then
echo "This script refuses to be run as root. Please switch to a regular user."
exit 1
fi
source "${script_root}/env.sh"

# start topo server
if [ "${TOPO}" = "zk2" ]; then
Expand Down
17 changes: 14 additions & 3 deletions examples/local/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,25 @@ function fail() {
exit 1
}

if [[ $EUID -eq 0 ]]; then
fail "This script refuses to be run as root. Please switch to a regular user."
fi

# mysqld might be in /usr/sbin which will not be in the default PATH
PATH="/usr/sbin:$PATH"
for binary in mysqld etcd etcdctl curl vtctlclient vttablet vtgate vtctld mysqlctl; do
command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions."
done;

if [ -z "$VTROOT" ]; then
fail "VTROOT is not set. See https://vitess.io/docs/get-started/local/ for install instructions."
fi

if [ "${TOPO}" = "zk2" ]; then
# Each ZooKeeper server needs a list of all servers in the quorum.
# Since we're running them all locally, we need to give them unique ports.
# In a real deployment, these should be on different machines, and their
# respective hostnames should be given.
echo "enter zk2 env"
zkcfg=(\
"1@$hostname:28881:38881:21811" \
"2@$hostname:28882:38882:21812" \
Expand All @@ -46,8 +59,6 @@ if [ "${TOPO}" = "zk2" ]; then

mkdir -p $VTDATAROOT/tmp
else
echo "enter etcd2 env"

ETCD_SERVER="localhost:2379"
TOPOLOGY_FLAGS="-topo_implementation etcd2 -topo_global_server_address $ETCD_SERVER -topo_global_root /vitess/global"

Expand Down
7 changes: 5 additions & 2 deletions tools/dependency_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function fail() {
exit 1
}

for binary in mysqld consul etcd etcdctl zksrv.sh; do
command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. Run 'make tools' to install dependencies."
# These binaries are required to 'make test'
# mysqld might be in /usr/sbin which will not be in the default PATH
PATH="/usr/sbin:$PATH"
for binary in mysqld consul etcd etcdctl zksrv.sh javadoc mvn ant curl wget zip unzip; do
command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/contributing/build-from-source for install instructions."
done;
6 changes: 6 additions & 0 deletions tools/shell_functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ function prepend_path() {
# Return path variable unchanged.
echo "$1"
}

function fail() {
echo "ERROR: $1"
exit 1
}