-
Notifications
You must be signed in to change notification settings - Fork 7
Add vagrant init guide script #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2020 The SQLFlow Authors. All rights reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
if [[ "$1" == "inchina" ]]; then | ||
export WE_ARE_IN_CHINA=true | ||
fi | ||
|
||
echo | ||
echo "Welcome to SQLFlow playground!" | ||
echo | ||
|
||
if ! which vagrant >/dev/null; then | ||
echo "Install vagrant first, please refer to https://www.vagrantup.com/downloads.html" | ||
echo | ||
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:" | ||
echo "brew cask install vagrant" | ||
echo | ||
echo "Fix this and re-run this script again please!" | ||
exit 0 | ||
fi | ||
|
||
if [[ -n "$(vagrant global-status --prune | grep -o 'playground')" ]]; then | ||
echo "It seems you have already installed our playground, exiting..." | ||
exit 0 | ||
fi | ||
|
||
if [[ "$WE_ARE_IN_CHINA" ]]; then | ||
if [[ -z "$(vagrant box list | grep -o ubuntu/bionic64)" ]]; then | ||
echo "Download ubuntu box beforehand..." | ||
mkdir -p downloads | ||
# try with https://mirrors.ustc.edu.cn/ if below not work | ||
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script might run on macOS, Windows, and Linux, right? It needs the way to install axel.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like described above, now, I'm focused on macOS and Linux, especially for Chinese developers. Currently, make the provision progress fast takes a higher priority. Maybe I can fix this up in future PRs. |
||
vagrant box add ubuntu/bionic64 downloads/ubuntu-bionic64.box | ||
fi | ||
fi | ||
|
||
echo "Start and provision the playgound now..." | ||
vagrant up | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we know that we are in China? And, users in other regions around the world might also need to use their local mirrors. How about we don't care if users are specifically in China, but support mirrors by downloading with
axel
other thanwget
?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did tried to use
axel --search
, it turned out that the axel reliedfilesearching.com
can't be accessed in China.I also want to give multiple urls to axels, but, it seems we can't enumerate the box's mirrors, really, vagrant do not have so many well-known official mirrors like other software.
Plus the fact we have to consider how to install axel itself in kinds of OS, I decided to make it work first, just use the
wget
.Especially for China, I add a param
inchina
. Actually, if this param is not present, the script just runvagrant up
and delegate the work to standard vagrant provision process.Other thought:
I want to make the install more intelligent, so I tried to figure out if we are in China automatically. I found this tool. I will try it in a more standard environment (in the vm, we don't have to consider the os) but not in this install script. It will in my next PR.