December 24, 2010

Weekend Project: Replace Delicious with an Open Source Bookmark Service

 

The past two weeks have been rough for users of the Yahoo-owned "social bookmarking" service, Delicious. First, reports leaked out that Yahoo was shutting the site down. Then the Delicious team fired back saying essentially don't worry, all is well — we're simply getting sold off. That's cold comfort if you use the service to manage and tag a large collection of links, though. If you're not comfortable with the uncertainty, what better solution is there than installing your own open source replacement?

Running your own Web bookmarking application has two key advantages over a proprietary commercial service. First, you can change and adapt the system to fit your way of working. Don't care about sharing your collection with the world at large? You can run a single-user instance and keep your bookmarks private. Second, you can host it on your own server, whether a small box in your closet at home, or on a co-located hosting plan — either way, you're in control.

There are several Web-based bookmarking applications suitable for running on a LAMP server setup, but the option that most closely matches the Delicious service is Scuttle. It implements the Delicious API, supports multiple user accounts, and even allows you to import your bookmark collection from Delicious. Scuttle requires MySQL and PHP, and the most recent release is version 0.8.0, from December 21st of 2010. That is recent enough that although some Linux distributions provide builds through their package management systems, most will not have caught up yet.

That means you'll have to grab a source package from the project's Web site if you want to run the latest and greatest, but don't let it frighten you away. As a pure LAMP app, you don't have to worry about compilation — the setup process is straightforward. We'll take a look at installing and configuring the basic Scuttle application, then talk about some alternatives, including an interesting Scuttle derivative.

Basic Scuttle Installation

The Scuttle 0.8.0 package weighs in at a slim 313K. You can download it and unpack the tar-ball into your Web server's document root, such as /var/www/scuttle. Configuration requires two steps: creating the application's MySQL database and tables, and configuring your setup in the PHP scripts. After that, you'll create one or more user accounts, and can import your Delicious bookmarks.

Start by creating the MySQL database; the documentation uses the database name "scuttle," but of course that is up to you. You'll also want to create a database user as which the application can connect, and assign sufficient privileges. You can perform both of these steps through a Web interface like phpMyAdmin, or from the command line. For example, mysql -u root -p -h yourmysqlhost.example.com CREATE DATABASE scuttle creates the (initially empty) database, and mysql -u root -p -h yourmysqlhost.example.com GRANT alter,create,delete,drop,insert,update,select ON scuttle.* TO scuttleuser IDENTIFIED BY SomePasswordThatYouPick creates the database user.

To create and initialize Scuttle's actual database tables, the source package includes an SQL command file named tables.sql. You can import it from the MySQL command line with mysql -u scuttleuser -D scuttle -p < tables.sql. Although Scuttle itself supports several open source databases, the tables.sql file is designed specifically for MySQL only, so if you use another database (particularly one with known differences, such as PostgreSQL), only proceed if you know what you are doing and are prepared to troubleshoot the SQL commands yourself.

Next, go into the Scuttle directory and open the file config.inc.php.example in your favorite editor. You will need to alter the database configuration settings block to reflect the database host, database username and password, and TCP port number used by your MySQL server. Below that, the "Basic Configuration" block allows you choose a "site name" that appears in page headers, default language, and an email address at which the site administrator can receive alerts.

That is the only required configuration; you should be able to visit http://yourwebserver.yourdomain/scuttle now and create a new user account. You can, however, adjust a few other settings in the last configuration block to adjust things like the default sort order of bookmarks, number of bookmarks per page, and so forth. Also be sure you take a look at the url_redir setting; this is a URL pattern that Scuttle uses to pipe your users' clicks through a redirection service, thus hiding the origin of your Scuttle service and protecting your users from appearing in server logs across the Web. It currently uses Google's URL redirection service, but this is not an official arrangement, so if and when Google changes its redirection pattern, you'll have to come back to this file and alter this setting to match.

When all is configured to your liking, save the file as config.inc.php. Remove or rename the original .example file, then adjust the permissions on Scuttle's cache subdirectory with chmod 777 /var/www/scuttle/cache. Finally, bring up the URL in your browser. You'll see a "register" link in the right-hand corner; click it to set up a new account.

