Category: Software

How To: Setting Up Drupal File Framework On Ubuntu 8.10

Posted by on December 2, 2008

This document is continually changing! One of the ways it gets changed is by people communicating with me using comments. In the future, I will host a wiki for this purpose – but for the time being please help me out by posting your suggested changes/improvements as comments!

Drupal Logo In my previous post I described the troubles I had with standalone document management softwares. Many of the issues I had were related to a lack of flexibility and lack of integration with my CMS of choice: Drupal.

At first glance(and even after looking quite hard), Drupal seems to be weak when it comes to document management. But just like any Drupal solution, a careful examination of the available modules might turn up the ingredients for the perfect recipe!

In this article, I’m going to describe the steps required to get off the ground with a Drupal based document management solution that will provide:

  • Organization of documents
  • Revision control
  • WebDav access
  • Rich metadata
  • Indexing for search
  • In-browser display of documents
  • Document conversion services
  • All the goodness you get from building it inside Drupal
    • Free authentication
    • Free administration interface
    • Integration with other Drupal modules (Views anyone?)
    • Awesome community of developers

Getting started

I’d recommend testing this out on a fresh install of Drupal6.6 – should you encounter difficulty, the number of modules on an established site could make troubleshooting a bit more difficult. After you’ve got it down, you can move on to your active development site.

Thanks to Arto Bendiken, Miglius Alaburda, Justin Miller, Ben Lavender, Frank Febbraro, and of course Moshe Weitzman.

This article is based on Setting up your system for file conversions with File Framework. Ben gives a very helpful and accurate rundown of what it takes to get going under CentOS. Since I was trying it out under Ubuntu, I thought I’d spend the time documenting my troubles – and include instructions to add some extra bells and whistles.

System stuff

First things first, lets go ahead and get all the packages we need:

sudo apt-get install php5 php5-dev php-pear make php-getid3 libmagic-dev clamav swftools unrtf poppler-utils catdoc ghostscript tzdata tzdata-java alsa-tools alsa-utils libx11-6 libxext6 libxi6 libxtst6 asoundconf-gtk libfreetype6 libpng12-0 libjpeg62 giflib-tools libsm6 openjdk-6-jdk openoffice.org openoffice.org-headless code2html pstotext
sudo pecl install Fileinfo
sudo pear install http://download.pear.php.net/package/HTTP_WebDAV_Server-1.0.0RC4.tgz
sudo pear install http://download.pear.php.net/package/HTTP_WebDAV_Client-1.0.0.tgz

If you have trouble with the install of the pear modules, probably the version has changed – you should visit the HTTP packages page.

JODConverter

We also need to get the JOD Converter. It’s a few .jar files that we’ll stick in a directory in /opt. JODConverter is the piece that actually manages the conversion process through openoffice.

cd /opt && wget http://internap.dl.sourceforge.net/sourceforge/jodconverter/jodconverter-2.2.1.zip && unzip jodconverter-2.2.1.zip && mv jodconverter-2.2.1 jodconverter

Run OpenOffice as a service

Long story short, use a version later than 2.3 to avoid problems running it ‘headless’. This is essential for the file conversion process.

edit: I realized that the OpenOffice service really needs to be running as www-data, so using an init script like this one is really necessary.

#!/bin/bash
#
# description: Open Office Service
#

export WEBUSER=www-data
export PATH=$PATH
export LANG=en_US.UTF-8

start() {
echo -n "Starting OpenOffice service: "
sudo -u $WEBUSER /opt/openoffice.org3/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp" -nofirststartwizard & 
echo "OpenOffice Started"
}

