Skip to content

Commit 231a971

Browse files
authored
Merge pull request #37 from sql-machine-learning/modify_doc
Add publish script
2 parents 3c93c74 + 8f7b62c commit 231a971

File tree

5 files changed

+90
-19
lines changed

5 files changed

+90
-19
lines changed

Vagrantfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Vagrant.configure("2") do |config|
2626
auto_correct: true
2727

2828
config.vm.provider "virtualbox" do |v|
29-
v.memory = 16384
30-
v.cpus = 8
29+
v.memory = 8192
30+
v.cpus = 4
3131
end
3232

3333
# Bind the host directory ./ into the VM.

dev.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,33 @@
3939
4040
The releaser, which, in most cases, is a developer, can export a running VirtualBox VM into a VM image file with extension `.ova`. An `ova` file is a tarball of a directory, whose content follows the OVF specification. For the concepts, please refer to this [explanation](https://damiankarlson.com/2010/11/01/ovas-and-ovfs-what-are-they-and-whats-the-difference/).
4141
42-
According to this [tutorial](https://www.techrepublic.com/article/how-to-import-and-export-virtualbox-appliances-from-the-command-line/), releasers can run the following command to list running VMs.
42+
According to this [tutorial](https://www.techrepublic.com/article/how-to-import-and-export-virtualbox-appliances-from-the-command-line/), releasers can call the VBoxManage command to export a VM. We have written a scrip to do this. Simply run below script to export our playground. This script will create a file named `SQLFlowPlayground.ova`, we can import the file through virtual box GUI.
4343
4444
```bash
45-
vboxmanage list vms
46-
```
47-
48-
Then, they can run the following command to export the `.ova` file.
49-
50-
```bash
51-
vboxmanage export UBUNTUSERVER164 -o ubuntu_server_new.ova
45+
./publish
5246
```
5347
5448
### For End-users
5549
56-
To run SQLFlow on a desktop computer running Windows, Linux, or macOS, an end-user needs to download
50+
To run SQLFlow on a desktop computer running Windows, Linux, or macOS, you need to download
5751
58-
1. the `sqlflow` command-line tool released by SQLFlow CI, and
59-
1. the released `.ova` file.
52+
1. the released `SQLFlowPlayground.ova`, directly download from [here](http://cdn.sqlflow.tech/latest/SQLFlowPlayground.ova), or use wget:
53+
```bash
54+
wget -c http://cdn.sqlflow.tech/latest/SQLFlowPlayground.ova
55+
```
56+
1. optional, the [sqlflow](https://github.com/sql-machine-learning/sqlflow/blob/develop/doc/run/cli.md) command-line tool released by SQLFlow CI.
6057
61-
If the end-user has VirtualBox installed -- no Vagrant required -- s/he could import the `.ova` file and start an VM.
58+
If you have VirtualBox installed, you can import the `SQLFlowPlayground.ova` file and start a VM. After that, you can log in the system through the VirtualBox GUI or through a ssh connection like below. The default password of `root` is `vagrant`.
59+
```bash
60+
61+
[email protected]'s password: vagrant
62+
```
63+
Once logged in the VM, you will immediately see a script named `start.bash`, just run the script to start SQLFlow playground. It will output some hint messages for you, follow those hints, after a while, you will see something like `Access Jupyter NoteBook at: http://127.0.0.1:8888/...`, it means we are all set. Copy the link to your web browser and you will see SQLFlow's Jupyter Notebook user interface, Enjoy it!
64+
```bash
65+
./start.bash
66+
```
6267

63-
Or, if s/he has an AWS or Google Cloud account, s/he could upload the `.ova` file to start the VM on the cloud. AWS users can follow [these steps](https://aws.amazon.com/ec2/vm-import/).
68+
Or, if you has an AWS or Google Cloud account, you can upload the `.ova` file to start the VM on the cloud. AWS users can follow [these steps](https://aws.amazon.com/ec2/vm-import/).
6469

6570
Anyway, given a running VM, the end-user can run the following command to connect to it:
6671

provision.bash

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,29 @@ else
6464
fi
6565
echo "Done."
6666

67+
echo "Copy files ..."
68+
# In non-develop mode, we want the user see the start.bash
69+
# immediately after she/he logs on the vm
70+
cp "$VAGRANT_SHARED_FOLDER/start.bash" "/root/"
71+
72+
read -r -d '\t' files <<EOM
73+
sqlflow/scripts/travis/export_k8s_vars.sh
74+
sqlflow/docker/dev/find_fastest_resources.sh
75+
sqlflow/scripts/travis/start_argo.sh
76+
sqlflow/doc/run/k8s/install-sqlflow.yaml
77+
\t
78+
EOM
79+
80+
mkdir -p "/root/scripts"
81+
for file in ${files[@]}; do
82+
cp "$VAGRANT_SHARED_FOLDER/$file" "/root/scripts/$(basename $file)"
83+
done
84+
echo "Done."
85+
86+
echo "Change root password ..."
87+
echo "root:vagrant" | chpasswd
88+
sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/g' \
89+
-e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' \
90+
/etc/ssh/sshd_config
91+
service ssh restart
92+
echo "Done."

publish.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
17+
echo "Stoping the vm ..."
18+
vagrant halt
19+
echo "Done."
20+
21+
echo "Finding playground vm ..."
22+
vm=$(VBoxManage list vms | grep "playground_default" | head -1)
23+
if [[ ! "$vm" =~ playground_default* ]]; then
24+
echo "No palyground virtual machine found."
25+
exit 1
26+
fi
27+
vm=$(echo $vm | awk -F"\"" '{print $2}')
28+
echo "Found $vm ."
29+
30+
echo "Remove shared folder ..."
31+
VBoxManage sharedfolder remove "$vm" --name home_vagrant_desktop
32+
VBoxManage sharedfolder remove "$vm" --name vagrant
33+
echo "Done."
34+
35+
echo "Exporting vm ..."
36+
VBoxManage export "$vm" -o SQLFlowPlayground.ova
37+
echo "Done."

start.bash

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ if [[ "$(whoami)" != "root" ]]; then
2525
exit 1
2626
fi
2727

28+
# script base dir for starting the minikube cluster
29+
filebase=/root/scripts
30+
2831
echo "Docker pull dependency images, you can comment this if already have them ..."
2932
# c.f. https://github.com/sql-machine-learning/sqlflow/blob/develop/.travis.yml
3033
docker pull sqlflow/sqlflow:jupyter
@@ -38,8 +41,8 @@ echo "Done."
3841

3942
# NOTE: According to https://stackoverflow.com/a/16619261/724872,
4043
# source is very necessary here.
41-
source $(dirname $0)/sqlflow/scripts/travis/export_k8s_vars.sh
42-
source $(dirname $0)/sqlflow/docker/dev/find_fastest_resources.sh
44+
source $filebase/export_k8s_vars.sh
45+
source $filebase/find_fastest_resources.sh
4346

4447
# (FIXME:lhw) If grep match nothing and return 1, do not exit
4548
# Find a way that we do not need to use 'set -e'
@@ -109,7 +112,7 @@ argo_server_alive=$(is_pod_ready "argo" "app=argo-server")
109112
if [[ "$argo_server_alive" == "yes" ]]; then
110113
echo "Already in running."
111114
else
112-
$(dirname $0)/sqlflow/scripts/travis/start_argo.sh
115+
$filebase/start_argo.sh
113116
fi
114117
wait_or_exit "argo" "is_pod_ready argo app=argo-server" "yes"
115118

@@ -127,7 +130,7 @@ sqlflow_alive=$(is_pod_ready "default" "app=sqlflow-server")
127130
if [[ "$sqlflow_alive" == "yes" ]]; then
128131
echo "Already in running."
129132
else
130-
kubectl apply -f sqlflow/doc/run/k8s/install-sqlflow.yaml
133+
kubectl apply -f $filebase/install-sqlflow.yaml
131134
fi
132135
wait_or_exit "SQLFlow" "is_pod_ready default app=sqlflow-server" "yes"
133136

0 commit comments

Comments
 (0)