WebWork

Recently the college decided to implement a piece of software that allows professors to assign students math homework via the web.  Professors can pick a bunch of math problems from a library of math problems, students do the work, and they are given grades.  Fairly simple really.

The install process wasn’t so easy.  To be fair there are instructions for installing WebWork on Ubuntu 10.04 but if you deviate from the instructions you have to start all over again.  I learned that when I tried to install it in the /var/www directory rather than the /opt directory it asks for.  Luckily a friend had warned me, so I only made that mistake once.

We’ve made the decision to migrate from the MAA (which hosts WebWork if you have under 100 users) to our own installation.  Unfortunately, we’re doing it this week and I just got the archives of the courses last week, so I’m in a mad dash to figure out how to do all of this.  And of course, in true Rosalyn format, I’m going to write a blog post on the topic.  Hopefully these instructions will come in handy this summer as I move the rest of the courses to the WebWork server and figure out LDAP authentication for the system.  So here it goes, I know how much you all love this:

 

1) Determine what Archives I need to Migrate

So when I requested the archives from the folks at MAA they sent all of our courses, even older ones.  But nothing in the course name indicated what semester these archives were from.  So I needed to figure it out on my own.  After extracting one course, I noticed there was a log directory with two files, one that talked about when people submitted answers and one that showed the last time users logged in.  Beautiful.  I decided to go with the answers log, since I felt that would be a more accurate portrayal of when the course was from.  I extracted each one separately and just took a peek at the last entry.

tar -xvf {tarball.tar.gz} {path/to/file}

Turns out there were only three current courses that needed to be migrated.  And then luckily one professor said they would continue using the MAA server until the end of the semester (and option we offered them).  Yay.  Less work for me.

 

2) Import the Course

So the first step is to move the archives to the server.  Now in order to unarchive the course, they need to be in the /opt/webwork/courses folder.  I sftped the files to my server, and then went into the admin interface and clicked unarchive course and followed the prompts.

 

WebWork Unarchive Course

WebWork Unarchive Course

When all was said and done I couldn’t log into the course.  This was the moment that everything that I thought was slightly off about the software came to make sense.

 

3) Change the Admin Password

So each course gets their own tables in the webwork database:

  • coursename_key
  • coursename_password
  • coursename_permission
  • coursename_problem
  • coursename_problem_user
  • coursename_set
  • coursename_set_locations
  • coursename_set_locations_user
  • coursename_set_user
  • coursename_setting
  • coursename_user

No you’re reading that right.  There isn’t a global table for users and passwords, there are user and password tables for each course.  I know, I know…my normal form loving brain hurts thinking about it too.  But I guess it makes it easier to maintain each course??? (I’m really trying to be an optimist)

Since I don’t know the password for the admin user I realized I needed to change the password if I wanted to be able to get into the imported courses.  So I went into the database on my server and ran a select query so I could find the hashed up password of an account where I knew the actual password.

select * from coursename_password;

For some added annoyance WebWork can use spaces and other characters that you wouldn’t normally include in a MySQL table name.  I have actually never run across this before so I wasn’t sure what to do.  I tried containing the table names in single quotes and double quotes.  Turns out you need to use the accent mark located below the tilde on your keyboard.  Yay for trial and error.

So once I got the hashed up password of an account I knew the password for, I updated the table for the newly imported course in WebWork:

update `coursename_password`
set password = "<newhashedpasswordhere>" where user_id = "admin";

Once you’ve done that you should be able to log in to the course as the admin user.

Posted in Work | Tagged , | Leave a comment

Installing Munin on Ubuntu 10.04

So since I’ve “gone rogue” and started hosting servers with Slicehost, that means that I’m also responsible for monitoring the servers.  So I tried installing Munin on Ubuntu 10.04 using apt-get.  I found a bunch of instructions and they were all complicated and well plain crap.  I tried the Munin instructions but those didn’t seem to work either.  Eventually after a bunch of tries, I figured it out and feel pretty stupid that I went through so much for something so simple.  And since I can often forget these things months later, I decided to write them down here for my own personal enjoyment (if that’s what you want to call it).

1) install apache

in order to view the reports that munin installs you’ll need to install a web server.  i, like most of the universe, use apache, so that’s what i’m going to do here.

sudo apt-get install apache2

this will install apache2 and start it up for you.  when you’re done go to the server and you’ll see this page:

Apache Default Page

The apache default page after a simple install.

fairly simple really.  nothing major and there are tons of instructions all over the interwebs that can get you to this point.

2) install postfix

you’ll also need to install a mail server if you want Munin to email you when things go into warning mode and what not.

