Drupal Development

Revision as of 14:54, 13 April 2010 by Adam Franco (talk | contribs) (Browsing History)



Checking Out the Project

Add your user to the SVN configuration

On chisel:

  • emacs /var/svn/repos/drupal/conf/authz
    • Add "username = rw" where username is your username below the "imcbride = rw" line
  • emacs /var/svn/repos/drupal/conf/passwd
    • Add "username = password" where username is your username and password is the password you'd like to use for SVN
  • emacs ~/.subversion/config
    • Uncomment L13 "store-passwords = no"
    • Uncomment L19 "store-auth-creds = no"

Checking out drupal

svn checkout svn://chisel.middlebury.edu/drupal/trunk drupal_dir_name

Remember the value you use for "drupal_dir_name" as you will need to enter it later.

Set up the database

Create a new database on chisel using http://chisel/phpmyadmin. If you preface the database name with "drupal_", the testuser account will have automatic access to the database. Otherwise, you will need to set up user privileges for the database. In order for drupal to work with the modules we have installed, you will need to grant the database user the following privileges:

  • Data
    • SELECT
    • INSERT
    • UPDATE
    • DELETE
    • FILE
  • Structure
    • CREATE
    • ALTER
    • INDEX
    • DROP
  • Administration

You can import a blank database from the central drupal instance:

mysqldump -u testuser -p -h chisel.middlebury.edu drupal > ~/drupal.sql
mysql -u testuser -p -h chisel.middlebury.edu -D your_db_name < ~/drupal.sql

Set up the Webserver

You do not need to perform this step if you are setting up Drupal in your user home directory on chisel, however it is required when setting up new pre-production instances on longhouse. You must be logged in as root to perform these actions.

Edit /etc/httpd/conf/httpd.conf and add the following in the Directory section:

<Directory "/path/to/drupal">
AllowOverride All

Then run "service httpd restart".

Set up the Filesystem

Assuming you've set this up in ~/public_html/drupal_dir_name on chisel:

  • cp /var/www/html/drupal/.htacccess ~/public_html/drupal_dir_name
    • Edit L101 to read "RewriteBase /~username/drupal_dir_name".
  • cp /var/www/html/drupal/sites/default/settings.php ~/public_html/drupal_dir_name/sites/default/
    • Edit L93 to end with the name of the database you set up previously.
  • chmod -R 777 ~/public_html/drupal_dir_name/sites/default/files

Log in as the admin user

Go to http://chisel.middlebury.edu/~yourname/drupal_dir_name/?q=user and log in as 'admin'.

Development with Git

Cloning the central repository

Your ssh keys must be authorized to access the central repository. All chisel accounts' ssh keys have been authorized to do so at the time of this writing. Contact Adam to add ssh keys for other machines (such as your desktop) if desired.

  1. cd to your public_html directory on chisel:
    cd ~/public_html/
  2. clone the repository and create a working directory with git-clone:
    git-clone git@chisel.middlebury.edu:drupal.git
    You should now have a working directory at ~/public_html/drupal/

Browsing History

You can use the command-line program git-log and git-show-branchto browse the history, but a much better experience is provided by the gitk graphical browser.

gitk can be started from the git-gui's "Repository" menu, or from the command line:

  1. SSH to chisel using an XTerm:
    ssh -X chisel.middlebury.edu
  2. cd to the working directory:
    cd ~/public_html/drupal/
  3. open gitk showing all branches:
    gitk --all &

Committing Customizations

  1. cd to the working directory:
    cd ~/public_html/drupal/
  2. Ensure that you are on the master branch:
    If not, check out your master branch:
    git-checkout master
  3. Make some changes to files....
  4. Stage changes to one or more files:
    git-add path/to/desired/file
    or stage all changes:
    git-add .
  5. Commit the staged changes to your repository:
    git-commit -m "My commit message."