Homework 12: Running Your GPA Server on a Virtual Machine
For this homework, you will deploy your “MP5: GPA Calculator” onto a virtual machine!
Step 0: Connecting to your VM
An course virtual machine has been provided for you via Compass 2g (see the “VM Hostname” in the gradebook). It has been configured to allow to login using your NetID and password. Note that you can only connect to this machine via an on-campus connection. There are many ways to get an on-campus connection:
- If you are on-campus or in a dorm, you’re all set!
- If you are off-campus, you can use the University of Illinois VPN software to be “virtually” on-campus.
Once you’re connected, you will want to use an SSH client (ex:
ssh on OS X or
PuTTY on Windows) to connect to your virtual machine.
Step 1: Installing Python 3.9 on your VM
Your VM comes pre-installed with Python 3.5.1. This version of Python is quite old and does not support modern features that we’d like to use. To install a modern version of Python, Python 3.9, we can fetch it from a pre-compiled repository with the following four commands:
# Install python3.10: sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.9 python3.9-venv # Update pip: curl https://bootstrap.pypa.io/get-pip.py | sudo python3.9
Since we’re installing a specific version of Python, your VM will default to using
python3.9 as the name of the Python binary. Therefore, instead of running
python3.9 followed by your commands.
Step 2: Running your
python3.9, clone your CS 240 repository onto your virtual machine to get your copy of mp5. Once you have your MP5:
- Go into your
- Install the python dependencies using
pip install -r requirements.txt(this is the same command you used in your
Step 3: Run your services as a background task
Finally, you need to launch both the
courses-microservice and your MP5 service as background tasks. From working with
Dockerfile, you can run them in tba background by adding an
& at the end of the command.
Once both services are running, you should be able to connect to your microservice from any machine with the UIUC network (or via a VPN connection). You should leave your service running until (at least) Thursday morning so Natalia or I can connect to it! :)