-
Notifications
You must be signed in to change notification settings - Fork 82
/
Vagrantfile
62 lines (53 loc) · 2.26 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
# Read the branch's Go version from the .go-version file.
GO_VERSION = File.read(File.join(File.dirname(__FILE__), ".go-version")).strip
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vbox|
vbox.memory = 8192
vbox.cpus = 6
end
# require plugin https://github.com/leighmcculloch/vagrant-docker-compose
# vagrant plugin install vagrant-docker-compose
config.vagrant.plugins = "vagrant-docker-compose"
# install docker and docker-compose
config.vm.provision :docker
config.vm.provision :docker_compose
config.vm.define "fleet-dev" do |nodeconfig|
nodeconfig.vm.box = "ubuntu/jammy64"
nodeconfig.vm.hostname = "fleet-server-dev"
nodeconfig.vm.network "private_network",
hostname: true,
ip: "192.168.56.43" # only 192.168.56.0/21 range allowed: https://www.virtualbox.org/manual/ch06.html#network_hostonly
nodeconfig.vm.network "forwarded_port", guest: 4243, host: 4243, id: "delve"
nodeconfig.vm.network "forwarded_port", guest: 8220, host: 8220, id: "fleet-server"
# fleet-server needs the agent, so let's mount it all
nodeconfig.vm.synced_folder "../", "/vagrant"
nodeconfig.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = 8192
vb.cpus = 2
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
nodeconfig.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade -y
apt-get install -y \
build-essential \
curl \
delve \
make \
unzip \
vim \
wget \
zip
curl -sL -o /tmp/go#{GO_VERSION}.linux-amd64.tar.gz https://go.dev/dl/go#{GO_VERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf /tmp/go#{GO_VERSION}.linux-amd64.tar.gz
echo "alias ll='ls -la'" > /etc/profile.d/ll.sh
echo 'export PATH=$PATH:/usr/local/go/bin' > /etc/profile.d/go.sh
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> /etc/profile.d/go.sh
curl -sL -o /tmp/mage.tar.gz https://github.com/magefile/mage/releases/download/v1.13.0/mage_1.13.0_Linux-64bit.tar.gz
tar -xf /tmp/mage.tar.gz
mv mage /usr/local/bin
SHELL
nodeconfig.vm.provision "shell", reboot: true
end
end