gRSShopper Setup Log

This is from another site (more shortly) but I'd like to share he especially for people interested is messing around with gRSShopper but not being able to get it to work. The steps below are actual steps I followed today, warts and all, to set up a new instance of gRSShopper on a clean computer. Perl modules requested had been installed for me (you can see the list below in this post).

1. Test SFTP access to web server - opened Filezilla client and tested SFTP connection to the website with the credentials provided to me. Test succeeded. Located web folders at /var/www/html and /var/www/cgi-bin

2. Test SSH access to web server - opened PuTTY and tested SSH connection to the server with the credentials provided (same as for SFTP). Test succeeded.Test SU with credential provided. Test succeeded.

3. Test mysql access with root password provided. (> mysql -p). Test succeeded.

4. Test Apache server by entering the URL or IP into a web browser. Test succeeded. Test location of web pages by creating a test index page ( in this case, in /var/www/html/index.htm ) using vi. Test succeeded. Changed owner and group to 'apache' and tested again. Test succeeded.

5. Create gRSShopper database on mysql.  > CREATE DATABASE database; 
    Give a user admin privileges: mysql> GRANT ALL PRIVILEGES ON database.* TO user@localhost IDENTIFIED BY 'password'; 

6. Gave my user access to apache group: >usermod -G wheel,apache myusername
and then changed owner and group for /var/www/html and /var/www/cgi-bin from 'root' to 'apache' 
then gave write access to apache to cgi-bin: >chmod 775 cgi-bin

7. Created a UMCourse 'databack' in GRSShopper from the Change 2011 course archive
Ran archive_cgi.sh on downes.ca - this creates an archive of the current version of gRSShopper (which includes the newly created data pack)
 (People who are not me would access the most recent code archive, which includes data packs, from http://sourceforge.net/projects/grsshopper/ or http://grsshopper.downes.ca/code/grsshopper_0.52.tar.gz )

8. Saved grsshopper_0.51.tar.gz from downes.ca and uploaded to UdeM site at /var/www/cgi-bin

9. Used PuTTY to extract the files: tar -zxvf grsshopper_0.51.tar.gz

10. Ran server test script: http://url/cgi-bin/server_test.cgi
This generated an error. Checked error log: > tail /var/log/httpd/error_log
Result was: Exec format error
Downloaded server_test.cgi to my local machine, opened it for editing, and moved the line
    #!/usr/bin/perl
to the very top of the file (even before the comments). Tried it again. This worked. (Went and fixed this in downes.ca so this problem never happens again). 

This script tests for required modules. It's kind of old and told me I was missing  XML::Feed, XML::Feed OPML, XML::LibXML and Net::OpenID::Consumer.

So I rewrote the server environment test to reflect current Perl module requirements (all models are loaded in grsshopper.ph load_modules() if you're interested). I uploaded to downes.ca and also the UdeM site, so in the fulture the server_test.pl script will work a lot better for people. 

I ran the new server_test.cgi script with the following happy results:

gRSShopper web server environment test.

Checking PERL version... OK
Checking for CGI. This module handles form input functions. OK
Checking for CGI::Carp. This module displays error messages. OK
Checking for DBI. This module handles database functions. OK
Checking for LWP. This module connects to other web servers. OK
Checking for LWP::UserAgent. This module emulates a web browser. OK
Checking for LWP::Simple. This module emulates a web browser. OK
Checking for File::Basename. This analyzes file names and is used for file uploads. OK
Checking for File::stat. This examines files and is used for file uploads. OK
Checking for HTML::Entities. This encodes and decodes strings with HTML entities. OK
Checking for Scalar::Util 'blessed'. This is a set of useful utilities. OK
Checking for Text::ParseWords. This is used to extract lists of words from strings (ignoring delimiters insider quotes) OK
Checking for Net::Twitter::Lite::WithAPIv1_1. This connects to Twitter and executes the new Twitter API) OK
Checking for Image::Magick. This connects to Twitter and executes the new Twitter API) OK
Checking for DateTime. This converts dates and times) OK
Checking for DateTime::TimeZone. This manages time zone conversions) OK
Checking for Time::Local. This manages local time) OK
Checking for Digest::SHA1 qw/sha1 sha1_hex sha1_base64/. This excrypts passwords and access tokens) OK

