Computing resources at IGPP

There are a few good computing resources here at IGPP that I wanted to make sure other students were aware of. Not everyone likes sleuthing and reading documentation as much as I do, so I think a lot of the resources here might go unnoticed. You can find a more complete guide to the computing resources here.

The Barnyard Cluster

There are six machines in the Barnyard running macOS (see the hostnames here). You can ssh to any of them using your AD credentials as long as you are on the UCSD network (or VPN). You can also ssh to the host igppgateway.ucsd.edu, which is just an alias for one of those machines.

You can use these machines in any way you like, but there are two key things to know. In your home directory, there are two special directories: Public and Sites. The Public folder is for file sharing— any files you put in here will be available on the web at https://igpppublic.ucsd.edu/~username where username is your short login name. The Sites folder is for hosting web pages (like this one). Your website will be at https://igppweb.ucsd.edu/~username.

Maybe this is news to you and maybe not. Now I will show you how to make a website and push it to the server.

A very basic website

There are a lot of popular tools for designing simple webpages. I use the ruby “gem” (a gem in ruby is just a package) Jekyll. An important point that might not be obvious: you will design the website on your local machine and then push (or copy or sync whatever) the built site files to the server.

Successful installation can be kind of tedious, and it might do more harm than good for me to explain things here, so if I’m not being clear then check out the official installation guide for macOS. Basically, the setup depends on your OS: if you’re using Catalina or newer, follow option A; if you’re using an older OS, follow option B. In either case, you should first install xcode command line tools:

$ xcode-select --install

Setup A: Catalina or newer

First, run the following command to add a line to your shell config file (replace .zshrc with whatever is relevant)

$ echo "export SDKROOT=$(xcrun --show-sdk-path)" >> ~/.zshrc

You will need ruby 2.5 or greater, and you can check this with $ ruby -v. macOS Catalina and newer ship with a suitable version, so you don’t need to do anything else to install ruby and you can move on to installing jekyll.

Setup B: Mojave or older

You will need to install a version of ruby separate from the system version (/usr/bin/ruby). An easy way to do this is with homebrew. Assuming you already have homebrew installed:

$ brew install ruby

This will install an up-to-date version of ruby (probably 3.0.X). Homebrew installs the ruby executable in /usr/local/opt/ruby/bin, so you will need to prepend this to $PATH such that it supersedes the /usr/bin/ruby executable.

$ echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

Again, replacing the config file if necessary. Restart the terminal app or run $ exec zsh (or bash, etc.) for this change to take effect. Confirm this is the default ruby:

$ which ruby
/usr/local/opt/ruby/bin/ruby # you should get this

This should be enough for you to move on.

Installing jekyll

With ruby installed, you will need to install the packages or “gems”:

$ gem install --user-install bundler jekyll

this will get the Jekyll gem and everything else you need (probably). The --user-install flag just installs the gems locally rather than globally so you don’t need root access to install. At this point you will want to add the install location to your $PATH variable:

$ echo 'export PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"' >> ~/.zshrc

where X.X is whatever version of ruby you have installed. If you’re not using zsh, then append to the equivalent dotfile. You will also want to run the following:

$ echo 'export GEM_HOME="$HOME/.gem/ruby/X.X.0"' >> ~/.zshrc

Again, replacing .zshrc with whatever is appropriate. For these changes to take effect, restart your terminal or run $ exec zsh (or whatever your shell is).

Init

To make a directory for your site and to initialize it as a jekyll site:

$ jekyll new dir-name

where dir-name is the name of the directory. Once this completes, you can cd into this directory and you will see some new stuff. You will want to edit some values in the _config.yml file:

baseurl: "/~username"
url: "https://igppweb.ucsd.edu"

These two values will work for an igppweb site. There are other values in the _config.yml file you will want to change from the defaults and those should be obvious.

To “test” your site and see what it looks like, you can start a local server like this:

$ bundle exec jekyll serve

Once the server is running, you can go to localhost:4000/~username in a web browser and you will see your site. You can keep this server running as you edit the contents of your web site. To kill the server, hit ctrl-c in its parent terminal.

If the server is not running, make sure you are the owner of the directory. jekyll new dir-name may have asked to be run as root, so you will need to $ sudo chown -R $(whoami) dir-name to fix this.

If you are using ruby 3.0 or higher, this will fail because the webrick gem is missing. Fix this with $ bundle add webrick in your project directory.

Pushing

You will see that when you ran the server, a new directory called _site was created. This directory has the contents of the “built” site. When you are ready to host your site on igppweb, you should rebuild your site with the following command:

$ JEKYLL_ENV=production bundle exec jekyll build

This will update the contents of the _site directory. Now, you have to copy those files to your ~/Sites directory on igppgateway. I like to do this with the rsync utility:

$ rsync -avzh _site/* username@igppgateway.ucsd.edu:~/Sites/.

Put these two commands in a shell script. You might also want to set up public key authentication so you can push your site contents to the server without entering your password every time.

For more on jekyll, you will want to consult the docs. And feel free to reach out to me if you are having any issues.

2021

Computing resources at IGPP

There are a few good computing resources here at IGPP that I wanted to make sure other students were aware of. Not everyone likes sleuthing and reading docum...

IGPP Computing short course

There used to be a course called Intro to Computing at IGPP that geophysics students could take during their first year. The goals of the course were to teac...

Back to Top ↑