homeabouttutorials
dog silhouettes

2023-06-8

Spin up a virtual machine!

What if you don't have the hardware necessary to work on a coding problem?
One alternative is to create a 'virtual machine' using a cloud service such as [MS Azure] (https://azure.microsoft.com/), Vultr, Digital Ocean or similar. The downside here is that these are pay as you go services, and they can get a bit costly.

For the Coeur d'Alene Project and other work associated with AILT, we have access to an allocation of cloud compute resources through NSF Access.

Advantages and disadvantages

Spinning up a virtual machine (vm) allows you to easily select an operating system and provision the memory, ram and compute power you want or need for your project. It also provides you with server admin and backups through your cloud provider. While you're a University of Arizona student, you have access to Microsoft Azure services and to a High Performance Computing Cluster, so that you can create a vm at no additional cost to you. These services are paid for by your tuition and fees.

But this is by no means an all-purpose good idea. When you create a virtual machine in a cloud service, you have even less privacy than you do on your own computer. The work you do can be lost if the service unexpectedly stops, or you can be priced out if and when the provider changes their pricing or conditions of use. Further, if you're not able to use a university-sponsored account, these services charge monthly or by the minute/hour of use, and in the long run this can get expensive.

Virtual machines are good for creating a computing environment you can use for a specific set of projects, projects that you are consistently backing up (i.e. via github or similar), and that you do not need to maintain for a long period of time.

For the COLRC-V2 team

To get access to your own VM for use on the COLRC:

  1. go to Access-CI and creates a login using CI and UANetID
  2. let Amy and John know and we will add you as a user on our allocation.
  3. go to JetStream2 and find your machine. You'll click through to our allocation (named HUM230002) and look for the instance called colrc-[yourname]

Your machine, for the COLRC-v2

If you create your own machine for our project, here are the specs Amy used, I know these work.

  • Debian 11 (we use Ubuntu in our collective VMs, it's fine too)
  • at least 2 vcpus, 8 GiB memory

Install or configure prereqs

Once you've spun up your machine, you can build our dev environment following the steps in our github repo. If you want to use VS Code on your VM, follow these instructions to set things up. You'll need your VM's IP address and ssh access to your VM.

In order for the dev environment to run properly, you'll need to make a couple of changes to the frontend code.

  1. look for Frontend/App.js at the root There are two clients configured after the import statements. Each client needs a uri. Replace the uri stem (i.e. localhost) with the IP address of your vm. Keep the ports (:8080 and :4000). Then build and up as usual.

  2. Once the system is up, go to http.[yourIP]:8080/console in a browser (contact Amy or John for the pwd if you need it). Go to the tables view. On each of these four tables: audiofiles, textfiles, textimages, elicitationfiles, under modify, you'll find a computed field. Edit the computed field - which is an SQL statement that tells the machine where it can find our pdf, png, wav and mp3 files. In the SQL statement is a URL path. Change the stem of that path (which is probably localhost) to yourmachineURL:80. Then click the button to execute the SQL.

At this point, your development environment should be working! You do not have to down/up the machine after this step, it'll persist at least until you do a new gitpull that includes a modified database.

Then, have fun!