Skip to content

Commit aa86c84

Browse files
authored
Merge pull request #11 from sql-machine-learning/split_provision_and_start.sh
Split provision and start.sh
2 parents ca22205 + 51838f0 commit aa86c84

File tree

5 files changed

+90
-106
lines changed

5 files changed

+90
-106
lines changed

Vagrantfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33

44
Vagrant.configure("2") do |config|
55
config.vm.box = "ubuntu/bionic64"
6-
config.vm.provision "shell", path: "provision.sh"
6+
config.vm.provision "shell", path: "provision.bash"
77

88
# Don't forward 22. Even if we do so, the exposed port only binds
99
# to 127.0.0.1, but not 0.0.0.0. Other ports binds to all IPs.
10-
config.vm.network "forwarded_port", guest: 3306, host: 3306
11-
config.vm.network "forwarded_port", guest: 50051, host: 50051
12-
config.vm.network "forwarded_port", guest: 8888, host: 8888
13-
14-
# public_network eases debugging -- I can SSH from iMac to the VM
15-
# without the need of forwarding port to the host workstation.
16-
config.vm.network "public_network", ip: "192.168.0.17"
10+
config.vm.network "forwarded_port", guest: 3306, host: 3306,
11+
auto_correct: true
12+
config.vm.network "forwarded_port", guest: 50051, host: 50051,
13+
auto_correct: true
14+
config.vm.network "forwarded_port", guest: 8888, host: 8888,
15+
auto_correct: true
1716

1817
config.vm.provider "virtualbox" do |v|
1918
v.memory = 16384
2019
v.cpus = 8
2120
end
21+
22+
# Bind the host directory ./ into the VM.
23+
config.vm.synced_folder "./", "/home/vagrant/desktop"
2224
end

provision.bash

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
set -e # Exit script if any error
4+
5+
echo "Installing Docker ..."
6+
# c.f. https://dockr.ly/3cExcay
7+
if which docker > /dev/null; then
8+
echo "Docker had been installed. Skip."
9+
else
10+
curl -fsSL https://get.docker.com | sh -
11+
usermod -aG docker vagrant
12+
fi
13+
echo "Done."
14+
15+
echo "Docker pull SQLFlow images ..."
16+
# c.f. https://github.com/sql-machine-learning/sqlflow/blob/develop/.travis.yml
17+
docker pull --quiet sqlflow/sqlflow:latest
18+
echo "Done."
19+
20+
# The shared folder is specified in Vagrantfile.
21+
VAGRANT_SHARED_FOLDER=/home/vagrant/desktop
22+
23+
echo "Install axel ..."
24+
if which axel > /dev/null; then
25+
echo "axel installed. Skip."
26+
else
27+
$VAGRANT_SHARED_FOLDER/sqlflow/scripts/travis/install_axel.sh
28+
fi
29+
30+
echo "Export Kubernetes environment variables ..."
31+
# NOTE: According to https://stackoverflow.com/a/16619261/724872,
32+
# source is very necessary here.
33+
source $VAGRANT_SHARED_FOLDER/sqlflow/scripts/travis/export_k8s_vars.sh
34+
35+
echo "Installing kubectl ..."
36+
if which kubectl > /dev/null; then
37+
echo "kubectl installed. Skip."
38+
else
39+
$VAGRANT_SHARED_FOLDER/sqlflow/scripts/travis/install_kubectl.sh
40+
fi
41+
echo "Done."
42+
43+
echo "Installing minikube ..."
44+
if which minikube > /dev/null; then
45+
echo "minikube installed. Skip."
46+
else
47+
$VAGRANT_SHARED_FOLDER/sqlflow/scripts/travis/install_minikube.sh
48+
fi
49+
echo "Done."
50+
51+
echo "Configure minikube ..."
52+
mkdir -p /home/vagrant/.kube /home/vagrant/.minikube
53+
touch /home/vagrant/.kube/config
54+
chown -R vagrant /home/vagrant/.bashrc
55+
echo "Done."

provision.sh

Lines changed: 0 additions & 97 deletions
This file was deleted.

start.bash

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copyright 2020 The SQLFlow Authors. All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
set -e
16+
17+
# NOTE: According to https://stackoverflow.com/a/16619261/724872,
18+
# source is very necessary here.
19+
source $(dirname $0)/sqlflow/scripts/travis/export_k8s_vars.sh
20+
21+
$(dirname $0)/sqlflow/scripts/travis/start_minikube.sh
22+
sudo chown -R vagrant: $HOME/.minikube/
23+
24+
$(dirname $0)/sqlflow/scripts/travis/start_argo.sh

0 commit comments

Comments
 (0)