stop() {
echo -n "Stopping soffice: "
pkill soffice
echo "OpenOffice Stopped"
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status soffice
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

If you want OpenOffice3 like I’m using, you might want to remove the 2.4 packages with apt-get remove and go to openoffice.org and download the .deb packages. I installed by extracting the archive, cd’ing into the folder and using

sudo dpkg -i *.deb

and doing the same in the desktop integration folder. I can’t really recommend using OOo3 because the Ubuntu folks don’t have it in the repos…and the GUI is very crash happy.

Drupal stuff

Clean URLs

Pop over to the Drupal.org page describing how to set up clean urls if you don’t have that going already. Clean urls aren’t necessary, but due to a bug currently in bitcaching – it is.

Install Drush

If you aren’t using the Drush module, I highly recommend it. Although not related to or necessary for this project, since I discovered it one day ago, it’s become one of my favorite modules. It provides a familiar way to install and update your packages – and has a number of modules that extend it’s functionality.

  • Install the Drush module by downloading the tarball to your modules directory (sites/all/modules) and extract it.
  • Go into your modules page in Drupal and enable the Drush and associated modules. You won’t be able to turn on the simpletest runner module, that’s fine. Also – I wasn’t able to use the CVS support, so I have that disabled as well.

One last thing – you need to add a softlink to drush.php somewhere in your path. For me, I just echoed the path variable and picked the place that looked the best… Make sure you change any paths to whatever works.

% echo $PATH
/home/hopkinsju/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

% ln -s /var/www/drupal/sites/all/modules/drush/drush.php /home/hopkinsju/bin/drush

Now you should be able to type ‘drush’ and the computer will know what you’re talking about.

Add required modules with Drush

Now we just do this to get all the modules we need:

drush pm install bitcache cck dav fileframework rdf views fileserver #FTW!

Drush will go out and grab the latest version of each module and extract it in your ’sites/all/modules’ directory.

note: As of this writing bitcache-alpha3 had a bug in it. Using alpha3 will result in the error “Fatal error: Unsupported operand types in serverpath/includes/common.inc on line 1546″. To resolve this, you can use either the alpha2 or dev versions of the bitcache module

A few other bits

The File Framework can get metadata for and play flash and mp3 files. You need only add a couple things to the vendor folder of fileframeworks:

edit: Using the commands below should get you going without a problem, but I wanted to clarify: You MUST use the ’slim’ version of the xspf player. Also, the path to getid3 should be /vendor/getid3 – there should also be a directory /vendor/getid3/getid3 containing the different modules.

update: new versions of getID3 and flowplayer as of Mar 18, 2009 – also you need to make folders for them…I’ll update the lines in a bit.

cd /path/to/drupal/sites/all/modules/fileframework/vendor
wget http://voxel.dl.sourceforge.net/sourceforge/getid3/getid3-1.7.9.zip
unzip getid3-1.7.9.zip

wget http://flowplayer.org/releases/flowplayer/flowplayer-3.0.7.zip
unzip flowplayer-3.0.7.zip

wget http://voxel.dl.sourceforge.net/sourceforge/musicplayer/xspf_player_slim-correct-0.2.3.zip
unzip xspf_player_slim-correct-0.2.3.zip

Enable the modules

Visit your modules page and enable the modules you need. When I first attempted this, I did run into an error where I had enabled one module or another without first enabling the modules it required(I think it was the RDF API module that needed to be enabled before the File formats). You’ll want to actually look at what you’re installing rather that just checking all the boxes of course. But basically – check all the boxes ;)

Drupal admin area things

  • Visit admin/settings/dav/dav_fs and save the page to create the dav directory
  • Enable DAV Server in admin/settings/dav
  • If you want html highlighting for text files admin/settings/file/format/text
  • Enable antivirus scanning (I chose to run it as a program) admin/settings/file/antivirus
  • Enable file formats admin/settings/file/format
  • Go tell the Fileserver that you want it to use the ‘Files’ vocab. Doing this will enable automatic creation of file nodes when items are added to that folder via WebDAV.

Please post your comments if you can improve on what I’ve done!

Happy document managing!

Well, Well, Well – WordPress 2.7

Posted by on November 24, 2008

WordPress 2.7-beta3-9863, as its name suggests…is a landmark update for WordPress.

Dashboard at a glance

wp-admin dashboard

Besides the new layout, there are other changes obvious in the first 5 minutes:

  • A new “Quick Press” section – I-’m writing- started writing this post using it.
  • Ajaxy accordion widgets replace the top-nav sections in the new sidebar menu.
  • Sidebar can be minimized a la photoshop toolbar – child items pop-out on hover.
  • Totally new(rockin’) icon set – apparently they had a contest – grats “BD”
  • Did I mention the Ajax?? I don’t mean to be a web2.0 fanboy here – but honestly – UI design can make or break the experience…and unfortunately it’s more often breaking it.

