Skip to content

Commit bcb573a

Browse files
committed
add vagrant init guide script
1 parent aa86c84 commit bcb573a

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

dev.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
1. The `vagrant up` command starts the VM and runs `provision.sh` as user `root`. The `provision.sh` installs Docker and minikube and pulls related Docker images. It also generates a `start.sh`. Users should run `vagrant ssh` and execute `start.sh` inside the VM as user `vagrant`. The `start.sh` starts minikube, deploys Argo/Tekton, and run all the services in the VM.
1010
1. Every time we edit the `provison.sh`, we can run `vagrant provision` to rerun `provision.sh` as root. This rerun would see the previously installed software. So `provision.sh` contains some `if..else` structures to skip reinstalling software.
1111
1. To suspend the VM, run `vagrant halt`. You can run `vagrant up` later to resume it.
12-
1. To completely destroy the VM and re-provision it, run `vagrant reload`.
12+
1. To completely destroy the VM and re-provision it, run `vagrant destroy` and `vagrant up`.
13+
14+
We have provided an install shell script for you to get an easy initialization. You can run it with:
15+
```bash
16+
./install.sh [inchina]
17+
```
18+
It will guide you to setup the vagrant environment. Especially, for developers in China, you may add the `inchina` param to download the ubuntu box for vagrant beforehand. After the initialization, you will have a virtual machine named `playground_default...` in VirtualBox which is already provisioned. You may follow the direction of the output to get things done.
1319

1420
### For Releaser
1521

@@ -41,5 +47,5 @@ Or, if s/he has an AWS or Google Cloud account, s/he could upload the `.ova` fil
4147
Anyway, given a running VM, the end-user can run the following command to connect to it:
4248

4349
```bash
44-
sqlflow -server=my-vm.aws.com:3306
50+
sqlflow --sqlflow_server=my-vm.aws.com:50051
4551
```

install.bash

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020 The SQLFlow Authors. All rights reserved.
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
18+
if [[ "$1" == "inchina" ]]; then
19+
export WE_ARE_IN_CHINA=true
20+
fi
21+
22+
echo
23+
echo "Welcome to SQLFlow playground!"
24+
echo
25+
26+
if ! which vagrant >/dev/null; then
27+
echo "Install vagrant first, please refer to https://www.vagrantup.com/downloads.html"
28+
echo
29+
echo "If you are using macOS, the operation system may prevent you from installing the web-downloaded package, you can try use brew to install vagrant. like:"
30+
echo "brew cask install vagrant"
31+
echo
32+
echo "Fix this and re-run this script again please!"
33+
exit 0
34+
fi
35+
36+
if [[ -n "$(vagrant global-status --prune | grep -o 'playground')" ]]; then
37+
echo "It seems you have already installed our playground, exiting..."
38+
exit 0
39+
fi
40+
41+
if [[ "$WE_ARE_IN_CHINA" ]]; then
42+
if [[ -z "$(vagrant box list | grep -o ubuntu/bionic64)" ]]; then
43+
echo "Download ubuntu box beforehand..."
44+
mkdir -p downloads
45+
# try with https://mirrors.ustc.edu.cn/ if below not work
46+
wget -c -nv --show-progress -O downloads/ubuntu-bionic64.box "https://mirrors.ustc.edu.cn/ubuntu-cloud-images/bionic/current/bionic-server-cloudimg-amd64-vagrant.box"
47+
vagrant box add ubuntu/bionic64 downloads/ubuntu-bionic64.box
48+
fi
49+
fi
50+
51+
echo "Start and provision the playgound now..."
52+
vagrant up
53+

0 commit comments

Comments
 (0)