Showing posts with label drupal. Show all posts
Showing posts with label drupal. Show all posts

Friday, March 09, 2007

reinstalling drupal, preparing for live & dev sites

Ok, I'm archiving my current dev install of drupal (which is bloated with modules, some of which have altered the mysql database) and starting with new install of 5.1. Once I have just the right constellation of modules locally, I'll copy them over to our live site (parts.mit.edu/igem07). Here are the mysql commands I used to reset the database for my new drupal install:
  • mysqldump -u username -p --databases drupal >/tmp/drupal.sql
  • drop database drupal;
  • create database igem2007;
  • GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
    ON igem2007.*
    TO 'drupal'@'localhost' IDENTIFIED BY 'foopass';
Then I grabbed drupal 5.1 and followed the install instructions to unpack the files and move them into my webserver's base directory. So, from the terminal:
  • cd /Library/WebServer/Documents
  • rm -rv *
  • curl -LO http://drupal.org/files/projects/drupal-5.1.tar.gz
  • tar -xzvf drupal-5.1.tar.gz
  • mv drupal-5.1/* drupal-5.1/.htaccess ./
  • rmdir drupal-5.1
  • chmod 777 ./sites/default/settings.php
    - this part isn't actually mentioned in the install.txt; see my earlier post
  • visit the drupal site root via web browser and supply database info
  • chmod 644 ./sites/default/settings.php
  • mkdir files
  • sudo chown www:admin files
  • sudo chmod 755 files
That's it! Drupal 5.1 has been restored to virginal status. I'll post the modules I decided on and the configuration details next.

References:

Wednesday, February 14, 2007

setting up parts.mit.edu/igem07

Also see the earlier post on setting up drupal 5.0 in osx 10.4.
  • setup crontab (also see here):
    crontab -e
    # m h  dom mon dow   command
    55 23,5,11,17 * * * /usr/bin/wget -O - -q http://parts.mit.edu/igem07/cron.php
  • Setup files directory (Note: on osx apache runs as user 'www'. It's different on our server, which is running some flavor of ubuntu/debian: the user is 'www-data'. Find apache's username on your system with 'ps aux | grep apache'.)
    sudo mkdir files
    sudo chown www-data:admin files
    sudo chmod 755 files

Friday, February 09, 2007

Building Blocks

To summarize the Features of iGEM2007.com:
Rich user & team profiles; Team blogs, Forums, Wiki; Team-centric user access control; Google maps + teams mashup; RSS for everything; Limited, distributed (amongst team leaders) user registration; Feedback & submission of team application; Help docs based on Books, oh yeah, and tagging and digging, of course.

How do we build it? Hopefully a functional skeleton will coalesce out of the following list of drupal resources:

practical demonstrations & explanations
modules
  • Overview of Drupal 5 components & example modules - from api.drupal.org doc
  • Creating Modules (a tutorial): Drupal 5.x - "The full tutorial will teach us how to create block content, write links, and retrieve information from Drupal nodes."
  • php demonstrating how to view a list of nodes on a google map using the views, location, and gmap modules
  • Gmap - API lets other modules use google maps, can generate basic maps in any node from gmap macro code. Integrates with the location.module. Port to 5.1 still unstable.
  • Location - API for geocoding (only u.s. and some of ca & de?), can add location fields to nodes, can do proximity searches on nodes. Port to 5.1 still unstable.
  • Views - "provides a flexible method for Drupal site designers to control how lists of content (nodes) are presented... This tool is essentially a smart query builder that, given enough information, can build the proper query, execute it, and display the results."
  • CCK - "allows you add custom fields to custom content types using a web interface. In Drupal 5.x, custom content types can be created in Drupal core, and the Content Construction Kit allows you to add custom fields to any content type." Here's the list of all Dupal 5.x CCK-related modules
  • Node Profile Module - "This module builds user profile's as nodes, which ... allows using CCK and its field types as well as the CCK form builder. For a maximum of flexibility it'll be also possible to use custom node-types and modules instead of the CCK." Also, it's integrated with views.module.
  • Organic Groups (og) - "An organic group is created by a single group owner, who has special permissions including the ability to delete the group the owner created. Group subscribers communicate amongst themselves using the group home page as a focal point." - basis of "team portal" pages? Or could it just be done with a taxonomy? Also see og list manager and og views. Alternatively, see mailhandler for a non-og way to link forums w/ lists.
  • Converting 4.7.x modules to 5.x
themes
  • How to theme CCK input forms - "So, as a non-developer, semi-technical, marketing/business type person, I set out to discover how to 'theme' my input forms." Breaks it into 4 steps: creating CCK content type -> create [yourcontenttype].tpl.php -> modify template.php -> modify style.css
  • Content Templates module - CCK can generate ugly content; this module adds a "template" tab to CCK editing pages pre-populated with CCK's default layout, making it easy to customize how the fields are output. "But Content Template can actually be used on any node type and allows modification of the teaser and body properties before they go out in an RSS feed or are handed off to the theme."
  • Converting 4.7.x themes to 5.x

Good to know
  • Customization & theming handbook on drupal.org (extensive) - "Included in this section are PHP and SQL code snippets and examples for use in your sites pages, blocks and themes. There are also a few articles on theming engines, which provide the infrastructure to build and create new themes."
  • Basic syntax for getting accessing the drupal CVS repositories
  • Google Maps API documentation - if only all documentation was this good...

Wednesday, February 07, 2007

Help develop iGEM's drupal-powered site!

Hello, are you experienced with building sites based on drupal and/or knowledgeable of PHP and not averse to learning about drupal? If so, join us!

The International Genetically Engineered Machines Competition is now entering its third year and is expecting an increase in participation from 34 undergraduate teams from around the world to about 80-100. The teams spend the summer learning & doing genetic engineering and then present their work at the beginning of November here in Boston at MIT.

Last year we required all the teams to document their projects on a mediawiki server (http://parts.mit.edu/igem) - iGEM is not just an event that happens in November, although that's when it is most visible, but throughout the whole summer, and we wanted to capture as much of that experience online as possible. We built another website to explain the competition and link into each team's wiki page from a world map (http://igem2006.com).

I am developing a dynamic, community-driven site for the iGEM 2007 competition. I've spent the last two weeks investigating CMSs and laying out what features we want the new site to have, and I'm fairly sure Drupal is the base from which we should start. However, it's clear that we are going to need to develop a couple custom modules to support unusual features of the site. For instance, we will have about 1000 users, each a member of a certain team. We don't really want user accounts for anyone else. So we need to develop permissions for users based on which team they are in, and streamline how participants are given accounts ( i.e. manually authorizing 80-100 team leaders, who then can authorize their own team members). We also want each team to have its own portal page, dynamically generated from posts to the team's collective blog, recent forum activity, recent activity on our genetic parts database, and from certain pages from that team's space on our mediawiki.

I am trying to learn drupal and php as fast as I can to implement what we want, but I don't think it will be fast enough. Would you be interested in helping, or know anyone who might? How much would consultation / module development cost? If nothing else, pointers into the right direction would be very helpful.

If you are interested, I encourage you to check out our introductory site (I didn't design it!) at http://igem2006.com, and perhaps my development blog at http://cis-action.com.

Monday, January 29, 2007

Diving into Drupal, or, List 'o' Modules

This post of links should help me dive deeply into drupal.

First, getting started with content in Drupal: Node Types.
Also see the docs on Drupal's Taxonomy system.
Also see the great IBM intro to developing a collaborative web site.

Most of the non-essential core modules listed here will be useful (comment, forum, node, profile, search, statistics, taxonomy, tracker, user).

Here's a list of interesting contributed modules I'd like to learn more about:
  • Simplenews: Simplenews is a simple newsletter module which allows both anonymous as well as registered users to subscribe to different newsletters.
  • Massmailer: manage mailing lists (based on PHPList
  • Listhandler: synchronize mailing lists and forums
  • Organic Groups: Enable users to create collaborative groups (incompat. w/ taxonomy?)
  • Organic Groups List Manager: integrated mailing list/forum for OGs.
  • Node Vote: a node voting system
  • Interwiki: wiki syntax for linking
  • URL Filter: automatically turn URL text into hyperlinks
  • User Points: users gain points as they do certain actions
  • Tagadelic: weighted tags in a cloud
  • Privatemsg: an internal messaging system
  • Pathauto: automatic path aliases for nodes and categories
  • Biblio: manage lists of scholarly publications (including .pdf upload)
  • SPAM: tools to stop unwelcome posts
  • Services: standardized API for drupal
  • Google Analytics: free advanced web stats

Installing Drupal 5.0 on OS X 10.4

I started by archiving and emptying /Library/Webserver/Documents (I'm using OS X), then unpacked the drupal-5.0 archive there (without the containing drupal-5.0 directory).

I couldn't find the .htaccess file mentioned by Lullabot. I think it might have gotten lost as I moved the files around graphically using the Finder. It was present, however, when I used the commands suggested in the install instructions. Then I got the following error navigating to the install directory with firefox:
The Drupal installer requires write permissions to ./sites/default/settings.php during the installation process.

So my permissions are effed up. Boo. Just doing

chmod 777 ./site/default/settings.php


seems to have corrected the problem.
The location of the programs for connecting to and administering my mysql database haven't been added to my PATH, so I have to remember to go to /usr/local/mysql/bin for now to run them. I created a user for the drupal table as outlined in the INSTALL.mysql.txt.

Great. That seems to have worked. I changed the permissions on the settings.php (back) to 644. And Drupal 5.0 is online. Amazing.

Made a ./files directory and
sudo chown www:admin files
sudo chmod 755 files


Apparently I didn't install the GD library with PHP, so I'll have to recompile it.
Oh! Looks like I can use a precompiled binary put together by www.entropy.ch. I've got Apache 1.3.33. To successfully install the new PHP module (with GD support!), I've got to uncomment the lines that enable the pre-installed PHP module in SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"

Goody! Now my system has PHP 5.2.0 with a bunch of libraries, including the GD library. However, the switch seems to have broken the connection between MySQL and PHP - Drupal can't get to the MySQL database. Ah, PHP is looking for the MySQL socket in /tmp/mysql.sock - exactly the opposite of the problem I was having when installing Vanilla forums a couple weeks ago. The solution was to change the php.ini file (now located at /usr/local/php5/lib/php.ini) to override the compiled-in default and look for the MySQL socket at /var/mysql/mysql.sock, which is "more secure," according to this apple developer document. It took me a while to realize the personal web sharing control panel buttons weren't actually causing httpd to restart and reload the php.ini file, nor was apachectl graceful commands, for reasons I don't understand. Rebooting did the trick.

The only task left is to set up the cron jobs. Then I'll have a completely generic drupal install.

Edit: got the cron working (with curl - wget and lynx are not pre-installed binaries on OS X). There was a little trick to get the clean URLs to work - the httpd.conf file has to be changed to allow .htaccess overrides. The Mac OS X specific guidelines explain it:
In httpd.conf (in /etc/httpd), locate the following section and allow overrides, so that Drupal's clean urls will work (they depend upon rewrite rules in .htaccess). You'll need to be root (or sudo) to do this. Don't forget to restart apache after modifying httpd.conf (turn personal web sharing off, then back on again, or use /usr/sbin/apachectl restart).