No sooner than I say I’m not a web2.0 fanboy as I mentally say “Ooooeee!” upon noticing that the boxes can be repositioned via drag-and-drop. That’s, like, web2.0 meme numero uno.

using the drag-and-drop widgets

Editing content

Viewing the list of my posts I noticed two things: An alternate view of posts that shows excerpts(just in case you don’t use the most descriptive titles), and the ability to “quick edit” the titles, categories, and a few other things about the post. Unfortunately you can’t edit the body of the post without clicking ‘edit’.

excerpt-with-quick-edit

Revisions

This might have already been there – but revisions are great. At the bottom of the “Edit Post” page you get this:

post-revisions

Clicking one of the links takes you to a page showing the text of your post along with an array of radio buttons for all previous revisions and their restore links. Talk about handy.

Overall

I’m very very happy with the upgrade. I know WP updates don’t come with much fanfare – but this one was touted as having “major improvements”. I certainly think they came through.

There are some minor issues – browser related positioning errors and what-not – but I’d expect an official launch in the very near future.

Want what I have?

If you’d like to upgrade, you can just visit Tools>Update and get the “Nightly build”…Or, if you’re like me, and prefer to handle your upgrades with Subversion(it’s easier to go downgrade, faster to do multiple blogs, and simpler to merge your customizations with upstream code) – then you’d just ssh into your blog directory and…

If you are already tracking trunk(then you probably already know this):

svn update

OR

If you are tracking the latest stable version, but want to try the new stuff:

svn sw http://svn.automattic.com/wordpress/trunk/ .

If you hate it and want to switch back:

svn sw http://svn.automattic.com/wordpress/tags/2.6.3/ .

OR

If you don’t have a WP blog yet and want to get started with the latest stuff or don’t have anything in your media gallery worth keeping(you could always back that up) – and haven’t made any customizations to WP themes(again, you could always back those up). Basically if you don’t yet have your WP blog under revisioning, and need to get started with svn:

svn co http://svn.automattic.com/wordpress/trunk/ .

Enjoy!

Is this "Less Fail"? Why I’m Replacing Typo

Posted by on October 21, 2008

Typo is blog software written in Ruby, and available as a gem for Rails. It’s what is currently running this website. It’ has it’s pluses but over time it’s grown aggravating to me. I’ve decided to move on to another platform, but I’m not sure which at this point.

If by the time you are done reading this post you feel like Typo would be a good fit for you, you can download Typo and try it yourself. I’m by no means the expert in these matters, and what might not work for me might be right up your alley.

Why I picked Typo in the first place

When I was originally looking for a blog software to use I had these basic requirements:

  • Not what everyone else was using(Wordpress, Blogger)
  • Not written in PHP

I didn’t want to use what everyone else was using because in most things – I like to be different. The fact is that I am different from most people, and I tend to make that known.

I wanted to use a product that was not written in PHP because as an aspiring programmer, I’d rather be using a more cutting edge language like Ruby or Python. Not only is the code of Ruby/Python easier to write and the languages more interesting, but the jobs you get when you know them pay very much more than with PHP, whose programmers are a dime a dozen. I’m not saying that it’s not worth knowing – indeed PHP may be the most useful language to know due to it’s ubiquity. Also, I don’t want to offend any of the PHP programmers who may be reading – I’m envious of your skills(read: skillz).

Ok, so why Typo? Well looking back I didn’t look into things all that well. I ended up turning all the negatives into positives which isn’t a very smart thing to do. At some point, mostly for very shallow reasons I decided that Ruby was a little cooler than Python, so having eliminated all of the Python blog software(there aren’t many) I had a very very short list to choose from. When I tried the demo of Typo I was fairly impressed by the admin interface. Also even though there were very few themes available, I really liked the one I have applied here(scribbish).

What I don’t like about Typo

Lack of community

One thing about open-source software is that it really needs a large and active community. This is extremely evident when you start using projects like Drupal, Ubuntu, Eclipse, and so on. Typo is not like that at all. It’s basically just one person developing with a few other making commits. This really leads to nowhere fast.

If you read the first blog post I wrote on this website you’ll see the difficulty I encountered just getting up and running. This was due almost entirely because of Typo development that wasn’t keeping pace with the development of it’s fundaments – Ruby/Rails. Even after working around the issues I was having, an entire section of my admin area is broken. Looking in the svn repo for Typo I’ve found that there is an experimental branch for Ruby 1.8.7, but it’s pretty clear that it’s not going to be finished before Ruby increments again.

