Requirements:
- Node
- PuTTy
- VMWare Workstation Pro
-
Make sure VMWare Workstation is added to path (i.e.
$env:Path += ";C:\Program Files (x86)\VMware\VMware Workstation\"
) -
In any directory, create a directory called
certs
.
mkdir certs
cd certs
- In a different environment, preferrably linux & WSL, create then navigate to a folder also called "certs", and generate a new certificate and key:
openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout vmaware-key.pem -out vmware-crt.pem -days 365
-
Using WSL, open the location of your cert and key by typing
explorer.exe .
, then copy the contents of the certs folder over to the certs folder of the windows computer. -
You will not need WSL for the rest of the setup. Navigate to the certs folder. Then issue the command
vmrest -C
and create a secure username and password. -
Start the VMWare API locally with the following command:
vmrest -c .\vmware-crt.pem -k .\vmware-key.pem
- Once the server is live, you can access the api in the browser from https://localhost:8697 or https://:8697
-
In a command prompt type
ipconfig /all
and note the preferred ip address of "Ethernet adapter VMware Network Adapter VMnet1". -
Launch VMWare, then start the TutorVServer. Edit a new file called
update.sh
in the user directory. Save the following text into the bash script:
#!/bin/bash
remote_password="<umb unix server password>"
remote_user="<umb unix server username>"
remote_host="users.cs.umb.edu"
remote_file="<the filename of the file you want to track>"
remote_path="<the path of the file you want to track (i.e. 'cs341/mp2/part2+3/')>${remote_file}"
scp "${remote_user}@${remote_host}:${remote_path}" .
curl http://<ip address from step 8>:3000/restart-tutor
mtip -f "${remote_file}"
- Make sure you make update.sh executable with the command "chmod +x update.sh"
- SSH into your umb unix server account and create a .ssh folder in your user's home folder and cd into it then generate an rsa key with the following command:
ssh-keygen -t rsa -b 4096
- In your tutorvserver, navigate to your home directory and issue the following command to copy the linux server's rsa credentials:
ssh-copy-id @users.cs.umb.edu
- Go to the vmware api and copy the curl request (GET /vms) under the section "VM Management".
i.e.curl 'https://127.0.0.1:8697/api/vms' -X GET --header 'Accept: application/vnd.vmware.vmw.rest-v1+json' --header 'Authorization: Basic <your encrypted credentials>'
- When you enter this into your command prompt or click "try it out" under the endpoint on the api site, you should receive a json that looks like this:
[
{
"id": "I6PUP82K64OC1U6LP5SIBDFL04A35MK7",
"path": "C:\\Users\\Blake\\Documents\\Virtual Machines\\TutorVServer\\TutorVServer.vmx"
},
{
"id": "3BLLN5HVLJEU3QUNOJMEMB30MHC28CFL",
"path": "C:\\Users\\Blake\\Documents\\Virtual Machines\\Tutor\\Tutor.vmx"
}
]
-
Note the corresponding id of the
Tutor.vmx
. In the git repo local directory, edit the template.env
file with your virtual machine's login credentials and the id noted. -
Over on your local computer, in a new command window, navigate to the contents of the git repo and start the node server. You should see
Listening on port 3000
in the console output.
cd <path of repo>
node app.js
- Once both the VMWare API server and the Node servers are running, you should be able to restart your tutor vm remotely by going to
https://localhost:3000/ssh
in the web browser. Confirm this before proceeding with the steps.
- In a command prompt window, create a temporary localhost tunnel by issuing the following command and noting the outputted url
NOTE: I plan on making a server that periodically refreshes the url and uploads it to the umb cs unix server but for now you will have to issue this command manually periodically.
ssh -R 80:localhost:3000 nokey@localhost.run
- Go to the UMB CS Unix server. Name a bash script called
upload.sh
and enter the following text into its contents:
#!/bin/bash
make A=$1
curl <tunnelled localhost url>/ssh
- Make upload.sh executable with "chmod +x upload.sh"