From a4c3231a0995c3d505567f31f430eba369b5f8a9 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 28 Nov 2019 13:40:33 -0700 Subject: [PATCH 1/3] Remove unused cruft Signed-off-by: Morgan Tocker --- .github/workflows/e2e-test-cluster.yml | 2 +- .github/workflows/local-example.yml | 2 +- Makefile | 17 +++---- azure-pipelines.yml | 21 --------- build.env | 13 +----- dev.env | 23 ---------- docker/bootstrap/Dockerfile.common | 7 --- docker/bootstrap/Dockerfile.mariadb | 1 - docker/bootstrap/Dockerfile.mariadb103 | 1 - docker/bootstrap/Dockerfile.mysql56 | 1 - docker/bootstrap/Dockerfile.mysql57 | 2 - docker/bootstrap/Dockerfile.mysql80 | 2 - docker/bootstrap/Dockerfile.percona | 1 - docker/bootstrap/Dockerfile.percona57 | 1 - docker/bootstrap/Dockerfile.percona80 | 1 - docker/lite/Dockerfile | 6 --- docker/lite/Dockerfile.alpine | 6 --- docker/lite/Dockerfile.mariadb | 6 --- docker/lite/Dockerfile.mariadb103 | 6 --- docker/lite/Dockerfile.mysql56 | 6 --- docker/lite/Dockerfile.mysql57 | 6 --- docker/lite/Dockerfile.mysql80 | 6 --- docker/lite/Dockerfile.percona | 6 --- docker/lite/Dockerfile.percona57 | 6 --- docker/lite/Dockerfile.percona80 | 6 --- docker/packaging/Dockerfile | 37 ---------------- docker/packaging/package_vitess.sh | 61 -------------------------- docker/packaging/preinstall.sh | 23 ---------- docker/publish-site/Dockerfile | 34 -------------- examples/local/env.sh | 13 ------ go/vt/env/env.go | 15 ++++--- go/vt/mysqlctl/mysqld.go | 26 ++++++----- vagrant-scripts/bootstrap_vm.sh | 2 - vagrant-scripts/vagrant-bashrc | 2 - 34 files changed, 34 insertions(+), 334 deletions(-) delete mode 100644 azure-pipelines.yml delete mode 100644 docker/packaging/Dockerfile delete mode 100755 docker/packaging/package_vitess.sh delete mode 100755 docker/packaging/preinstall.sh delete mode 100644 docker/publish-site/Dockerfile diff --git a/.github/workflows/e2e-test-cluster.yml b/.github/workflows/e2e-test-cluster.yml index 969008305ef..40e2048633b 100644 --- a/.github/workflows/e2e-test-cluster.yml +++ b/.github/workflows/e2e-test-cluster.yml @@ -32,7 +32,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: Run e2e test cluster run: | diff --git a/.github/workflows/local-example.yml b/.github/workflows/local-example.yml index 03a358d8161..c3626a13bf4 100644 --- a/.github/workflows/local-example.yml +++ b/.github/workflows/local-example.yml @@ -32,7 +32,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: Run Local Example run: | diff --git a/Makefile b/Makefile index 24eab88c988..d0c1d58dae7 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,12 @@ MAKEFLAGS = -s +# Soon this can be $PWD/bin, with no dependencies +# Waiting on https://github.com/vitessio/vitess/issues/5378 + +export GOBIN=$(VTROOT)/bin +export GO111MODULE=on + # Disabled parallel processing of target prerequisites to avoid that integration tests are racing each other (e.g. for ports) and may fail. # Since we are not using this Makefile for compilation, limiting parallelism will not increase build time. .NOTPARALLEL: @@ -33,14 +39,6 @@ ifdef VT_EXTRA_BUILD_FLAGS export EXTRA_BUILD_FLAGS := $(VT_EXTRA_BUILD_FLAGS) endif -# Link against the MySQL library in $VT_MYSQL_ROOT if it's specified. -ifdef VT_MYSQL_ROOT -# Clutter the env var only if it's a non-standard path. - ifneq ($(VT_MYSQL_ROOT),/usr) - CGO_LDFLAGS += -L$(VT_MYSQL_ROOT)/lib - endif -endif - build_web: echo $$(date): Building web artifacts cd web/vtctld2 && ng build -prod @@ -249,9 +247,6 @@ docker_lite_alpine: docker_guestbook: cd examples/kubernetes/guestbook && ./build.sh -docker_publish_site: - docker build -f docker/publish-site/Dockerfile -t vitess/publish-site . - # This rule loads the working copy of the code into a bootstrap image, # and then runs the tests inside Docker. # Example: $ make docker_test flavor=mariadb diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 03a4ca827af..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,21 +0,0 @@ -pr: -- master - -pool: - vmImage: 'ubuntu-latest' - -variables: - flags: "-docker -use_docker_cache -timeout=8m -print-log" - shards: [0, 1, 2, 3, 4] - flavors: ["mysql56", "mysql57", "mysql80", "mariadb", "mariadb103", "percona57", "percona80"] -jobs: -- job: tests - strategy: - matrix: - ${{ each flavor in variables.flavors }}: - ${{ each shard in variables.shards }}: - ${{ format('{0}{1}', flavor, shard) }}: - flavor: ${{ flavor }} - shard: ${{ shard }} - steps: - - script: go run test.go -shard $(shard) -flavor $(flavor) $(flags) diff --git a/build.env b/build.env index 3af09b3014a..5719714f344 100644 --- a/build.env +++ b/build.env @@ -28,14 +28,5 @@ if ! source "${dir}/tools/shell_functions.inc"; then return 1 fi -VTTOP=$(pwd) -export VTTOP -VTROOT="${VTROOT:-${VTTOP/\/src\/vitess.io\/vitess/}}" -export VTROOT -# VTTOP sanity check -if [[ "$VTTOP" == "${VTTOP/\/src\/vitess.io\/vitess/}" ]]; then - echo "WARNING: VTTOP($VTTOP) does not contain src/vitess.io/vitess" -fi - -export GOBIN="$VTROOT/bin" -export GO111MODULE=on +export VTTOP=$(pwd) +export VTROOT="${VTROOT:-${VTTOP/\/src\/vitess.io\/vitess/}}" diff --git a/dev.env b/dev.env index 54dd9cb41b9..fd50de5a270 100644 --- a/dev.env +++ b/dev.env @@ -22,9 +22,6 @@ source ./build.env -export GOTOP=$VTTOP/go -export PYTOP=$VTTOP/py - export VTDATAROOT="${VTDATAROOT:-${VTROOT}/vtdataroot}" mkdir -p "$VTDATAROOT" @@ -62,28 +59,8 @@ PATH=$(prepend_path "$PATH" "$VTROOT/dist/chromedriver") PATH=$(prepend_path "$PATH" "$VTROOT/dist/node/bin") export PATH -# mysql install location. Please set based on your environment. -# Build will not work if this is incorrect. - -if [[ "$VT_MYSQL_ROOT" == "" ]]; then - if [[ "$(which mysql)" == "" ]]; then - echo "WARNING: VT_MYSQL_ROOT unset because mysql not found. Did you install a client package?" - else - VT_MYSQL_ROOT=$(dirname "$(dirname "$(which mysql)")") - export VT_MYSQL_ROOT - fi -fi - -PKG_CONFIG_PATH=$(prepend_path "$PKG_CONFIG_PATH" "$VTROOT/lib") -export PKG_CONFIG_PATH - # According to https://github.com/etcd-io/etcd/blob/a621d807f061e1dd635033a8d6bc261461429e27/Documentation/op-guide/supported-platform.md, # currently, etcd is unstable on arm64, so ETCD_UNSUPPORTED_ARCH should be set. if [ "$(arch)" == aarch64 ]; then export ETCD_UNSUPPORTED_ARCH=arm64 fi - -# Useful aliases. Remove if inconvenient. -alias gt='cd $GOTOP' -alias pt='cd $PYTOP' -alias vt='cd $VTTOP' diff --git a/docker/bootstrap/Dockerfile.common b/docker/bootstrap/Dockerfile.common index 4b6a21beb49..e645b31a447 100644 --- a/docker/bootstrap/Dockerfile.common +++ b/docker/bootstrap/Dockerfile.common @@ -14,7 +14,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins libtool \ make \ openjdk-8-jdk \ - pkg-config \ python-crypto \ python-dev \ python-mysqldb \ @@ -40,17 +39,11 @@ RUN mkdir -p /vt/dist && \ # Set up Vitess environment (equivalent to '. dev.env') ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go -ENV PYTOP $VTTOP/py ENV VTDATAROOT $VTROOT/vtdataroot ENV VTPORTSTART 15000 ENV PYTHONPATH $VTROOT/dist/grpc/usr/local/lib/python2.7/site-packages:$VTROOT/dist/py-mock-1.0.1/lib/python2.7/site-packages:$VTROOT/py-vtdb:$VTROOT/dist/selenium/lib/python2.7/site-packages -ENV GOBIN $VTROOT/bin ENV PATH $VTROOT/bin:$VTROOT/dist/maven/bin:$VTROOT/dist/chromedriver:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib ENV USER vitess -ENV GO111MODULE on # Copy files needed for bootstrap COPY bootstrap.sh dev.env build.env go.mod go.sum /vt/src/vitess.io/vitess/ diff --git a/docker/bootstrap/Dockerfile.mariadb b/docker/bootstrap/Dockerfile.mariadb index 19d5c9973d0..e0f6106837f 100644 --- a/docker/bootstrap/Dockerfile.mariadb +++ b/docker/bootstrap/Dockerfile.mariadb @@ -22,6 +22,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --r # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MariaDB USER vitess RUN ./bootstrap.sh diff --git a/docker/bootstrap/Dockerfile.mariadb103 b/docker/bootstrap/Dockerfile.mariadb103 index c2828ddd25d..024fe6a80b3 100644 --- a/docker/bootstrap/Dockerfile.mariadb103 +++ b/docker/bootstrap/Dockerfile.mariadb103 @@ -11,6 +11,5 @@ RUN apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24 # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MariaDB103 USER vitess RUN ./bootstrap.sh diff --git a/docker/bootstrap/Dockerfile.mysql56 b/docker/bootstrap/Dockerfile.mysql56 index b07fddedb61..69c5f4dee0b 100644 --- a/docker/bootstrap/Dockerfile.mysql56 +++ b/docker/bootstrap/Dockerfile.mysql56 @@ -17,6 +17,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver pool.s # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MySQL56 USER vitess RUN ./bootstrap.sh diff --git a/docker/bootstrap/Dockerfile.mysql57 b/docker/bootstrap/Dockerfile.mysql57 index 2fb1f4e1aa5..76c76dc47b3 100644 --- a/docker/bootstrap/Dockerfile.mysql57 +++ b/docker/bootstrap/Dockerfile.mysql57 @@ -18,7 +18,5 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess - -ENV MYSQL_FLAVOR MySQL56 USER vitess RUN ./bootstrap.sh \ No newline at end of file diff --git a/docker/bootstrap/Dockerfile.mysql80 b/docker/bootstrap/Dockerfile.mysql80 index ec53895165f..e6d00bc5245 100644 --- a/docker/bootstrap/Dockerfile.mysql80 +++ b/docker/bootstrap/Dockerfile.mysql80 @@ -17,7 +17,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver ha.poo # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess - -ENV MYSQL_FLAVOR MySQL80 USER vitess RUN ./bootstrap.sh \ No newline at end of file diff --git a/docker/bootstrap/Dockerfile.percona b/docker/bootstrap/Dockerfile.percona index 6d13fa4dfb0..910d3be10b1 100644 --- a/docker/bootstrap/Dockerfile.percona +++ b/docker/bootstrap/Dockerfile.percona @@ -16,6 +16,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --r # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MySQL56 USER vitess RUN ./bootstrap.sh diff --git a/docker/bootstrap/Dockerfile.percona57 b/docker/bootstrap/Dockerfile.percona57 index 6ed54c76923..54c8477ffb6 100644 --- a/docker/bootstrap/Dockerfile.percona57 +++ b/docker/bootstrap/Dockerfile.percona57 @@ -17,6 +17,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --r # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MySQL56 USER vitess RUN ./bootstrap.sh diff --git a/docker/bootstrap/Dockerfile.percona80 b/docker/bootstrap/Dockerfile.percona80 index 1ce9c52103f..c5ce5d5ee48 100644 --- a/docker/bootstrap/Dockerfile.percona80 +++ b/docker/bootstrap/Dockerfile.percona80 @@ -32,6 +32,5 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --r # Bootstrap Vitess WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MySQL80 USER vitess RUN ./bootstrap.sh diff --git a/docker/lite/Dockerfile b/docker/lite/Dockerfile index 55ca5f969f9..312d7506114 100644 --- a/docker/lite/Dockerfile +++ b/docker/lite/Dockerfile @@ -63,14 +63,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.alpine b/docker/lite/Dockerfile.alpine index f3d282163a9..a50fec877d9 100644 --- a/docker/lite/Dockerfile.alpine +++ b/docker/lite/Dockerfile.alpine @@ -24,14 +24,8 @@ RUN echo '@edge http://nl.alpinelinux.org/alpine/edge/main' >> /etc/apk/reposito # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MariaDB103 # Create vitess user RUN addgroup -S vitess && adduser -S -G vitess vitess && mkdir -p /vt diff --git a/docker/lite/Dockerfile.mariadb b/docker/lite/Dockerfile.mariadb index cea94d615e5..b845e19beca 100644 --- a/docker/lite/Dockerfile.mariadb +++ b/docker/lite/Dockerfile.mariadb @@ -35,14 +35,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MariaDB # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.mariadb103 b/docker/lite/Dockerfile.mariadb103 index 4ff440d3d86..a07de74fca3 100644 --- a/docker/lite/Dockerfile.mariadb103 +++ b/docker/lite/Dockerfile.mariadb103 @@ -34,14 +34,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MariaDB103 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.mysql56 b/docker/lite/Dockerfile.mysql56 index f3d6b3dcb7a..0a771265c34 100644 --- a/docker/lite/Dockerfile.mysql56 +++ b/docker/lite/Dockerfile.mysql56 @@ -38,14 +38,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.mysql57 b/docker/lite/Dockerfile.mysql57 index 78318e5c652..8e605fda627 100644 --- a/docker/lite/Dockerfile.mysql57 +++ b/docker/lite/Dockerfile.mysql57 @@ -38,14 +38,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.mysql80 b/docker/lite/Dockerfile.mysql80 index fb71b6f6b56..bb6d5d54be4 100644 --- a/docker/lite/Dockerfile.mysql80 +++ b/docker/lite/Dockerfile.mysql80 @@ -38,14 +38,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.percona b/docker/lite/Dockerfile.percona index e8d127dc56f..2867aa9c33c 100644 --- a/docker/lite/Dockerfile.percona +++ b/docker/lite/Dockerfile.percona @@ -40,14 +40,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.percona57 b/docker/lite/Dockerfile.percona57 index 30472af2a60..ef01888a161 100644 --- a/docker/lite/Dockerfile.percona57 +++ b/docker/lite/Dockerfile.percona57 @@ -41,14 +41,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/lite/Dockerfile.percona80 b/docker/lite/Dockerfile.percona80 index 31182d277d6..02c56f48b92 100644 --- a/docker/lite/Dockerfile.percona80 +++ b/docker/lite/Dockerfile.percona80 @@ -43,14 +43,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # Set up Vitess environment (just enough to run pre-built Go binaries) ENV VTTOP /vt/src/vitess.io/vitess ENV VTROOT /vt -ENV GOTOP $VTTOP/go ENV VTDATAROOT $VTROOT/vtdataroot -ENV GOBIN $VTROOT/bin -ENV GOPATH $VTROOT ENV PATH $VTROOT/bin:$PATH -ENV VT_MYSQL_ROOT /usr -ENV PKG_CONFIG_PATH $VTROOT/lib -ENV MYSQL_FLAVOR MySQL56 # Copy binaries (placed by build.sh) COPY --from=staging /vt/ /vt/ diff --git a/docker/packaging/Dockerfile b/docker/packaging/Dockerfile deleted file mode 100644 index 576b8ef0e63..00000000000 --- a/docker/packaging/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2019 The Vitess Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM vitess/base - -USER root - -# Install gem and use gem to install fpm -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - build-essential \ - ruby-dev \ - rubygems \ - rpm \ - && rm -rf /var/lib/apt/lists/* \ - && gem install --no-ri --no-rdoc fpm - -RUN mkdir /vt/packaging - -COPY docker/packaging/* /vt/packaging/ - -RUN chown -R vitess:vitess /vt/packaging - -USER vitess - -ENTRYPOINT ["/bin/bash", "/vt/packaging/package_vitess.sh"] diff --git a/docker/packaging/package_vitess.sh b/docker/packaging/package_vitess.sh deleted file mode 100755 index 609fd1447d5..00000000000 --- a/docker/packaging/package_vitess.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Copyright 2019 The Vitess Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if [ -z "${VERSION}" ]; then - echo "Set the env var VERSION with the release version" - exit 1 -fi - -set -eu - -PREFIX=${PREFIX:-/usr} - -inputs_file="/vt/packaging/inputs" -cat <> "${inputs_file}" -/vt/bin/mysqlctld=${PREFIX}/bin/mysqlctld -/vt/bin/vtbackup=${PREFIX}/bin/vtbackup -/vt/bin/vtctl=${PREFIX}/bin/vtctl -/vt/bin/vtctlclient=${PREFIX}/bin/vtctlclient -/vt/bin/vtctld=${PREFIX}/bin/vtctld -/vt/bin/vtgate=${PREFIX}/bin/vtgate -/vt/bin/vttablet=${PREFIX}/bin/vttablet -/vt/bin/vtworker=${PREFIX}/bin/vtworker -/vt/src/vitess.io/vitess/config/=/etc/vitess -/vt/src/vitess.io/vitess/web/vtctld2/app=${PREFIX}/lib/vitess/web/vtcld2 -/vt/src/vitess.io/vitess/web/vtctld=${PREFIX}/lib/vitess/web -/vt/src/vitess.io/vitess/examples/local/=${PREFIX}/share/vitess/examples -EOF - -description='A database clustering system for horizontal scaling of MySQL - -Vitess is a database solution for deploying, scaling and managing large -clusters of MySQL instances. It’s architected to run as effectively in a public -or private cloud architecture as it does on dedicated hardware. It combines and -extends many important MySQL features with the scalability of a NoSQL database.' - -exec /usr/local/bin/fpm \ - --force \ - --input-type dir \ - --name vitess \ - --version "${VERSION}" \ - --url "https://vitess.io/" \ - --description "${description}" \ - --license "Apache License - Version 2.0, January 2004" \ - --inputs "${inputs_file}" \ - --config-files "/etc/vitess" \ - --directories "${PREFIX}/lib/vitess" \ - --before-install "/vt/packaging/preinstall.sh" \ - "${@}" diff --git a/docker/packaging/preinstall.sh b/docker/packaging/preinstall.sh deleted file mode 100755 index e6bfaf537a2..00000000000 --- a/docker/packaging/preinstall.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Copyright 2019 The Vitess Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if ! /usr/bin/getent group vitess >/dev/null ; then - groupadd -r vitess -fi - -if ! /usr/bin/getent passwd vitess >/dev/null ; then - useradd -r -g vitess vitess -fi diff --git a/docker/publish-site/Dockerfile b/docker/publish-site/Dockerfile deleted file mode 100644 index e0a1946996f..00000000000 --- a/docker/publish-site/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2019 The Vitess Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This image should be built with $VTTOP as the context dir. -# For example: -# vitess$ docker build -f docker/publish-site/Dockerfile -t vitess/publish-site . -FROM ruby:2.3 - -# Install apt dependencies. -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - nodejs && \ - rm -rf /var/lib/apt/lists/* - -# Install ruby dependencies. -COPY vitess.io/Gemfile /vitess.io/Gemfile -RUN cd /vitess.io && \ - gem install bundler && \ - bundle install - -# Expose port for preview-site.sh. -EXPOSE 4000 - diff --git a/examples/local/env.sh b/examples/local/env.sh index 9232c60b4ff..584987bb924 100644 --- a/examples/local/env.sh +++ b/examples/local/env.sh @@ -20,19 +20,6 @@ vtctld_web_port=15000 # Set up environment. export VTTOP=${VTTOP-$VTROOT/src/vitess.io/vitess} -# Try to find mysqld on PATH. -if [ -z "$VT_MYSQL_ROOT" ]; then - mysql_path=`which mysqld` - if [ -z "$mysql_path" ]; then - echo "Can't guess location of mysqld. Please set VT_MYSQL_ROOT manually." - exit 1 - fi - export VT_MYSQL_ROOT=$(dirname `dirname $mysql_path`) -fi - -# Previously the file specified MYSQL_FLAVOR -# it is now autodetected - 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. diff --git a/go/vt/env/env.go b/go/vt/env/env.go index 49b462815be..8571e0d05e5 100644 --- a/go/vt/env/env.go +++ b/go/vt/env/env.go @@ -19,6 +19,7 @@ package env import ( "errors" "os" + "os/exec" "path" "path/filepath" "strings" @@ -60,20 +61,22 @@ func VtDataRoot() string { return DefaultVtDataRoot } -// VtMysqlRoot returns the root for the mysql distribution, which -// contains bin/mysql CLI for instance. +// VtMysqlRoot returns the root for the mysql distribution, +// which contains bin/mysql CLI for instance. +// If it is not set, look for mysqld in the path. func VtMysqlRoot() (string, error) { // if the environment variable is set, use that if root := os.Getenv("VT_MYSQL_ROOT"); root != "" { return root, nil } - // otherwise let's use VTROOT - root, err := VtRoot() + // otherwise let's use the mysqld in the PATH + path, err := exec.LookPath("mysqld") if err != nil { - return "", errors.New("VT_MYSQL_ROOT is not set and could not be guessed from the executable location. Please set $VT_MYSQL_ROOT") + return "", errors.New("VT_MYSQL_ROOT is not set and no mysqld could be found in your PATH") } - return root, nil + path = filepath.Dir(filepath.Dir(path)) // strip mysqld, and the sbin + return path, nil } // VtMysqlBaseDir returns the Mysql base directory, which diff --git a/go/vt/mysqlctl/mysqld.go b/go/vt/mysqlctl/mysqld.go index c5dc48a4b80..4f18809c04b 100644 --- a/go/vt/mysqlctl/mysqld.go +++ b/go/vt/mysqlctl/mysqld.go @@ -133,8 +133,8 @@ func NewMysqld(dbcfgs *dbconfigs.DBConfigs) *Mysqld { /* By default Vitess searches in vtenv.VtMysqlRoot() for a mysqld binary. - This is usually the VT_MYSQL_ROOT env, but if it is unset or empty, it - will substitute VtRoot(). See go/vt/env/env.go. + This is historically the VT_MYSQL_ROOT env, but if it is unset or empty, + Vitess will search the PATH. See go/vt/env/env.go. A number of subdirs inside vtenv.VtMysqlRoot() will be searched, see func binaryPath() for context. If no mysqld binary is found (possibly @@ -153,12 +153,14 @@ func NewMysqld(dbcfgs *dbconfigs.DBConfigs) *Mysqld { f, v, err = getVersionFromEnv() if err != nil { vtenvMysqlRoot, _ := vtenv.VtMysqlRoot() - message := fmt.Sprintf(`could not auto-detect MySQL version. You may need to set VT_MYSQL_ROOT so a mysqld binary can be found, or set the environment variable MYSQL_FLAVOR if mysqld is not available locally: + message := fmt.Sprintf(`could not auto-detect MySQL version. You may need to set your PATH so a mysqld binary can be found, or set the environment variable MYSQL_FLAVOR if mysqld is not available locally: + PATH: %s VT_MYSQL_ROOT: %s VTROOT: %s vtenv.VtMysqlRoot(): %s MYSQL_FLAVOR: %s `, + os.Getenv("PATH"), os.Getenv("VT_MYSQL_ROOT"), os.Getenv("VTROOT"), vtenvMysqlRoot, @@ -265,12 +267,12 @@ func (mysqld *Mysqld) RunMysqlUpgrade() error { } // Find mysql_upgrade. If not there, we do nothing. - dir, err := vtenv.VtMysqlRoot() + vtMysqlRoot, err := vtenv.VtMysqlRoot() if err != nil { log.Warningf("VT_MYSQL_ROOT not set, skipping mysql_upgrade step: %v", err) return nil } - name, err := binaryPath(dir, "mysql_upgrade") + name, err := binaryPath(vtMysqlRoot, "mysql_upgrade") if err != nil { log.Warningf("mysql_upgrade binary not present, skipping it: %v", err) return nil @@ -301,7 +303,8 @@ func (mysqld *Mysqld) RunMysqlUpgrade() error { "--force", // Don't complain if it's already been upgraded. } cmd := exec.Command(name, args...) - cmd.Env = []string{os.ExpandEnv("LD_LIBRARY_PATH=$VT_MYSQL_ROOT/lib/mysql")} + libPath := fmt.Sprintf("LD_LIBRARY_PATH=%s/lib/mysql", vtMysqlRoot) + cmd.Env = []string{libPath} out, err := cmd.CombinedOutput() log.Infof("mysql_upgrade output: %s", out) return err @@ -344,16 +347,16 @@ func (mysqld *Mysqld) startNoWait(ctx context.Context, cnf *Mycnf, mysqldArgs .. case hook.HOOK_DOES_NOT_EXIST: // hook doesn't exist, run mysqld_safe ourselves log.Infof("%v: No mysqld_start hook, running mysqld_safe directly", ts) - dir, err := vtenv.VtMysqlRoot() + vtMysqlRoot, err := vtenv.VtMysqlRoot() if err != nil { return err } - name, err = binaryPath(dir, "mysqld_safe") + name, err = binaryPath(vtMysqlRoot, "mysqld_safe") if err != nil { // The movement to use systemd means that mysqld_safe is not always provided. // This should not be considered an issue do not generate a warning. log.Infof("%v: trying to launch mysqld instead", err) - name, err = binaryPath(dir, "mysqld") + name, err = binaryPath(vtMysqlRoot, "mysqld") // If this also fails, return an error. if err != nil { return err @@ -368,10 +371,11 @@ func (mysqld *Mysqld) startNoWait(ctx context.Context, cnf *Mycnf, mysqldArgs .. "--basedir=" + mysqlBaseDir, } arg = append(arg, mysqldArgs...) - env := []string{os.ExpandEnv("LD_LIBRARY_PATH=$VT_MYSQL_ROOT/lib/mysql")} + libPath := fmt.Sprintf("LD_LIBRARY_PATH=%s/lib/mysql", vtMysqlRoot) + env := []string{libPath} cmd := exec.Command(name, arg...) - cmd.Dir = dir + cmd.Dir = vtMysqlRoot cmd.Env = env log.Infof("%v %#v", ts, cmd) stderr, err := cmd.StderrPipe() diff --git a/vagrant-scripts/bootstrap_vm.sh b/vagrant-scripts/bootstrap_vm.sh index c4a83911abd..46df11227b4 100755 --- a/vagrant-scripts/bootstrap_vm.sh +++ b/vagrant-scripts/bootstrap_vm.sh @@ -26,9 +26,7 @@ apt-get install -y make \ python-pip \ libssl-dev \ g++ \ - mercurial \ git \ - pkg-config \ bison \ curl \ openjdk-8-jdk \ diff --git a/vagrant-scripts/vagrant-bashrc b/vagrant-scripts/vagrant-bashrc index 27b1828450c..49ddf89943c 100644 --- a/vagrant-scripts/vagrant-bashrc +++ b/vagrant-scripts/vagrant-bashrc @@ -9,8 +9,6 @@ then fi ulimit -n 10000 -export MYSQL_FLAVOR=MySQL56 -export VT_MYSQL_ROOT=/usr # This is just to make sure the vm can write into these directories sudo chown "$(whoami)":"$(whoami)" /vagrant sudo chown "$(whoami)":"$(whoami)" /vagrant/src From d1d797d326e0305c111bdb58b26d8d89a7f6e9a6 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 28 Nov 2019 19:52:42 -0700 Subject: [PATCH 2/3] Adjust for master Signed-off-by: Morgan Tocker --- .github/workflows/cluster_endtoend.yml | 2 +- .github/workflows/e2e_race.yml | 2 +- .github/workflows/unit.yml | 2 +- .github/workflows/unit_race.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cluster_endtoend.yml b/.github/workflows/cluster_endtoend.yml index 4adab961fea..61ddea9a5b9 100644 --- a/.github/workflows/cluster_endtoend.yml +++ b/.github/workflows/cluster_endtoend.yml @@ -32,7 +32,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: cluster_endtoend run: | diff --git a/.github/workflows/e2e_race.yml b/.github/workflows/e2e_race.yml index 9acebc922ed..a0404cfefb6 100644 --- a/.github/workflows/e2e_race.yml +++ b/.github/workflows/e2e_race.yml @@ -32,7 +32,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: e2e_race run: | diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 89d705a3f51..774bdbd7365 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -30,7 +30,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: unit run: | diff --git a/.github/workflows/unit_race.yml b/.github/workflows/unit_race.yml index 8c42a865339..8aeb2d9beb3 100644 --- a/.github/workflows/unit_race.yml +++ b/.github/workflows/unit_race.yml @@ -32,7 +32,7 @@ jobs: - name: Build run: | - GOBIN=$PWD/bin make build + VTROOT=$PWD VTTOP=$PWD make build - name: unit_race run: | From 46a9e6530f89c4cfb35ee4f284d4228db502d3ee Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 28 Nov 2019 20:12:39 -0700 Subject: [PATCH 3/3] Fix unit_race Signed-off-by: Morgan Tocker --- .github/workflows/unit_race.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit_race.yml b/.github/workflows/unit_race.yml index 8aeb2d9beb3..fd2e7ecd671 100644 --- a/.github/workflows/unit_race.yml +++ b/.github/workflows/unit_race.yml @@ -10,7 +10,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.13 + go-version: 1.12 - name: Check out code uses: actions/checkout@v1 @@ -26,9 +26,7 @@ jobs: - name: Run bootstrap.sh run: | - echo "Copying new bootstrap over location of legacy one." - cp .github/bootstrap.sh . - ./bootstrap.sh + VTTOP=$PWD VTROOT=$PWD BUILD_PYTHON=0 ./bootstrap.sh - name: Build run: |