11. I created a secret data directory and placed a file in it called multisite.txt
This file contains the database information for the website. It is a tab delimited file with the following values:
url    database_name    localhost    database_user   user_password
Needless to say it is not included with the gRSShopper distribution. You can edit the top of grsshopper.pl to set the database values, or define the multisite.txt script location at the head of grsshopper.pl (or it defaults to /cgi-bin/data/multisite.txt )
(Note for later use - the capcha table is also located in the data directory)

11. I ran the initialization script by running http://website/cgi-bin/admin.cgi
(this actually redirects to initialize.cgi but I like to run it from admin.cgi just to test admin.cgi and  the redirect).

Result: server error (*rats*). Check the error log again. Error:  Can't locate MIME/Types.pm
Updated server_test.cgi to include MIME::Types  (heh heh)
Used CPAN to install MIME::Types

Once again I ran the initialization script by running http://website/cgi-bin/admin.cgi
This produces, as it should, a large message saying:
gRSShopper Initialization - Unable to Access Database

12. I initialized the database by clicking where it said and got an error:
The requested URL /cgi-bin/initialize.cgi was not found on this server.
I changed the name of the file /cgi-bin/initialize.cgix to /cgi-bin/initialize.cgi
(this is so I don't accidentally run the initialize file on my own site. Heh. You will want to simply remove this file when you're done here.)

12a. Step 1 - database initialization. Check the values in the form. Changed the value of Data Directory to the location of my secret data file. Things like name and tag can be changed later. Clicked submit.

12b. Step 2 - data pack selection. I selected the UMCourse data pack I made earlier. (Note: so long as initialize.cgi remains on your computer, you can switch to any other data pack. You can also create new data packs and switch back and forth. Just be careful - switching data packs will wipe out your existing data, so you must be absolutely sure to save the existing data as a data pack before you switch.) 
The data pack creates directories and database tables for you. It also loads Javascript, Image and CSS files associated with the current install. These sometimes get mixed up and I'll have to fix some stuff below. The installer isn't perfect.

12c. Step 3 - testing the login cookie. It gives me great pleasure to say the cookie has been successfully read.

The installer then creates an admin user ID and anonymous user ID. Note: the default password isn't 'L60iAoNSIza8k' of some such string. It's 'admin'. I need to fix the installer message here.

13. Click the link to be taken back to cgi-bin/admin.cgi where you will be presented with an 'Error' message and a prompt to login.

The link to login was wrong, it's the default http://www.yoururl.ca/cgi-bin/login.cgi at the top of grsshopper.pl  I edited grsshopper.cgi so now if it detects the default (and always wrong) 'yoururl' cgi-bin location, it defaults instead to the (usually right) url/cgi-bin location. If this fix doesn't work for you, you'll have to type the URL of the login.cgi script manually (you can edit the location of your cgi scripts in admin.cgi (though you really shouldn't unless it's messed up, because you'll mess it up)).

Login isn't functioning properly. The problem is that we're using a numerical URL - eg. 123.45.67.89
Normally the system sets the cookie domain by dropping the first part of the URL - eg. www.downes.ca yields a domain of downes.ca -- but this doesn't work for two part domains (like myspace.ca) or for numerical domains. Clearly I need to fix this.

But for now, I edited login.cgi to explicitly set a cookie domain. It's at line 65 --
our ($Site,$dbh) = &get_site("page");        # Get Site Information
$Site->{co_host} = "123.45.67.89";

and this works just fine.

14. I forgot to include the 'boxes' in my UMCourse data pack so there are none. Also, all the URLs for the scripts and CSS in the templates are wrong. Also, the page data wasn't saved. I don't know why. I need to revise this part of the data pack creation script, maybe. Anyhow, I can sort of start from scratch. I can create boxes, pages and other content using the admin screen. In this case, I simply copied the box and page content from the change.mooc.ca site to get us started here.

Comments

Popular Posts