Lack of features

Obviously since this is an open-source project, this is intimately tied to the lack of community – but there are things that should have been available at the outset. For example: users(myself included) cannot log into the public side of the website. This makes it very annoying for commenters – having to retype their info each time, and not being able to edit their comments – but also for me If I want to edit anything I have to do it from the admin side.

Another feature missing that is somewhat related to front-side logging in is a feature that I first saw in WP – private posts. The ability to make a post that only permitted users can see is essential for the entire concept of weblog. The idea that everything I publish should be public is ludicrous.

Plug-ins. Again, because plug-ins are almost by definition community contributed I wouldn’t expect to see too many of them – but the number available is really pathetic. Less than 20 are available, and almost all are totally useless to 99.9% of people on the internet.

This brings me to my next point:

Why I’m dumb

I managed to turn every one of the things I’ve identified as negative about Typo into a positive.

Q: Don’t you want to use a product with a huge community? A: No, I want to be different!

Q: Don’t you want to have thousands of plug-ins available? A: I’ll just write whatever I need!

Q: Don’t you want blogging to be easy? A:

So yeah, now I realize that if you want to actually, say, write blogs then you have to have the time to do that. I want to learn Ruby – of course – but I want to write quick blogs about my accomplishments too. Starting a blog as a learning project means you have neither a blog or a project – just a bunch of stagnation. In my case I opted to write blog after blog and never have the features I wanted, feeling pissed off all the while. not good.

So, what to use now?

Honestly I’m leaning towards WordPress. It’s the obvious choice for obvious reasons, but until I have a couple hours to look again at all of the(free, open-source) options – I can’t make a final decision.

I’d still like to look at Ruby/Python blog softwares, and this time not because I want a pet project. I’ll look at performance issues – I know that Ruby, but especially Python will outperform PHP, but after caching is taken into account the difference may be negligible.

I don’t think WordPress is inherently insecure – as some assert it is due to it’s open-source nature(unlike windoze, which is SO secure!), but it might be vulnerable due to it’s high usage and therefore high rate of attack(just like windoze!). But that’s all anecdotal – I don’t know security in general much less the minute details of the WP code.

Mephisto is another Ruby blog, but it looks like it suffers from the same problems as does Typo. I’d love to do either one of these if I could get paid to work on them.

Anyway…I’ll just keep looking around for now. Post a comment if you want to make a suggestion! (Sorry it won’t remember your user info and I won’t be notified of new comments)

Thunderbird + FireTray FTW!

Posted by on October 12, 2008

Who doesn’t love Firefox? Probably only this guy. But what about it’s cousin, Thunderbird?

Thunderbird

Thunderbird has always been a program I wanted to embrace, with only 1 real problem: NO MINIMIZE TO TRAY! For what it’s worth, if you’re using Windoze, you can download Minimize to Tray. The lack of a Linux version of Minimize to Tray has long kept me from using it. It sounds really stupid I know, and it IS stupid. Thank goodness that doesn’t matter anymore!

FireTray

That’s right folks. As the name might imply, FireTray is a Firefox extension. I saw no mention of it’s compatitbility with Thunderbird – but out of desperation I decided to try to install it. Lo and behold, it worked.

It’s the usual install process. Find the extension, but instead of clicking the Install button, right click and choose “Save link as” then save the .xpi to your desktop. In Thunderbird, go to Tools > Add-ons, then click Install and browse to your .xpi file. Thunderbird will not give you the option to restart(I don’t think) but you will have to restart Thunderbird to get the tray icon. You can adjust the preferences for the extension – I recommend checking all three boxes for super tray goodness.

FireTray should keep Thunderbird running in the tray(duh), notify you of new mails, and still provide you with a mail client that is 1 million times better than Evolution. HA!

How to Install Typo at A2hosting

Posted by on September 24, 2008

I’m new at A2hosting, and just went through almost a weeks worth of back and forth with their tech support folks. Being that their wiki on installing a Typo blog is out of date – I thought I’d make this my first post on my new blog.

Prep

