forked from IBM/Musketeer-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
110 lines (80 loc) · 2.99 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- mode: ruby -*-
# vi: set ft=ruby :
$machine_addr = "192.168.80.33"
$machine_cap = "90"
$machine_cpus = "2"
$machine_name = "ubuntu-musketeer-client"
$machine_ram = "4096"
$provision_root = <<'SCRIPT_ROOT'
apt-get update
apt-get upgrade
apt-get install -y ca-certificates curl coreutils jq zip python3 python3-pip
SCRIPT_ROOT
$provision_user = <<'SCRIPT_USER'
echo "Upgrading pip"
python3 -m pip install --upgrade pip
echo "Adding local pip to the path"
export PATH=${HOME}/.local/bin/:${PATH}
echo "pip, installing dependencies"
pip3 install --user certifi urllib3[secure] six==1.12
pip3 install --user virtualenv virtualenvwrapper
pip3 install --user pytest pylint
pip3 install --user --upgrade six
pip3 install --user --upgrade matplotlib
pip3 install --user --upgrade jupyter
pip3 install --user --upgrade pandas
pip3 install --user --upgrade pygam
pip3 install --user -r /vagrant/requirements.txt
jupyter notebook --generate-config
#Set up some niceities in the shell
cat <<'EOF_BASHRC' > $HOME/.bashrc
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
export HISTFILE=/vagrant/bash_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
alias ls='ls --color=auto'
export PS1='\n\@ \w \e[0;32m $(__git_ps1 "(%s)") \e[m \n: \u@\h \j %; '
export PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n$ '
cd /vagrant
EOF_BASHRC
cat <<'EOF_VIM' > $HOME/.vimrc
set hlsearch
set showmode
set showmatch
set noautoindent
set esckeys
set scrolloff=3
" configure expanding of tabs for various file types
au BufRead,BufNewFile *.py set autoindent
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.py set tabstop=4
au BufRead,BufNewFile *.py set softtabstop=4
au BufRead,BufNewFile *.py set shiftwidth=4
" configure expanding of tabs for various file types
au BufRead,BufNewFile *.yaml set autoindent
au BufRead,BufNewFile *.yaml set expandtab
au BufRead,BufNewFile *.yaml set shiftwidth=2
au BufRead,BufNewFile *.yaml set softtabstop=2
au BufRead,BufNewFile *.yaml set tabstop=2
EOF_VIM
SCRIPT_USER
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provision :shell, inline: $provision_root
config.vm.provision :shell, privileged: false, inline: $provision_user
config.vm.network "forwarded_port", host_ip: "127.0.0.1", guest: 8888, host: 8881, auto_correct: true
config.vm.network "forwarded_port", host_ip: "127.0.0.1", guest: 8001, host: 8001, auto_correct: true
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--name", $machine_name]
vb.customize ["modifyvm", :id, "--cpus", $machine_cpus]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", $machine_cap]
vb.customize ["modifyvm", :id, "--memory", $machine_ram]
end
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
config.vm.hostname = $machine_name
config.vm.network :private_network, ip: $machine_addr
end