If this is your first time using Scuttle, click on the "add a bookmark" link in the page header. Here you'll find a form where you can manually enter a URL, page title, short description, and comma-separated tag list, buy you'll also find the bookmark import options at the bottom of the page. Scuttle can import an HTML-based Firefox bookmarks file, or a Delicious-compatible bookmark list in XML format. If you are migrating from Delicious, the simplest option is to log in to the Delicious XML exporter and export your collection, saving it as a local file. You then select that file in Scuttle's importer, and presto, your bookmarks, comments, and tags are all uploaded to your Scuttle database.

From here on out, you can use Scuttle's bookmarklets as your link-adding tool — just drag the bookmarklet link to your toolbar. Alternatively, you can install the Scuttle Firefox Extension. At the moment, the version hosted on Mozilla's Add-ons site is out of date; another developer has updated it for 3.x compatibility (though of course you should always use caution when installing third-party add-ons).

Semantic Scuttle

One big advantage of an open source Delicious replacement not mentioned in the introduction above is that open source can and does add new features more rapidly than a large, proprietary application vendor will. This is true for Scuttle; a popular fork called Semantic Scuttle exists that builds on the original's feature set.

Probably the most noticeable extension is support for "structured tags" — where Scuttle and Delicious permit tagging links with context-free, unorganized tags, Semantic Scuttle allows you to build relationships between different tags, where one tag is a subset of another. The app uses the greater-than sign (>) to show this; thus tagging a link as Netherlands>Amsterdam adds it to two tags, and connects the tags to each other. You can get to the link under Netherlands or Amsterdam, and Semantic Scuttle will build a nice, breadcrumb-style browser for you to click through your hierarchy of links in a more organized fashion.

Semantic Scuttle also supports "collaborative descriptions." With Scuttle, you as the bookmark-maker can write a brief description of each URL that you save. With Semantic Scuttle, other users on the same system can also add comments of their own.

The latest Semantic Scuttle release is version 0.97.1, from September of 2010. I haven't found any Linux distribution that packages Semantic Scuttle yet (although that doesn't mean yours doesn't), so you'll probably have to install it manually. The bundle is considerably bigger, at 1.1MB. Fortunately, the process is almost identical to the original Scuttle's. The main difference is the location of the PHP configuration file: in Semantic Scuttle, you'll find it under data/ as config.php.

You will need to edit the same basic parameters in this file: database settings and administrator contact info. You can also add custom header and footer messages in this file, and there are a few options that have been rearranged, but the comments document each section well. As with Scuttle, you still have to create a database and database user, and create tables using the provided tables.sql command file. The Semantic Scuttle documentation does not explicitly say whether or not its tables.sql is MySQL-specific, but if in doubt, it's best to play it safe.

Semantic Scuttle has a few additional back-end features you may like, such as the ability to create multiple admin-level accounts; these account names are listed in config.php, and the users can make changes to the system from the Web interface, including adding and deleting user bookmarks. Advanced options include the ability to rearrange the content layout of the site, adding a simple spam-prevention routine to the user registration page, capturing "page thumbnails" for each bookmark, and enabling an URL-shortening service. There is experimental support for external authorization routines, including RADIUS and LDAP. OpenID may be a possibility for the future.

Options and Alternatives

As you probably noticed, Scuttle and Semantic Scuttle are designed to re-create the full Delicious experience, which is a multi-user environment in which users can see each others' bookmarks (at least the ones designated as public). But you don't have to use either app as a multi-user tool, nor indeed to leave it open for everyone in the world to access. Semantic Scuttle allows you to turn off user registration with a simple switch inside config.php. Original Recipe Scuttle requires a bit more work; you can remove the registration link from the header and disable or remove the registration PHP file.

But if you're really not concerned with the social link-sharing aspect of Delicious, you might want to look into one of the other open source bookmark-saving options on the market. The simplest answer if you're a Firefox user is the Firefox Sync service from Mozilla itself. Built in to Firefox 4, it is available as an extension for Firefox 3.x, and uses strong encryption to protect a remote copy not only of your bookmarks, but also your browser history, saved form details, and other session information, and automatically synchronizes multiple the Firefox profiles on your different computers.

There are other options, too, such as Save-to-Read, an open source replacement for the proprietary Read It Later service, and Zotero, the bookmark-and-annotation system that tailors its feature set to users building a well-documented link collection suitable for researchers.

If you browse through the "bookmarks" category of Firefox's Add-ons site, you'll see page after page of bookmark services that each offer a unique combination of features. Just beware of the lesson of Delicious when you're choosing one: when you rely solely on the survival of a proprietary company to host your data, inevitably there comes a day when you have to go looking for a replacement.

Click Here!