Skip to content

Latest commit

 

History

History
92 lines (62 loc) · 2.46 KB

server-setup.md

File metadata and controls

92 lines (62 loc) · 2.46 KB

Server Setup | notreda.me

Table of Contents

Overview

The only current server-side component of notreda.me is a cron job which scrapes the web to automatically update the Notre Dame schedule when it changes.

Currently, notreda.me does not have its own server and instead piggy-backs off of the existing web server for Six Degrees of Wikipedia.

Initial Setup

  1. Piggy-back off of the existing web server for Six Degrees of Wikipedia.

  2. Install, initialize, and authenticate to the gcloud CLI.

  3. Set the default region and zone for the gcloud CLI:

    $ gcloud config set compute/region us-central1
    $ gcloud config set compute/zone us-central1-c
    
  4. SSH into the machine:

    $ gcloud compute ssh sdow-web-server-# --project=sdow-prod
  5. Install nvm:

    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
    $ nvm install node
  6. Clone this directory via HTTPS as jwngr-ops and navigate into the repo:

    $ git clone https://[email protected]/jwngr/notreda.me.git
    $ cd notreda.me/
  7. Store the saved password so it does not need to be re-entered every git push:

    $ git config credential.helper store
  8. Attempt an empty git push to store the password.

    $ git push  # Enter password for jwngr-ops
  9. Add a .env file to the root of the repo to set environment variables:

    $ cp .env.example .env
    # Make sure to enable Sentry!
  10. Install the required npm dependencies:

    $ cd scripts/
    $ npm install
  11. Run crontab -e and add the following cron jobs to that file:

    # Run the ND schedule update script every 15 minutes.
    */15 * * * * cd /home/jwngr/notreda.me/scripts/ndSchedules && ./update.sh
    
    # Run the future ND schedules audit script every day at 6 AM.
    0 6 * * * cd /home/jwngr/notreda.me/scripts/ndSchedules && node auditFutureSchedules.js
    
  12. Install a mail service in order to read logs from cron jobs:

    $ sudo apt-get -yq install postfix
    # Choose "Local only" and use the default email address.

    Note: Cron job logs will be written to /var/mail/jwngr.