FarmVibes.AI VM Setup

This documents assists you on creating a new Azure VM that is capable of running FarmVibes.AI from scratch.

Requirements

  • You’ll need a Linux computer or Windows Subsystem for Linux in your Windows Machine.

  • The Azure CLI will need to be installed. More info here.

  • You’ll need an Azure Subscription. More details on how to setup one can be found here.

  • Once you have access to a subscription, you’ll need to create a resource group or use an existing resource group for which you have at least a contributor role.

  • You’ll also need a ssh public key (ideally in the default location at ~/.ssh/id_rsa.pub). If you don’t have a ssh key, one can be generated by running ssh-keygen in your shell. When creating the VM, we add this public key to your VM so you can log in easily (more info on SSH keys for accessing VMs are available here).

  • You’ll need access to two files in the FarmVibes repo, farmvibes_ai_vm.bicep and setup_farmvibes_ai_vm.sh both in the folder resources/vm/. To access these files you can copy them directly from our repo or clone the whole repo to your local computer.

Creating a new Ubuntu VM

  1. Login into Azure using Azure CLI:

az login
  1. If you have multiple Azure Subscriptions, select the subscription that you want to use:

az account set --subscription <SUBSCRIPTION NAME>
  1. From the repo root, you’ll need to run the following deployment command:

az deployment group create --resource-group <resource_group> \
   --name <deployment_name> \
   --template-file  resources/vm/farmvibes_ai_vm.bicep \
   --parameters \
            ssh_public_key="$(cat ~/.ssh/id_rsa.pub)" \
            vm_suffix_name=<my_test_suffix> \
            encoded_script="$(cat resources/vm/setup_farmvibes_ai_vm.sh | gzip -9 | base64 -w0)"

Please, change <resource_group>, <deployment_name>, and <my_test_suffix> to names of your preference.

  • <resource_group> refers to the resource group the VM to be deployed.

  • <deployment_name> specifies the name of this VM deployment. If you do not pass this argument, az cli assumes the deployment name as the bicep file file.

  • <my_test_suffix>. VMs are created with the prefix farmvibes-ai-vm-. Then, if you create a VM with suffix testvibes, the machine name should be farmvibes-ai-vm-testvibes. Azure VM names cannot can’t use spaces, control characters, or these characters ~ ! @ # $ % ^ & * ( ) = + _ [ ] { } \ | ; : . ' " , < > / ?.

You can see the list of VM parameters in the file resources/vm/farmvibes_ai_vm.bicep.

  1. Once the script completes, a JSON describing the resources created will be printed in the shell. You can get the ssh connection command with the following command.

az deployment group show \
  -g <resource_group> \
  -n <deployment_name> \
  --query properties.outputs.ssh_command.value

Once the VM is succefully created, you can follow the steps on the quickstart guide to install FarmVibes.AI and get it operational. Please note that all the required dependencies (such as docker) will already be installed in the VM.