-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathVagrantfile
More file actions
74 lines (70 loc) · 2.58 KB
/
Copy pathVagrantfile
File metadata and controls
74 lines (70 loc) · 2.58 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<-SCRIPT
systemctl stop systemd-resolved.service
echo "nameserver 1.1.1.1" > /etc/resolv.conf
SCRIPT
$docker = <<-SCRIPT
export DEBIAN_FRONTEND=noninteractive
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
apt-get -qq -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -qq -y docker-ce docker-ce-cli containerd.io
systemctl enable docker.service
systemctl start docker.service
SCRIPT
$jupyter = <<-SCRIPT
apt-get update && apt-get install -y python3 python3-pip
su - vagrant -c "pip3 install --user --upgrade jupyter jupyterlab elasticsearch matplotlib"
su - vagrant -c "pip3 install --user --upgrade chardet"
su - vagrant -c "pip3 install --user --upgrade urllib3"
su - vagrant -c "mkdir ~/.jupyter"
cat >> /home/vagrant/.jupyter/jupyter_notebook_config.json <<EOF
{
"NotebookApp": {
"password": "sha1:8df0e1970aef:d7e2823edc213e98342eee0b0ba2d2e652613311"
}
}
EOF
chown vagrant /home/vagrant/.jupyter/jupyter_notebook_config.json
su - vagrant -c "nohup /home/vagrant/.local/bin/jupyter lab --ip=0.0.0.0 & sleep 1"
echo "Visit port 8888. Password is vagrant"
SCRIPT
$check_notebooks = <<-SCRIPT
if [ ! -d /home/vagrant/notebooks ]; then
mkdir -p /home/vagrant/notebooks && cd /home/vagrant/notebooks
wget -4 -q https://raw.githubusercontent.com/ccdcoe/CDMCS/master/Arkime/queries/001-moloch-api.ipynb -O /home/vagrant/notebooks/001-moloch-api.ipynb
fi
SCRIPT
Vagrant.configure(2) do |config|
config.vm.define 'moloch-querybox' do |box|
box.vm.box = "ubuntu/bionic64"
box.vm.hostname = 'moloch-querybox'
box.vm.network :private_network, ip: "192.168.56.13"
box.vm.synced_folder "./", "/home/vagrant/notebooks"
box.vm.provider :hyperv do |hv, override|
hv.cpus = 4
hv.maxmemory = 4096
override.vm.box = "generic/ubuntu1804"
#override.vm.synced_folder ".", "/vagrant", type: "smb"
end
box.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "4"]
end
#box.vm.provision "shell", inline: $script
box.vm.provision "shell", inline: $docker
box.vm.provision "shell", inline: $jupyter
box.vm.provision "shell", inline: $check_notebooks
box.vm.provision "shell", path: "provision.sh"
end
end