[[Category:How-To]] [[Category:Computers]]
[http://wso.williams.edu WSO's web site] is a work in progress. If you're impatient about the new facebook, or you know web design or PerlRuby, 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 [http://root at wso.williams.edu/facebook/view?unix=07mg_2 Mike], [http://wso.williams.edu/facebook/view?unix=07jmc Jessica], or [http://wso.williams.edu/facebook/view?unix=08bpw Ben]. 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 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Putty]. wso.williams.edu is the host.
'''Mac/Linux''': Open up a Terminal or a console, and type
ssh username@wso.williams.edu
==Set up a web server==where username is your WSO username (remember, not your 06abc OIT id).
This part sounds scary, but most of ==Check out the configuration has been done for you already. First we copy the server files into your home directory:code==
cp 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, create a directory called wso-R /var/web devel (or anything you'd like) and move into it with the following commands.
Now we just change the configuration files to work for your personal account. Change directory into your new "web" directory: mkdir wso-devel
cd webwso-devel
NextNow, type these instructions EXACTLY. Note run the back-ticks in following command to use Subversion to check out the second commandcode. ( ` Don't forget the dot at the end!). The back-tick is on the key right above tab on This will spew a whole log of output onto your screen, listing all the keyboardfiles it's checking out.
sed -i .bak "ssvn co file:/USER/$USER/g" apachevar/*.conf apache/apache_test apachectl sed -i .bak "s/UID/`expr 50000 + $UID`/g" apache/*.conf rm apachesvn/*wso .bak
So the mysterious second command will tell the web server what port We need to listen on. Programs listen on different ports create a log file for your site so that when it doesn't complain directly to you make a network request of WSO (SSH, the web, e-mail), it knows which program should handle the request. Your server will listen on Run the port number 50000 plus your user id. (That makes sure everyone has a unique portfollowing command.) To find out what that is, type
expr 50000 + $UIDtouch log/development.log
''Write Now your site is ready to run! If you just want to poke around you can do that number down for laterwithout starting the server (check out [[How to transfer files to WSO]]), but if you want to make changes and see what happens, keep reading.''
==Get Start the codeserver==
LetBut first you need your own personal port to run it on. Find this by running the following command. You's get a fresh copy ll want to same the output of the codethis for future reference. On WSO, type
svn co file:///var/svn/wsonet ~/web/wsonet svn co file:///var/svn/wsorails ~/web/wsorails If you just want to see what the code is like, you can poke around those two folders. "wsonet" contains the part of the site written in Perl. "wsorails" contains the part of the site written in Ruby. Most of the site is currently in Perl, but new services will be in the wsorails folder. For those of you afraid of the command line, you can now look at the files by logging into WSO over SFTP. Check out the bit on SFTP at [[How to transfer files to WSO]]. Of course, to actually work on the code, you'll want to know what effects your changes have. That's why we want toexpr 50000 + $UID
==Start To start the server==run the following command, replacing your_port with the number we generated above.
OK, we're ready to start the web /opt/local/bin/ruby script/server. Type this:-p your_port
~/web/apachectl startIf you see something like the following, then you're in business.
If everything went well, it'll say "httpd => Booting WEBrick... => Rails application started", or something on http://0.0.0.0:3001 => Ctrl-C to that effectshutdown 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. Hooray!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.
===Mac/Linux===
Open up a Terminalon your own machine, and type
ssh -N -p 22 -f -2 -L 8000/127.0.0.1/53717 emilleryour_port username@wso.williams.edu
EXCEPT instead of 53717your_port, put the port number that you wrote down, and instead of "emillerusername", 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/53717 emilleryour_port username@wso.williams.edu'
Again, make the substitutions for your own port 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.
===Windows===
==Try out the server==
'''On-campus''': Open up a web browser and point it go to "http://localhost.williams.edu:8000/". The WSO site should show up. Congratulations!
'''Off-campus'''The new facebook will be at http: On a Mac or Linux box, add this line to the file /etc/hostslocalhost:8000/facebook and organizations at http://localhost:8000/organizations
127.0.0.1 localhost.williams.edu
That makes your machine think its address is localhost.williams.eduOf course, which is necessary for cookies to if it doesn't work the way , please describe your server is configured. Now point your web browser problem on [[Talk:How to http://localhost.williams.edu:8000/, and check it outhack 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.
==Making changes==
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 wso-staff@wso.williams.edu 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
svn update
Of course, if it doesn't work, please describe your problem on [[Talk:How to hack on the WSO site]].
Now, Email root at wso if you can 'd like to change the WSO site, add a file new service, or fix a bug. If you get the go-ahead, you're in ~/web/wsonet/sitegood shape, and so go to work. Once you think your change is ready for the change world, you'll need to get permission to commit changes to our code repository, where it will show up on your development server be tested and deployed. Email root at this addresswso about that. SweetThey'll take care of you.
==Making changes==
Nice work getting this far. So now you actually want to ''do'' something with the code. Check out [[How to write a web service on WSO]]; it'll give you a nice overview of how things work, and also point you to references where you can learn Perl and HTML.== To Do ==
Contact [http://wso.williams.edu/facebook/view?unix=07mg_2 Mike], [http://wso.williams.edu/facebook/view?unix=07jmc Jessica], or [http://wso.williams.edu/facebook/view?unix=08bpw Ben] if you* Pictures still don'd like to change the t show in WSO site, add a new service, or fix a bug. If they give you the go-ahead, you're in good shapedevel servers, so go to work. Once you think your change is ready for at least on the world, you'll need to get permission to commit changes to our code repository, where it will be tested and deployed. Email [http://wso.williams.edu/facebook/view?unix=07mg_2 Mike], [http://wso.williams.edu/facebook/view?unix=07jmc Jessica], or [http://wso.williams.edu/facebook/view?unix=08bpw Ben] about that. They'll take care of youfront page.