Lab 4 — Web programming

Slides. Connecting to the cycle machines using SSH. Introduction to web programming with HTML, CSS, JavaScript, and PHP.

Uploading your website

To put your website on your people page—e.g., mine is https://people.eecs.ku.edu/~h054w684 and for yours, you will replace the h054w684 part of the URL with your first-initial last-initial ID—you will have to connect to the cycle servers with SSH, or get on a lab machine. See the slides for this lab for help with using SSH, and the slides for labs 2 and 3 for some terminal commands to help you navigate on the server.

Once you are logged onto the cycle server, under your home directory you should have a directory named public_html. All of the source code for your website must be placed in there to be visible at your URL. You will need to create a file named index.html in that directory, which will be the first HTML page that is displayed when you navigate to your URL. From there, you should link to the other practice pages you make for the lab.

To actually display your website, you will need to set up some permissions for the cycle server. Another one of the TAs has prepared a script to do this for you. On the cycle server, run the commands:

    $ wget people.eecs.ku.edu/~l367r860/grant_permission.sh
    $ bash grant_permission.sh
    

These will download a script and execute it, setting up all of the permissions the server needs to see your source code and display it on your page. If you navigate to your page, you should see the output of your index.html file in the browser if you have everything set up correctly.

Using GitHub to sync your code and your website

The lab submission wants you to provide a link to a GitHub repository with your website's source code, as well as a link to your people website. A good workflow for this assignment would be to develop your website on your local machine in a git repository that you push to GitHub, and to clone that repository on the cycle server in the public_html directory to keep your code synced up. For help with the first step of putting your code on GitHub, review the slides for lab 1.

For the step of cloning your repository on your lab machine after you have created it on GitHub, navigate into the public_html directory on the cycle server and run:

      $ git init -b main
      $ git remote add origin <YOUR REPOSITORY URL>
      $ git pull origin main
      $ git branch --set-upstream-to=origin/main main
    

This will pull in all of the files from your repository on GitHub. From there, whenever you do a push from your local machine and want to update your page, you can SSH onto the cycle server, navigate to public_html, and run $ git pull to pull your changes from GitHub.

Now you have git repositories on both your local machine and the cycle server, and you will be able to develop locally, push changes to GitHub, and later connect to the cycle machine to pull those changes to have them actually be reflected on your people page.