Skip to content

SFU CS Server Install

Paul Hibbitts edited this page Feb 24, 2021 · 21 revisions

These directions will guide you through setting up Grav Skeleton Open Matter Course Hub on /cs/websites/opencoursehub.cs.sfu.ca/
Grav Open Course Hub Skeleton created by Paul Hibbitts, directions written by Brian Fraser.

Please remember that since no student data is stored on the Grav Open Course Hub itself, it can be installed on any Webserver running at least PHP 7.3.6.

SSH Access to Server

Connect to SFU CS's linux server:
$ ssh yourSfuId@linux.cs.sfu.ca
Create a folder for yourself
$ cd /cs/websites/opencoursehub.cs.sfu.ca/
$ mkdir yourSfuId (change yourSfuId to your actual SFU ID)
$ cd yourSfuId

Grav Open Course Hub Releases

Find your preferred Grav Open Matter Course Hub template option from Grav Open Course Hub releases. For more information, see the Grav Open Course Hub documentation.

For a simple single course install, the grav-skeleton-open-matter-course-hub-site.zip is suggested, while for either multiple terms and/or courses the grav-skeleton-open-matter-multicourse-hub-site.zip is suggested. Brian's choice (2020) is grav-skeleton-open-matter-multicourse-hub-site.zip

Grav Site template

Verify you are in the desired folder (i.e. /cs/websites/opencoursehub.cs.sfu.ca/yourSfuId) and then download the Grav skeleton of your choice. For example, it might look like:
$ wget https://github.com/hibbitts-design/grav-skeleton-course-hub/releases/latest/download/grav-skeleton-open-matter-course-hub-site.zip for a single course site or $ wget https://github.com/hibbitts-design/grav-skeleton-course-hub/releases/latest/download/grav-skeleton-open-matter-multicourse-hub-site.zip for a multicourse site

Extract Paul template's ZIP (may need to use sudo for each command if doing this on a home machine). Change grav to another name if you prefer. $ unzip grav-skeleton-open-matter-multicourse-hub-site.zip
$ mv grav-skeleton-open-matter-multicourse-hub-site grav
$ chmod -R 777 grav

View your website
https://opencoursehub.cs.sfu.ca/yourSfuId/grav/ (change yourSfuId to your actual SFU ID) If you are getting a blank page then double check the chmod command

CS Server

To browse to the server, use the URL:
https://opencoursehub.cs.sfu.ca/yourSfuId/grav/ (change yourSfuId to your actual SFU ID)

To access the admin panel, use the URL:
https://opencoursehub.cs.sfu.ca/yourSfuId/grav/admin/ (change yourSfuId to your actual SFU ID)

Admin and Sync Plugin Setup for SFU GitLab

The content of your website can be pulled automatically from a GitLab repo.

  1. Create GitLab repo with an initial commit (for example, chose the Initialize repository with a README option when creating repo)
  2. Access the admin panel, use the URL: https://opencoursehub.cs.sfu.ca/yourSfuId/grav/admin/ (change yourSfuId to your actual SFU ID)
  3. Set a new user name and password for yourself. Don't use your SFU password.
  4. In the Grav admin panel, browse to Plugins --> Git Sync
  5. Configure with:
    • Hosting Service: Other
    • Git User: yourSfuId (change yourSfuId to your actual SFU ID)
    • Git Password or Token:
      • Go to your GitLab repository
      • Go to Settings --> Access Tokens
      • Name it, such as "Grav Website Access Token"
      • Check the scopes "API" button
      • Create the project access token and copy to Grav Git Password or Token field
    • Git Repository:
  6. In GitLab, setup a webhook to notify Grav on repo changes
    • Setup in GitLab at
      https://csil-git1.cs.surrey.sfu.ca/yourUserId/yourRepo/settings/hooks (change yourSfuId to your actual SFU ID)
    • Integration URL:
      https://opencoursehub.cs.sfu.ca/yourUserId/grav/_git-sync-xxxxxxxxxxxxxxxxxxxx
      (copy the actual URL from the Grav Git Sync Plugin page)
    • Secret Token: copy "Web Hook Secret" from grav git plugin page
    • Trigger: Select "Push Events" and "Enable SSL verification"
  7. In Grav Admin's Git Plugin page, setup folders to Sync: just Pages is recommended to begin with.

Creating a locked solutions folder (Optional)

If you want to use SFU's authentication to lock access to some course solutions (via .htaccess files), you can create a sym-link to a folder which will be served by Apache instead of Grav. Grav is unable to connect to SFU's authentication; however, we can link a solutions/ folder in with our Grav setup (change yourSfuId):

$ ssh linux.cs.sfu.ca
$ cd /cs/websites/opencoursehub.cs.sfu.ca/yourSfuId  
$ mkdir grav/user/solutions
$ touch grav/user/solutions/placeholder.txt
$ chmod -R 777 grav/user/solutions/
$ ln -s grav/user/solutions solutions

Now, from your website, you can use an HTML link to link to the solutions page. Note that standard markdown links won't work, so you'll need something like:
<a href="../../solutions/placeholder.txt">Solutions folder</a>

If you are hosting multiple courses, I suggest creating folders for each class in the solutions/ folder, such as for CMPT 101:
$ mkdir grav/user/solutions/101

To lock a folder to only registered users in the course, place the following in a .htaccess file in that folder, such as in grav/user/solutions/101/.htaccess

AuthType CAS

# Allow view folder listing
Options +Indexes

<Files *>
#---- this line allows students/TAs
#  COMMENT OUT when maillists flip to next semester
require cas-attribute member:cmpt-433
require cas-attribute member:cmpt-433-help

require user yourSfuId                         # Change yourSfuId to your actual SFU ID
require local                                  # Access to home repo (local user)
require cas-attribute member:cmpt-cas-operator # CSIL Admin
</Files>
```e to the grav-skeleton-course-hub wiki!