This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

12. Remote Servers

Working with remote servers

Most software that you use is a combination of a client software system and a server software system. “The cloud” is a generic term for a group of servers that do the same thing.

For example:

  • You use the TikTok app on your phone, which performs searches and recommends videos in the cloud.
  • You play a multiplayer game on your XBox, but a server controls people entering and leaving, tracking scores, and managing lag.
  • You have used pip to install Python libraries, but pip talks to a remote server to find the package and retrieve the bytes.

In the final weeks of SENG 201, we will connect to a remote server to host a network application. You will edit and deploy the application.

1 - Connecting to ada

Instructions for connecting to ada and installing a VPN for offsite work

We will use an on-premises (on-prem) server called Ada, named after Ada Lovelace, who wrote the first algorithm for the precursor to modern computers, Babbage’s Analytical Engine.

Offsite - use the VPN client

The ada server is accessible only from the UNCW network.

You will need to use UNCW’s Virtual Private Network (VPN) client software to reach the server while offsite.

  1. Install the VPN client software. You can only install the VPN client while offsite.
  2. Open the Cisco AnyConnect VPN program and connect to the pre-configured UNCW VPN.
  3. I recommend that you disconnect from the VPN when you don’t need it because it can slow your connection.

Connecting to ada via SSH

We will use the Secure Shell (SSH) program to connect to ada. SSH is an extremely popular software tool for creating client-server connections. SSH will connect you to ada’s Linux CLI, which will function like a WSL or MacOS Terminal.

SSH is pre-installed on MacOS, Ubuntu, and WSL. Open a Terminal and enter the following:

ssh <your-uncw-id>@ada.cis.uncw.edu  
# for example, ssh laymanl@ada.cis.uncw.edu

Enter your UNCW login password when prompted. Choose “yes” when prompted to trust the connected machine.

You should see something like the following after successfully signing in:

You are now logged into the ada server. ada is running Ubuntu Linux, and understands all the standard Linux CLI commands.

There are many commands at your disposal, including python and git.

Type pwd to see your home directory location.

Rules for using ada

ada is a shared server. As such:

  • Do not read, write, or edit files outside your home directory.
  • Do not change the permissions on your home directory using chmod or any other command.
  • Follow the Seahawk Respect Compact at all times.
  • Do not intentionally do anything to harm the server, such as fill up the hard disk or overload the CPU.

Activity on the server is logged. Any intentional or negligent violation of these rules will result in a grade of 0 for the course and a violation of the Student Code of Conduct reported to the Dean of Students.

When in doubt if you are allowed to do something, ask the instructor first.

Next

Once you are done, move onto the Working on ada lab.

2 - Working on ada

Instructions for connecting to ada and installing a VPN for offsite work

Class recording

The recording covers this lab and the previous lab on Server Setup as well as an introduction to Computer Networking concepts.

Part 1: Starting out

ada is running Ubuntu Linux, and understands all the standard Linux CLI commands. There are additional commands at your disposal, including python and git.

Make sure you are connected to ada using SSH. Type the following commands:

  • ll - what do you see?
  • mkdir dev
  • cd dev
  • pwd

Briefly summarize what you just did.

Part 2: Editing a file

When connected to a server like ada, you typically only interface through the CLI. In ada’s case, there is no window-like GUI.

Linux uses the ~ character as shorthand for your home folder, i.e., /home/<your_id>. So ~/dev is shorthand for /home/<your_id>/dev.

Make sure you are in your ~/dev folder. Do the following:

  • nano hello.py
  • a text editor called Nano will open in the Terminal looking like this:
    the pico text editor
  • type in print("Hello World!")
  • Hit CTRL+X to exit, then Y to save the changes.
  • You will see the ada Terminal again. Type ll and you should see the hello.py file.
  • Run python3 hello.py and you should see your “Hello World” message.

The Nano editor is quite handy for editing files on the server quickly. But, we are spoiled by the ease-of-use of IDEs like Visual Studio Code and PyCharm.

Editing a full-blown program with many different files using nano would be painful. In practice, software engineers don’t do much, if any, editing on servers. Instead, software engineers develop on their own machines and deploy their software programs to servers.

Deploying software to ada

Deployment is the act of making your software available for use. You could deploy your software to your own computer (you do this while testing). For other people to use your software, you need to make your computer accessible via a network and make sure the program is running all the time and ensure that your computer has enough resources to handle thousands of people using it all at once.

Hence, servers. Servers are network accessible and all they do (usually) is serve software programs that users can connect to.

So, how can you get a program to ada? You can use file transfer tools like scp, but we will use git.

Initializing Git and GitHub on ada

We need to authorize your account on ada to clone your remote repositories. Do the following:

  1. ssh onto ada.
  2. Run gh auth login. Accept the default options.
  3. The step Press Enter to open https://github.com/login/device in your browser... because ada doesn’t have a GUI.
    failure message when trying ot open a browser window on ada
  4. On your computer, open a browser to https://github.com/login/device and type in the 8-character code on ada’s terminal.
  5. In the browser, accept the authorization options:
    GitHub authorization screen
  6. You should see in the ada Terminal a “Logged in as ” message. You are done.
    ada terminal showing a successful completion

git clone a repository

You are now ready to use git on ada.

  1. git clone one of your existing remote repositories to your. You can use any of the ones from class or a homework assignment.
  2. Use python3 to run your code. Does it work?

Suppose you are actively developing that Python project. How would you deploy the changes to the server?

You would develop the program on your PC, then commit and push to GitHub. Then ssh to ada, pull the latest version, and restart the program!

Most software deployed in this manner relies on the main branch of the repository. Hence why it is critical that main contain only “good, clean, working code” – main is what users will see!

Next

We will put a program on ada that is accessible via the network so that other people can use it.

Try browsing to http://152.20.12.250:23456/, but the app may not be running.