WSO web development
WSO's web site is a work in progress. If you're impatient about the new facebook, or you know web design or Ruby, or if you just want to see how it's done, you're welcome to check out a copy of the code and go to work. This page will tell you how to get started.
SSH to WSO
If you don't have a WSO account, email root at wso. One of them will hook you up. A WSO account is not your 06abc account. It is the first letter of your first name followed by seven letters of your last name. Once you have an account, go ahead and log in:
Windows: get yourself a copy of Putty. wso.williams.edu is the host.
Mac/Linux: Open up a Terminal or a console, and type
where username is your WSO username (remember, not your 06abc OIT id).
Check out the code
Once you've logged in with SSH, you're ready to check out your very own copy of the WSO code. In your home directory, or wherever you'd like to keep your copy of the WSO site, run the following command to use Subversion to check out the code. (Don't forget the dot at the end!) This will spew a whole log of output onto your screen, listing all the files it's checking out. You can replace "wso-devel" with whatever name you want for your local copy of the code.
svn co file:///var/svn/wso wso-devel
Now change directory into the code directory:
We need to create a log file for your site so it doesn't complain directly to you.
Now your site is ready to run! If you just want to poke around you can do that without starting the server (check out How to transfer files to WSO), but if you want to make changes and see what happens, keep reading.
Start the server
But first you need your own personal port to run it on. Find this by running the following command. You'll want to save the output of this for future reference.
expr 50000 + $UID
To start the server run the following command in the wso-devel directory, replacing your_port with the number we generated above.
ruby script/server -p your_port
If you see something like the following, then you're in business.
=> Booting WEBrick... => Rails application started on http://0.0.0.0:3001 => Ctrl-C to shutdown server; call with --help for options [2006-11-29 21:15:31] INFO WEBrick 1.3.1 [2006-11-29 21:15:31] INFO ruby 1.8.5 (2006-08-25) [powerpc-darwin8.8.0] [2006-11-29 21:15:32] INFO WEBrick::HTTPServer#start: pid=9210 port=3001
Before breaking out the champagne, we need to check to see that the server actually works. Unfortunately, you can't just pop open a web browser and surf to your new site. WSO's servers are behind a firewall. The firewall only allows connections on certain ports. Yours is not one of them.
Setting up port forwarding
The way through the firewall is to pretend that the web server is running on your computer and not on WSO. We'll use a technology called port forwarding to send web requests to your machine through an SSH connection to your server on WSO. This is, simply, awesome.
And not too hard.
Open up a Terminal on your own machine, and type
ssh -N -p 22 -f -2 -L 8000/127.0.0.1/your_port firstname.lastname@example.org
EXCEPT instead of your_port, put the port number that you wrote down, and instead of "username", type your WSO account name. Unfortunately, you'll have to run this command somewhat frequently, since SSH connections close when your computer reboots or goes to sleep (or WSO crashes, or whatever...). To make this a little less tedious, open the file called .bashrc in your home directory on your own machine and add this line:
alias wso8000='ssh -N -p 22 -f -2 -L 8000/127.0.0.1/your_port email@example.com'
Again, make the substitutions for your_port and username. Close the Terminal window and open a new one. Now, if you need to establish the connection, just type "wso8000" in a terminal window. You can pick a different alias, of course.
Putty lets you do port forwarding, too. You can read more about it here:
Here are the settings you'll need:
Source port: 8000 Destination port: (your special port) Destination host: localhost
Try out the server
Open up a browser and go to http://localhost:8000/
Of course, if it doesn't work, please describe your problem on Talk:How to hack on the WSO site.
Now, you can change a file in wso-devel, and the change will show up on your development server at this address the next time you reload the page in your browser. Sweet.
Nice work getting this far. So now you actually want to do something with the code. For now, come to a WSO meeting Thursdays at 10:30pm in the vicinity of TCL 217a, or email firstname.lastname@example.org with questions/interest. Currently, our big project is the new facebook.
It's a good idea to run an update every so often so that your local working copy picks up changes that other people have made. Change directory into your wso-devel directory and run
Email root at wso if you'd like to change the WSO site, add a new service, or fix a bug. If you get the go-ahead, you're in good shape, so go to work. Once you think your change is ready for the world, you'll need to get permission to commit changes to our code repository, where it will be tested and deployed. Email root at wso about that. They'll take care of you.
- Pictures still don't show in WSO devel servers, at least on the front page.