-
Notifications
You must be signed in to change notification settings - Fork 35
/
Vagrantfile
71 lines (63 loc) · 2.96 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
# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Create box
Vagrant.configure("2") do |config|
config.vm.define "containerd-linux"
config.vm.box = "hashicorp/bionic64"
config.vm.provider "libvirt" do |v, override|
override.vm.box = "generic/debian10"
override.vm.synced_folder ".", "/home/vagrant/go/src/github.com/Roblox/nomad-driver-containerd", type: "nfs", nfs_version: 4, nfs_udp: false
end
config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/Roblox/nomad-driver-containerd"
config.ssh.extra_args = ["-t", "cd /home/vagrant/go/src/github.com/Roblox/nomad-driver-containerd; bash --login"]
config.vm.network "forwarded_port", guest: 4646, host: 4646, host_ip: "127.0.0.1"
config.vm.provider "virtualbox" do |vb|
vb.name = "containerd-linux"
vb.cpus = 2
vb.memory = 2048
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y unzip gcc runc jq
echo "export GOPATH=/home/vagrant/go" >> /home/vagrant/.bashrc
echo "export PATH=$PATH:/usr/local/go/bin" >> /home/vagrant/.bashrc
echo "export CONTAINERD_NAMESPACE=nomad" >> /home/vagrant/.bashrc
source /home/vagrant/.bashrc
# without keeping HOME env, 'sudo make test' will try to find files under /root/go/
echo "Defaults env_keep += HOME" | sudo tee /etc/sudoers.d/keep_home
# Install golang-1.19.1
if [ ! -f "/usr/local/go/bin/go" ]; then
curl -s -L -o go1.19.1.linux-amd64.tar.gz https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz
sudo chmod +x /usr/local/go
rm -f go1.19.1.linux-amd64.tar.gz
fi
# Install nomad-1.1.12
if [ ! -f "/usr/bin/nomad" ]; then
wget --quiet https://releases.hashicorp.com/nomad/1.1.12/nomad_1.1.12_linux_amd64.zip
unzip nomad_1.1.12_linux_amd64.zip -d /usr/bin
chmod +x /usr/bin/nomad
rm -f nomad_1.1.12_linux_amd64.zip
fi
# Install containerd-1.5.5
if [ ! -f "/usr/local/bin/containerd" ]; then
curl -L --silent -o containerd-1.5.5-linux-amd64.tar.gz https://github.com/containerd/containerd/releases/download/v1.5.5/containerd-1.5.5-linux-amd64.tar.gz
tar -C /usr/local -xzf containerd-1.5.5-linux-amd64.tar.gz
rm -f containerd-1.5.5-linux-amd64.tar.gz
fi
# Install nerdctl 0.11.1
if [ ! -f "/usr/local/bin/nerdctl" ]; then
curl -L --silent -o nerdctl-0.11.1-linux-amd64.tar.gz https://github.com/containerd/nerdctl/releases/download/v0.11.1/nerdctl-0.11.1-linux-amd64.tar.gz
tar -C /usr/local/bin -xzf nerdctl-0.11.1-linux-amd64.tar.gz
rm -f nerdctl-0.11.1-linux-amd64.tar.gz
fi
# Create source directory for privileged.nomad example job.
mkdir -p /tmp/s1
# Prepare nomad host volume
mkdir -p /tmp/host_volume/s1
# Run setup
cd /home/vagrant/go/src/github.com/Roblox/nomad-driver-containerd/vagrant
./setup.sh
SHELL
end