The first thing you’ll want to do is submit a ticket to have Rails 2.0.2 installed. The default Rails 2.1.1 will not work with Typo at this time. There is an experimental branch of Typo to support Rails 2.1.1, but being new to RoR – I didn’t want to go that route. Also, if you haven’t already – you might want to ask them to install wget for you, as it’s what I use to download stuff from the command line. You can use curl if you are comfortable with it also.

While A2hosting is working on getting Rails ready to go, you can use cPanel to setup your MySQL and ruby app.

Set up your database

From the cPanel front page:
  1. Click ‘MySQL Databases’
  2. Name your new database ‘typo’ and hit ‘Create Database’ (Your username will be prefixed to the database name, i.e. ‘johndoe_typo’)
  3. Scroll down the page a bit and add a new user called ‘typo’ and set a password(write this down) – hit ‘Create User’ (Your username will be prefixed to the database name, i.e. ‘johndoe_typo’)
  4. Scroll back down and add the user to the database – select the user and database from the dropdowns and hit ‘Add’, on the resulting page, check the “ALL PRIVILEGES” box and hit ‘Make Changes’

Create your Rails app

To be honest, I’m not totally sure this step is necessary. When working with A2hosting tech support, they claimed that their rails app showed up automagically when they extracted the typo archive into their web directory, which is the next step, but this didn’t happen for me, so here’s what I did instead:

You will need an empty directory to put your app. I’d suggest

mkdir ~/www/typo

Then head back to the cPanel frontpage and look for ‘Ruby on Rails’

  • app name = typo
  • path = public_html/typo (www is a symlink to public_html)
  • load on boot = checked
  • environment = production (you could go with development, and should switch it if you have issues – but for now just go with production)
  • Hit ‘Create’
  • Create the rewrite you want(This is necessary if you want to use a rails app, but you can redirect the root directory of your domain like I’ve done)

Now you’re going to say I’m crazy – but go back to your shell and blow away the directory we created earlier

rm -rf ~/www/typo

Like I said, this was really just to get the typo app listed in cPanel so that we can start/stop it, create a re-write, and toggle the other settings. We are going to recreate the typo directory but populate it with the actual Typo code in the next step.

Download Typo

After Rails 2.0.2 is installed, you can go ahead and download Typo. Connect to your server via ssh and then do the following:


wget http://rubyforge.org/frs/download.php/42257/typo-5.1.3.tgz
tar xzvpf typo-5.1.3.tgz
mv typo-5.1.3 typo

Configure the database connection

First things first, rename database.yml.example to database.yml:


mv ~/www/typo/config/database.yml.example ~/www/typo/database.yml

Now use your favorite text editor to make database.yml look like this(use the username/password and database names you created earlier):

login: &login
  adapter: mysql
  host: localhost
  username: yourusername_typo
  password: yourpassword
  database: yourusername_typo

development:
  database: yourusername_typo
  <<: *login

test:
  database: yourusername_typo
  <<: *login

production:
  database: yourusername_typo
  <<: *login

Strictly speaking, you’re all set – but there are some issues that I had to work though before Typo started working for me.

Fixes

A couple issues came up at this point for me. A2hosting support was kind enough to provide one of these, but after some chiding from them – I was forced to look up the other myself ;)

  1. Open up ~/www/typo/config/boot.rb and browse down to line 29. The line begins with ‘require_gem’ and needs to be replaced with just ‘gem’. Apparently this is depreciated code, and I suspect it has at least something to do with the next fix.
  2. Open up ~/www/typo/app/models/article.rb and pop down to line 296 and add:


#Added per http://www.typosphere.org/issues/show/1264 to correct error upon managing content
  def published?
    published
  end

Both of these issues are probably caused by A2hosting using Rails 1.8.7 and Typo supporting 1.8.6 – but they seem to be workable this way. I’d be curious if anyone else tries downgrading to 1.8.6 and skipping these 2 steps.

Start yer app!

Go back into cPanel, Ruby on Rails section and hit ‘Run’ for your Typo app. After the confirmation screen, use the ‘Go back’ link and make sure it says “Running” and not “Not running”. If it’s going – direct your browser to whatever url you designated in your rewrite(or click the ‘URL’ link in the app table). There should be/might/will be a delay while the Typo database structure is set up – then you’ll create your first user.

If your app is not running at this point – please do leave a comment. It may be that I’ve left something out.

The rest is up to you!