Skip to content

Commit

Permalink
add cache for vm
Browse files Browse the repository at this point in the history
  • Loading branch information
lhw362950217 committed Jul 6, 2020
1 parent 8316039 commit 444701b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
11 changes: 6 additions & 5 deletions dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### For Developers

1. Install [VirtualBox](https://www.virtualbox.org/) and [Vagrant](https://www.vagrantup.com/) on a computer with a relatively large memory size. As a recommendation, a host with 16G memory and 8 cores is preferred.
1. Install [VirtualBox 6.1.6](https://www.virtualbox.org/) and [Vagrant 2.2.7](https://www.vagrantup.com/) on a computer with a relatively large memory size. As a recommendation, a host with 16G memory and 8 cores is preferred.
1. Clone and update `SQLFlow playground` project.
```bash
git clone https://github.com/sql-machine-learning/playground.git
Expand Down Expand Up @@ -47,9 +47,10 @@ According to this [tutorial](https://www.techrepublic.com/article/how-to-import-
### For End-users
To run SQLFlow on a desktop computer running Windows, Linux, or macOS, you need to download
To run SQLFlow on a desktop computer running Windows, Linux, or macOS, follow below steps:
1. install [VirtualBox](https://www.virtualbox.org/) (v6.1.6 is recommended)
1. the released VirtualBox `.ova` file, you have two choices:
1. download the released VirtualBox `.ova` file, you have two choices:
- the minimized image (about 600M): shipped with all bootstrap files but no dependency docker images. When you start the playground, you will wait for a while to download the latest docker images, minikube framework and other packages.
```bash
wget -c http://cdn.sqlflow.tech/latest/SQLFlowPlaygroundBare.ova
Expand All @@ -58,9 +59,9 @@ To run SQLFlow on a desktop computer running Windows, Linux, or macOS, you need
```bash
wget -c http://cdn.sqlflow.tech/latest/SQLFlowPlaygroundFull.ova
```
1. optional, the [sqlflow](https://github.com/sql-machine-learning/sqlflow/blob/develop/doc/run/cli.md) command-line tool released by SQLFlow CI.
1. optional, download the [sqlflow](https://github.com/sql-machine-learning/sqlflow/blob/develop/doc/run/cli.md) command-line tool released by SQLFlow CI.
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 `sqlflow`.
After VirtualBox is installed, you can import the `.ova` file and start a VM. If you have a relative lower configuration, you can adjust the CPU core and RAM amount in VirtualBox's setting panel, say, to 2 cores and 4G RAM. 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 `sqlflow`.
```bash
ssh -p2222 [email protected]
[email protected]'s password: sqlflow
Expand Down
10 changes: 9 additions & 1 deletion provision.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VAGRANT_SHARED_FOLDER=/home/vagrant/desktop
source $VAGRANT_SHARED_FOLDER/sqlflow/docker/dev/find_fastest_resources.sh

echo "Setting apt-get mirror..."
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* /etc/apt/sources.list
find_fastest_apt_source >/etc/apt/sources.list
apt-get update

Expand Down Expand Up @@ -91,3 +91,11 @@ sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/g' \
/etc/ssh/sshd_config
service ssh restart
echo "Done."


echo "Disable cloudimg grub settings ..."
sed -i -e 's/^GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/g' \
-e 's/^#GRUB_TERMINAL=console$/GRUB_TERMINAL=console/g' /etc/default/grub
rm /etc/default/grub.d/50-cloudimg-settings.cfg
update-grub
echo "Done."
3 changes: 2 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ VBoxManage sharedfolder remove "$vm" --name home_vagrant_desktop
VBoxManage sharedfolder remove "$vm" --name vagrant
echo "Done."

echo "Rebind serial port file"
echo "Rebind serial port file and disable it because it does not work on Windows"
VBoxManage modifyvm "$vm" --uartmode1 file /tmp/playground.log
VBoxManage modifyvm "$vm" --uart1 off
echo "Done."

echo "Exporting vm ..."
Expand Down
2 changes: 1 addition & 1 deletion sqlflow
Submodule sqlflow updated 288 files
10 changes: 5 additions & 5 deletions start.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ fi
filebase=/root/scripts

echo "Docker pull dependency images, you can comment this if already have them ..."
if [[ -d "/root/.cache" ]]; then
echo "Cache found at /root/.cache ..."
if [[ ! -f "/root/.cache/.loaded" ]]; then
find /root/.cache/* | xargs -I'{}' docker load -i '{}'
touch /root/.cache/.loaded
if [[ -d "/root/.sqlflow" ]]; then
echo "Cache found at /root/.sqlflow ..."
if [[ ! -f "/root/.sqlflow/.loaded" ]]; then
find /root/.sqlflow/* | xargs -I'{}' sh -c "docker load -i '{}' && sleep 10"
touch /root/.sqlflow/.loaded
fi
else
# c.f. https://github.com/sql-machine-learning/sqlflow/blob/develop/.travis.yml
Expand Down

0 comments on commit 444701b

Please sign in to comment.