This repository was archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathVagrantfile
110 lines (94 loc) · 3.51 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
umbrelLogo = <<-TEXT
,;###GGGGGGGGGGl#Sp
,##GGGlW""^' '`""%GGGG#S,
,#GGG" "lGG#o
#GGl^ '$GG#
,#GGb \GGG,
lGG" "GGG
#GGGlGGGl##p,,p##lGGl##p,,p###ll##GGGG
!GGGlW"""*GGGGGGG#""""WlGGGGG#W""*WGGGGS
"" "^ '" ""
@GGS lG#
!GGG !GGG
!GGG !GGG
!GGG !GGG
!GGG !GGG
!GGG !GGG
'GGG $GGl
"GGG#psqp##GG#
"%GGGGGG#"
TEXT
Vagrant.configure(2) do |config|
# Define VM compute resources
CORES = ENV.fetch("UMBREL_DEV_CORES", 2)
MEMORY = ENV.fetch("UMBREL_DEV_MEMORY", 2048)
# Setup VM
config.vm.define "umbrel-dev"
config.vm.box = (ENV.fetch("ARCH", "x86_64").include?("arm")) ? "avi0xff/debian10-arm64" : "debian/buster64"
config.vm.hostname = "umbrel-dev"
config.vm.network "public_network", bridge: "en0: Wi-Fi"
# Private network needed for NFS share
# The 'Vagrant core NFS helper' will use an IP in the 192.168.56.0/21 network.
# We assign an IP in the middle of that range that is unlikely to be in use
config.vm.network "private_network", ip: "192.168.56.56"
# Disable sync of default vagrant folder
config.vm.synced_folder '.', '/vagrant', disabled: true
# Mount source into /code and use bindfs to re-map to /vagrant with correct ownership
config.vm.synced_folder ".", "/code", type: "nfs"
# Bindfs config.
config.bindfs.force_empty_mountpoints = true
config.bindfs.default_options = {
force_user: 'vagrant',
force_group: 'vagrant',
# Everything is owned by vagrant:vagrant and Umbrel will chown from time to time
# Causing an operation not permitted error, this ignores that error
o: 'chown-ignore'
}
config.bindfs.bind_folder "/code", "/vagrant"
# VirtualBox config.
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cpus", CORES]
vb.customize ["modifyvm", :id, "--memory", MEMORY]
end
# Parallels config.
config.vm.provider "parallels" do |parallels|
parallels.cpus = CORES
parallels.memory = MEMORY
end
# Update package lists
config.vm.provision "shell", inline: <<-SHELL
apt-get update
SHELL
# Install Docker
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get install -y curl python3-pip libffi-dev
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker vagrant
pip3 install -U "bcrypt<4.0.0"
pip3 install docker-compose
SHELL
# Install Avahi
config.vm.provision "shell", inline: <<-SHELL
apt-get install -y avahi-daemon avahi-discover libnss-mdns
SHELL
# Install yq
config.vm.provision "shell", inline: <<-SHELL
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
tar xz && mv ${BINARY} /usr/bin/yq
SHELL
# Install Umbrel
config.vm.provision "shell", inline: <<-SHELL
apt-get install -y fswatch rsync jq git
cd /vagrant/getumbrel/umbrel
sudo NETWORK=regtest ./scripts/configure
docker-compose build --parallel
docker-compose run dashboard -c yarn
SHELL
# Start Umbrel on boot
config.vm.provision "shell", run: 'always', inline: <<-SHELL
cd /vagrant/getumbrel/umbrel
./scripts/start
SHELL
# Message
config.vm.post_up_message = "#{umbrelLogo}\nUmbrel development environment ready: http://#{config.vm.hostname}.local"
end