Redux: Synchronizing Firefox Through Dropbox
For the most part, the Dropbox-enabled synchronization of Firefox that I wrote about a couple of months ago has been reasonably solid. A few hiccups and a few annoyances, but nothing serious or even significant enough to warrant a change of approach. This morning, though, that changed and I needed to re-evaluate my synchronization strategy.
Yesterday.
Until today, I’ve been running something of a kitchen sink mechanism. You can read the full post for the details, but I was sharing my entire Firefox profile across multiple systems and platforms using Dropbox activity. Bookmarks, extensions, cookies, history and everything else. The transparent and immediate way that Dropbox works made this possible.
Over the last couple of months of using this method across one Mac client, one Linux client and two lesser used Windows clients, I’ve been bothered by several side effects:
- Sharing profiles is chatty. Really chatty. I noticed this immediately and even mentioned it in my original post, but damn. Sharing an entire profile means a lot of Dropbox activity. Turning off system tray notifications in the preferences helped, but I kid you not when I tell you that the little blue animated icon overlay never stopped spinning. Unless Firefox wasn’t running at all, that thing was spinning like a madman.
- When I move from machine to machine, I’m not as diligent as I should be about quitting Firefox on the machine I’m leaving. Because of this, I assume, I ended up with a lot conflicted files in my Dropbox-mounted, shared profile directory after a while. This isn’t really a problem, as far as I know, but I hate clutter.
- Virtually every time I launched Firefox, I got the prompt that tells me my last session quit unexpectedly and asks whether I want to start a new session or restore my last. Because of the difference between how Mac and Windows/Linux order OK/Cancel buttons (even when the buttons don’t actually say OK or Cancel), I’d often find myself hitting the wrong one. Remember, I work in all platforms.
All of these actions by both applications, of course, are absolutely correct. Both Dropbox and Firefox were behaving exactly as expected, but the necessary side effects of the architecture I had concocted were still annoying.
Today.
This morning things got a bit more dire. Firefox simply wouldn’t launch while I was at work on my Linux machine. No matter how I tried – command line, Applications menu, Gnome Do, etc. – Firefox just wouldn’t start. There was no error or indication of an issue, Firefox just, well, did nothing at all. When I launched Firefox into the Profile Manager, though, I was able to select the default profile rather than my Dropbox-ified profile and run Firefox happily.
Knowing that the problem was in my shared profile created a level of severity that I needed to address.
Fixed.
Now that simple annoyance had turned to need, I set about defining a less brutish synchronization mechanism. What I really want synchronized across all of my machines – the profile elements that are most needed and yet the biggest pain to synchronize manually – are my bookmarks, my extensions and my Greasemonkey scripts so I decided to apply a more targeted solution.
Leaving my shared profile directory in place, I created a new Dropbox directory outside of my shared profile directory. To this directory, I copied what I wanted to synchronize from my Dropbox-shared profile. Then, in my default profile – the profile that is local to each machine rather than shared en masse via Dropbox – I created symbolic links to the bits I just copied.
Here’s what it looks like from the shell:
$ mkdir ~/Dropbox/Application Support/firefox/profile-share
$ cd ~/Dropbox/Application Support/firefox/profile-share
$ cp ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/bookmarks.html .
$ cp ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/places.sqlite .
$ cp -r ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/extensions/ .
$ cp -r ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/gm_scripts/ .
$ cd ~/.mozilla/firefox/erbbyfam.default
$ mv bookmarks.html bookmarks.html.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/bookmarks.html bookmarks.html
$ mv places.sqlite places.sqlite.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/places.sqlite places.sqlite
$ mv extensions extensions.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/extensions extensions
$ mv gm_scripts gm_scripts.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/gm_scripts gm_scripts
Details.
Although I thought I knew which files and directories I needed to create my targeted solution, I spent a little time verifying just to be sure. Here are the guts of what I wanted synchronized:
- In Firefox 3, bookmarks are stored in profile root>/places.sqlite.
- My application launchers (Quicksilver, Gnome Do & Launchy) key off of profile root>/bookmarks.html, so I needed to synchronize that, too.
- Extensions are stored in profile root>/extensions/.
- Greasemonkey scripts are stored in profile root>/gm_scripts/.
The nitty-gritty is pretty readable in the shell syntax above, but here’s the high level:
- I created a new directory so I could keep my targeted synchronizations independent of my complete profile synchronization.
- From my shared profile, I copied each resource into my new directory.
- In my local, default Firefox profile, I renamed its copy of each resource by appending .orig.
- In that same local profile, I created a symbolic link for each resource to the shared version in my new directory.
- I restarted Firefox and my default profile looked like my old profile in all of the ways that matter to me.
Now.
Hopefully this targeted solution will be much less flaky. Of course, my browsing history, form input history, cookies, etc. won’t be synchronized, but I think I can live without that just fine. The critical path for me, I’m pretty sure, is in the things I use and update frequently: bookmarks, Greasemonkey scripts and extensions.
Epilogue
Once I got home, I logged in and gave Dropbox time to sync up with the Mac. Once sync’d, I edited the Mac’s Firefox default profile and created the same symbolic links I’d created on my Linux machine. After restarting, the default profile loaded up beautifully here too.
I’ll keep an eye over the next few weeks, but hopefully this will be every bit as effective as my kitchen sink solution, but without the annoyances.
Subscribe19 Comments on Redux: Synchronizing Firefox Through...