sudo apt-get install postfix bsd-mailx

this will install postfix and the mail command (so you can test to make sure postfix is working).  as you’re installing postfix you’ll be asked to set up postfix.  first you’ll be asked to choose the mail server configuration.

 

Postfix Server Configuration

The prompts for installing postfix on Ubuntu 10.04

choose internet site which will allow you to send outgoing mail from your server.  on the next screen insert the server’s web address if it is not already filled in.  if you screw up you can reconfigure postfix with the following command

sudo dpkg-reconfigure postfix

once you’ve got that set up you’ll want to test to see if you can send email to an outside email address.  you can do this by typing the following:

mail your@emailaddress.com
Subject:  your subject here
body of the email here
.

the period will end the email and send it on its way.  before doing this i usually tail the mail.log located in /var/log and watch the email get sent on its way.  watch out because it may end up in your spam folder rather than your inbox (just an fyi).

3) install munin munin-node

next you’ll want to install munin, which does the monitoring, and munin-node, which goes on any server that you want monitored.  you can do this again with apt-get

sudo apt-get install munin munin-node

3.1) email notification

if you would like to have munin notify you when something moves from OK to another state (or back again) you’ll want to set up email notifications.  you’ll need to do this by editting the /etc/munin/munin.conf file.

vi /etc/munin/munin.conf

and insert the following lines according to the instructions in the comments

# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm

contact.yourname.command mail -s "Munin notification" your@email.com

when you’re done you’ll want to start the munin-node and restart apache (just to be safe) by running the following commands

sudo start munin-node
sudo apache2ctl graceful

when you’re done go to the web address of the server and you’ll see this:

Munin After Initial Install

After the initial install of Munin you'll see the Forbidden error.

so I saw that and assumed, oh its clearly a permissions error.  maybe the munin user that got created on install doesn’t have access to the web server.  yeah no, i was wrong.

4) edit /etc/munin/apache.conf

so with a fresh install of munin you can only access the information from the server that does the monitoring.  so you’ll want to go in and edit the apache.conf file:

sudo vi /etc/munin/apache.conf

and change the following line:

Allow from 127.0.0.1 ::1

into:

Allow from all

you can of course allow it from only particular ip addresses, or you can set up an .htpasswd file so that the directory is locked down.  however you want to do it is up to you, but you probably shouldn’t be pushing this info out the world.  in either case when you’re done you’ll want to restart apache.

sudo apache2ctl graceful

When all is said and done you’ll see this:

 

Munin Monitoring
Munin up and running on Ubuntu 10.04

and then of course you can click on your server and look at all the pretty charts and graphs.

Posted in Work | Tagged , , | 1 Comment

Slicehost, My New Best Friend

Over the past few months I’ve been working on a number of small projects.  First I’ve been working to set up an academic blog service for the campus.  The service will be used for class projects and faculty projects.  Another system I’ve been working on is something called WebWork.  The system allows faculty to pick math problems from a variety of different sets and then assign them to their students.  All the problem sets are done online including grading.  Apparently it integrates with Moodle, but that’s something that will have to wait for now.  The last thing I’ve been working on is a Drupal based website for a grant project that I’ve been involved in.

So what do these three things have in common?  Each one is being hosted with Slicehost.

Slicehost is virtual private hosting and a subsidiary of cloud computing provider Rackspace.  Essentially all of their servers are in Rackspace’s cloud.  Slicehost allows you to provision servers, schedule backups, create snapshots, clone servers, etc.  But rather than being charged per hour, you’re charged a flat monthly fee (which can go up if you go over your bandwidth allowance).

So just like any best friend there are things about it that I like and thinks about it I don’t like.  I like how easy it is to clone a server or create a back up.  So if I want to upgrade WordPress for example, rather than dumping the MySQL database, backing up the files and then upgrading, I can take a snapshot of the server and then upgrade knowing that I have an exact replica of the system.  I also like how easy it is to do development work.  If there is a bug fix or something that I want to try out, I can clone the server, work on the changes, and know that it’ll work on my production instance (because essentially I’m using my production instance).

I speak so glowingly of it, what criticisms could I have?  Well what would be great is if I could have the best of both worlds.  I wish that in addition to paying a flat monthly fee, I could have the option to provision for just a few hours.  Maybe I could log into Rackspace’s cloud, see my Slicehost servers and clone them there.  This would help me with handling data loss and working on smaller more urgent bug fixes.  Maybe I’ll get lucky, they’ll read this, and figure out how to make all my dreams come true.

Posted in Work | Tagged , , | Leave a comment