-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add Vagrantfile #4112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Vagrantfile #4112
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,3 +70,6 @@ releases | |
| /web/vtctld2/bower.json~ | ||
| /web/vtctld2/public/bower_components/ | ||
|
|
||
|
|
||
| # Vagrant | ||
| .vagrant | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| ENV["LC_ALL"] = "en_US.UTF-8" | ||
|
|
||
| Vagrant.configure("2") do |config| | ||
| config.vm.box = "ubuntu/xenial64" | ||
| config.vm.hostname = 'vitess' | ||
|
|
||
| config.vm.network "private_network", type: "dhcp" | ||
|
|
||
| # vtctld | ||
| config.vm.network "forwarded_port", guest: 8000, host: 8000 # http | ||
| config.vm.network "forwarded_port", guest: 15000, host: 15000 # http | ||
| config.vm.network "forwarded_port", guest: 15999, host: 15999 # grpc | ||
|
|
||
| # vtgate | ||
| config.vm.network "forwarded_port", guest: 15001, host: 15001 # http | ||
| config.vm.network "forwarded_port", guest: 15991, host: 15991 # grpc | ||
| config.vm.network "forwarded_port", guest: 15306, host: 15306 # mysql | ||
|
|
||
| # vttablet 1 | ||
| config.vm.network "forwarded_port", guest: 15100, host: 15100 # http | ||
| config.vm.network "forwarded_port", guest: 16100, host: 16100 # grpc | ||
|
|
||
| # vttablet 2 | ||
| config.vm.network "forwarded_port", guest: 15101, host: 15101 # http | ||
| config.vm.network "forwarded_port", guest: 16101, host: 16101 # grpc | ||
|
|
||
| # vttablet 3 | ||
| config.vm.network "forwarded_port", guest: 15102, host: 15102 # http | ||
| config.vm.network "forwarded_port", guest: 16102, host: 16102 # grpc | ||
|
|
||
| # vttablet 4 | ||
| config.vm.network "forwarded_port", guest: 15103, host: 15103 # http | ||
| config.vm.network "forwarded_port", guest: 16103, host: 16103 # grpc | ||
|
|
||
| # vttablet 5 | ||
| config.vm.network "forwarded_port", guest: 15104, host: 15104 # http | ||
| config.vm.network "forwarded_port", guest: 16104, host: 16104 # grpc | ||
|
|
||
| # Demo Appp | ||
| config.vm.network "forwarded_port", guest: 8000, host: 8000 # http | ||
|
|
||
| # If possible, use nfs, this gives a good boost to IO operations in the VM. | ||
| # if you run into with nfs, just remove this from the synced folder | ||
|
|
||
| config.vm.synced_folder ".", "/vagrant/src/vitess.io/vitess", type: "nfs" | ||
|
|
||
| config.vm.provider :virtualbox do |vb| | ||
| vb.name = "vitess" | ||
| vb.customize ["modifyvm", :id, "--ioapic", "on"] | ||
| vb.customize ["modifyvm", :id, "--cpuexecutioncap", "85"] | ||
| vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] | ||
| vb.memory = 12888 | ||
| vb.cpus = 4 | ||
| end | ||
| config.vm.provision "shell", path: "./vagrant-scripts/bootstrap_vm.sh" | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # See http://vitess.io/getting-started/local-instance.html#manual-build | ||
| # for more info | ||
| # | ||
| set -ex | ||
|
|
||
| TMP_DIR="$(mktemp -d)" | ||
| SEED_FILE='/root/.provisioning_done' | ||
|
|
||
| if [ -f $SEED_FILE ]; | ||
| then | ||
| printf "\nVM provisioning already completed\n" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Install pre-requisites | ||
| add-apt-repository -y ppa:openjdk-r/ppa | ||
| apt-get update | ||
| apt-get install -y make \ | ||
| automake \ | ||
| libtool \ | ||
| python-dev \ | ||
| python-virtualenv \ | ||
| python-mysqldb \ | ||
| libssl-dev \ | ||
| g++ \ | ||
| mercurial \ | ||
| git \ | ||
| pkg-config \ | ||
| bison \ | ||
| curl \ | ||
| openjdk-7-jre \ | ||
| zip \ | ||
| unzip | ||
|
|
||
| # Install golang | ||
| GO_VER='1.9.1' | ||
| GO_DOWNLOAD_URL='https://storage.googleapis.com/golang' | ||
| GO_FILENAME="go${GO_VER}.linux-amd64.tar.gz" | ||
| wget "${GO_DOWNLOAD_URL}/${GO_FILENAME}" -O "${TMP_DIR}/${GO_FILENAME}" | ||
| tar xzf "${TMP_DIR}/${GO_FILENAME}" -C "/usr/local" | ||
|
|
||
| # Install MySQL Percona 5.7 (via APT) | ||
| PERCONA_APT="https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb" | ||
| PERCONA_APT_FILENAME='percona-server.tar' | ||
| wget "${PERCONA_APT}" -O "${TMP_DIR}/${PERCONA_APT_FILENAME}" | ||
| dpkg -i "${TMP_DIR}/${PERCONA_APT_FILENAME}" | ||
| apt-get update | ||
| export DEBIAN_FRONTEND="noninteractive" | ||
| apt-get install -y percona-server-server-5.7 libmysqlclient-dev | ||
| echo "CREATE USER 'mysql_user'@'%' IDENTIFIED BY 'mysql_password'; GRANT ALL PRIVILEGES ON *.* TO 'mysql_user'@'%'; FLUSH PRIVILEGES;" | mysql -u root | ||
|
|
||
| # System tweaks | ||
| printf "\nSetting /etc/environment\n" | ||
| { | ||
| GOROOT='/usr/local/go' | ||
| GOPATH='/vagrant' | ||
| echo "GOROOT=${GOROOT}" | ||
| echo "GOPATH=${GOPATH}" | ||
| echo "PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin" | ||
| echo "VITESS_WORKSPACE=/vagrant/src/vitess.io/vitess" | ||
| } >> /etc/environment | ||
| # shellcheck disable=SC2013 | ||
| # shellcheck disable=SC2163 | ||
| for line in $( cat /etc/environment ) ; do export "$line" ; done # source environment file | ||
|
|
||
| printf "\nSetting higher limit for max number of open files\n" | ||
| echo "fs.file-max = 10000" >> /etc/sysctl.conf | ||
| sysctl -p | ||
|
|
||
| # Provisioning completed | ||
| touch $SEED_FILE | ||
| printf "\nProvisioning completed!\n\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # See http://vitess.io/getting-started/local-instance.html#manual-build | ||
| # for more info | ||
| # | ||
| set -ex | ||
|
|
||
| ulimit -n 10000 | ||
| export MYSQL_FLAVOR=MySQL56 | ||
| export VT_MYSQL_ROOT=/usr | ||
|
|
||
| printf "\nBuilding Vitess...\n" | ||
|
|
||
| # This is just to make sure the vm can write into these directories | ||
| sudo chown "$(whoami)":"$(whoami)" /vagrant | ||
| sudo chown "$(whoami)":"$(whoami)" /vagrant/src | ||
| cd "$VITESS_WORKSPACE" | ||
| ./bootstrap.sh | ||
| # shellcheck disable=SC1091 | ||
| source dev.env | ||
| # shellcheck disable=SC1091 | ||
| source /vagrant/dist/grpc/usr/local/bin/activate | ||
| pip install mysqlclient | ||
| make build | ||
|
|
||
| printf "\Build completed\n\n." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| printf "\nStarting Vitess cluster\n" | ||
|
|
||
| export VTROOT=/vagrant | ||
| export VTDATAROOT=/tmp/vtdata-dev | ||
| export MYSQL_FLAVOR=MySQL56 | ||
| cd "$VITESS_WORKSPACE"/examples/local | ||
| export SHARD="-" | ||
| ./zk-up.sh | ||
| ./vtctld-up.sh --enable-grpc-static-auth | ||
| ./vttablet-up.sh --enable-grpc-static-auth | ||
| ./vtgate-up.sh --enable-grpc-static-auth | ||
| sleep 3 | ||
| ./lvtctl.sh InitShardMaster -force test_keyspace/- test-100 | ||
| ./lvtctl.sh ApplySchema -sql "$(cat create_test_table.sql)" test_keyspace | ||
| ./lvtctl.sh ApplyVSchema -vschema_file vschema.json test_keyspace | ||
| ./lvtctl.sh RebuildVSchemaGraph | ||
|
|
||
| printf "\nVitess cluster started successfully.\n\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| printf "\nStopping Vitess cluster\n" | ||
|
|
||
| export VTROOT=/vagrant | ||
| export VTDATAROOT=/tmp/vtdata-dev | ||
| export MYSQL_FLAVOR=MySQL56 | ||
| cd "$VITESS_WORKSPACE"/examples/local | ||
|
|
||
| ./vtgate-down.sh | ||
| ./vttablet-down.sh | ||
| ./vtctld-down.sh | ||
| ./zk-down.sh | ||
|
|
||
| rm -rf $VTDATAROOT | ||
|
|
||
| printf "\nVitess cluster stopped successfully.\n\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # | ||
| set -ex | ||
|
|
||
| ulimit -n 10000 | ||
| export VT_GO_PARALLEL_VALUE=4 | ||
| export VTDATAROOT=/tmp/vtdata | ||
| export VTROOT=/vagrant | ||
| export PYTHONROOT=$VTROOT/dist/grpc/usr/local/lib/python2.7/site-packages | ||
|
|
||
| printf "\nStarting Vitess test suite...\n" | ||
|
|
||
| cd "$VITESS_WORKSPACE" | ||
| # shellcheck disable=SC1091 | ||
| source dev.env | ||
| # shellcheck disable=SC1091 | ||
| source /vagrant/dist/grpc/usr/local/bin/activate | ||
| make site_test | ||
| rm -rf "$VTDATAROOT" | ||
|
|
||
| printf "\nVitess test suite completed.\n\n" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR reminds me of something @rafael :)
FYI: the previous
nfsbug in Vagrant/Virtualbox -> macOS that didn't allow us to use it it's now fixed in the latest High Sierra release.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still having issues with nfs, even on High Sierra. :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh really :( - Which issues? I'm High Sierra, working for me.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is what I'm getting.