«

Sync Web Dev with MAMP and Dropbox

Tags: , , , , ,
Posted in Hacks

dropbox and mamp

Dropbox

Initially I used dropbox, as an alternative to email, to share music tracks and ideas with band mates. So simple even our singer could work it out! It has quickly become my main tool for syncing all sorts of other data.

So I decided to see if it could be used to sync multiple MAMP web development environments. Site files and MySQL databases.

Ok, skip the blah, show me the method!

Syncing Applications with Dropbox

When you work on multiple computers it can be a pain to keep things in sync. But, where there’s data there’s a way to sync it with dropbox. One of the first dropbox solutions I came across was for 1Password, my password manager of choice. 1Password holds all its data in a keychain so you can simply move the 1Password.agilekeychain file to your dropbox and edit preferences in 1password to point to the new location. A more detailed tutorial can be found over at WebWorkerDaily. As of version 3, this keychain file can also be opened as an HTML webpage so you can access your passwords on computers without 1password installed.

Things requires a different approach. There is no preference option to chose the location of you data file. Instead you can move the Things data folder into your dropbox and create a symbolic link in its place. Detailed instructions can be found at this hocuspokus.net. Symbolic links are basically low level Aliases. I also use a similar method to keep the address book app in sync.

After using dropbox to sync these apps between 3 computers I was in need of a better way to sync my web development projects. I was already using dropbox to share zipped versions of site files and mysql dumps but this process was a bit tedious. Every morning I have to unarchive the files into my sites folder and re-import databases and remember to export them before I left. One solution would be to create a couple of scripts to import and export this data… but after seeing how well dropbox had worked so far, I decided to test its limits and sync a whole web development sever.

Syncing MAMP with Dropbox

I use MAMP to run my local webserver with php and mySQL. The first step is to sync Apache’s webroot. By default it’s located in the /Applications/MAMP/htdocs folder.

Click Preferences > Select the Apache tab and change the location to a folder in your dropbox, I use /Dropbox/Sites.

apache-settings

Now all your development site files will be kept in sync through your dropbox.

create-symbolic-link

The second step is to sync MAMPs MySQL server. Unfortunately MAMP does not provide the option to define the location the database files are kept. So I followed the symbolic link method used to sync Things.

MAMPs database files are stored in /Applications/MAMP/db. Make sure you quit MAMP first, then move the db folder to your dropbox.

Create a symbolic link back to its original location. You can use terminal for this but I prefer to use SymbolicLinker a contextual symlink plugin. It gives you a “Make Symbolic Link” option in any file or folders right click menu.

Thats it, you’re done. Start up MAMP and you’re up in the cloud.

Steady Eddy

I haven’t tested this process fully yet and may update this post if I see any trouble brewing. A few points to note though.

  • Developing large sites with large databases is gonna fill up your dropbox pretty quickly.
  • I wouldn’t recommend developing on different computers simultaneously, dropbox is quick but not that quick. I can imagine your database could get messed up if your jumping between computers updating and deleting records. But by all means give it a go and let me know how dropbox copes!
  • For theses reasons do not totally rely on dropbox. It’s always good practive to have a local backup of your dev files as well, just incase.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

5 Responses

  1. Ben Dunkle says:

    I’m trying to set up my db folder on dropbox, but I can’t get them to sync. The other macs on my network are seeing the old database.
    Weird…

  2. Jim says:

    I’ve had a few odd occasions where it appears I have a completely different databases on each computer even though they are both pointing to the same db folder… When I get the time i’ll investigate but must admit I haven’t a clue at the moment!

  3. Lucas Curti says:

    If you are using MAMP PRO, the db folder is located here: /Library/Application Support/appsolute/MAMP PRO/db

  4. James Gill says:

    This is a great article guys – really helpful!

    Oh, and thanks for signing up for LiveStats. It’s a pleasure to have you on board.

  5. George says:

    Cool idea! I think you would be interested Osmek, a cloud based cms with an API. Check them out http://osmek.com

Leave a Reply