Skip to content

Commit 56dfbb0

Browse files
committed
add publish script
1 parent 7fae593 commit 56dfbb0

File tree

5 files changed

+73
-19
lines changed

5 files changed

+73
-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: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,30 @@
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 [sqlflow](https://github.com/sql-machine-learning/sqlflow/blob/develop/doc/run/cli.md) command-line tool released by SQLFlow CI, and
53+
1. the released `SQLFlowPlayground.ova`, download [here](http://cdn.sqlflow.tech/latest/SQLFlowPlayground.ova).
6054
61-
If the end-user has VirtualBox installed -- no Vagrant required -- s/he could import the `.ova` file and start an VM.
55+
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`.
56+
```bash
57+
58+
[email protected]'s password: vagrant
59+
```
60+
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. Enjoy it!
61+
```bash
62+
./start.bash
63+
```
6264

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/).
65+
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/).
6466

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

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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
echo "Stoping the vm ..."
4+
vagrant halt
5+
echo "Done."
6+
7+
echo "Finding playground vm ..."
8+
vm=$(VBoxManage list vms | grep "playground_default" | head -1)
9+
if [[ ! "$vm" =~ playground_default* ]]; then
10+
echo "No palyground virtual machine found."
11+
exit 1
12+
fi
13+
vm=$(echo $vm | awk -F"\"" '{print $2}')
14+
echo "Found $vm ."
15+
16+
echo "Remove shared folder ..."
17+
VBoxManage sharedfolder remove "$vm" --name home_vagrant_desktop
18+
VBoxManage sharedfolder remove "$vm" --name vagrant
19+
echo "Done."
20+
21+
echo "Exporting vm ..."
22+
VBoxManage export "$vm" -o SQLFlowPlayground.ova
23+
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)