Install a node in Vagrant
You can create virtual Great Bear nodes in VirtualBox using Vagrant. To prepare a virtual machine to use as a Great Bear node using Vagrant, complete the following steps.
Prerequisites
- Make sure that your system supports Vagrant and the associated virtualization provider (in this case, VirtualBox). At the time of writing the systems we have validated are Apple Mac x86 and Windows x86.
- You have downloaded and installed VirtualBox.
- You have downloaded and installed Vagrant.
-
The node must be able to access the Internet on TCP port 443.
Create and bootstrap a new VM
-
Create a new directory and create a file called
Vagrantfile
into the directory with the following contents:# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.define "node-0" do |leader| leader.vm.box = "ubuntu/jammy64" leader.vm.hostname = "node-0" leader.vm.network "private_network", ip: "192.168.56.10" # Uncomment the next line for enabling VNC server with the EDD application on VM node-0 #leader.vm.network "forwarded_port", guest: 5900, host: 5901 end config.vm.define "node-1" do |worker1| worker1.vm.box = "ubuntu/jammy64" worker1.vm.hostname = "node-1" worker1.vm.network "private_network", ip: "192.168.56.11" # Uncomment the next line for enabling VNC server with the EDD application on VM node-1 #worker1.vm.network "forwarded_port", guest: 5900, host: 5902 end config.vm.define "node-2" do |worker2| worker2.vm.box = "ubuntu/jammy64" worker2.vm.hostname = "node-2" worker2.vm.network "private_network", ip: "192.168.56.12" # Uncomment the next line for enabling VNC server with the EDD application on VM node-2 #worker2.vm.network "forwarded_port", guest: 5900, host: 5903 end config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end config.vm.provision "shell", inline: <<-SHELL apt-get update 1>/dev/null SHELL end
The Vagrantfile defines three VMs, named node-0, node-1 and node-2.
-
Start a virtual machine by running
vagrant up [machine name]
- if you omit machine name, vagrant will bring up all three VMsNote: If you receive an
NS_ERROR_FAILURE
error when starting the VM, check the security permissions of VirtualBox.
Bootstrap the node
Steps
-
Select the node you want to bootstrap. For example, for node-0 type
vagrant ssh node-0
-
Set the HARDWARE_ID environmental variable. This value will be used to register the node in the dashboard. For example:
export HARDWARE_ID="xx:xx:xx:xx:xx:xx"
Note: The HARDWARE_ID must be:
- Unique within Great Bear, as this ID also identifies the node on the dashboard.
- Between 8 and 128 characters long.
- Include only ASCII letters (
A-Za-z
), numbers (0-9
), and the:-_
characters.
Using the MAC address, the serial number of the CPU, or a similar Universally Unique Identifier (UUID) is a convenient way to make sure the ID has not already been used within Great Bear.
-
Run the following command to bootstrap the node:
curl https://get.greatbear.io/pub/get.sh | \ TOKEN=<access-token> DEVICE_KEY=<device-key> sh
Note: You can bootstrap the node with an agent showing more verbose logs by adding the
LOG_LEVEL=DEBUG
option. -
That’s it! Next you can Start using your node.
Troubleshooting
In case you encounter problems, see our Troubleshooting guide.
Stop or delete the VM
If you stop the VM, the Great Bear dashboard will show that the node is offline. You can start the node again to bring it back online later if needed.
If you delete the VM, the node will no longer come back online when restarted, and you will have to register it again on the Great Bear dashboard.
- To stop the VM, run
vagrant down
- To restart the VM, run
vagrant up
- To remove the VM entirely, run
vagrant destroy