Using Dropbox with Statamic

Written by Dave | April 16 2014

I have been working with Statamic lately moving away from Wordpress. In case you haven’t herd of Statamic before, it is completely database free.

Statamic is:

An entirely new kind of CMS.

statamic.com

I like it a lot because it is ALL file based and easy to modify. I like the fact that I can easily edit all of the files without a GUI to make the necessary site changes so this was a nice fit for me.

Since I can’t get through the corporate firewall using my scp port of choice I needed a way to access the files directly. This assumes you are using a Linux AMI

Enter Dropbox! With Dropbox the files are synced right to your desktop so you can modify and save, with the changes going directly to your webserver.

So to begin, if you have not already sign-up with Dropbox and install it on your computer.

Now login to your webserver and run the following:

wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64"

This will download the files to your webserver

tar -xvzf dropbox.tar.gz

This will Extract the file

~/.dropbox-dist/dropboxd &

This will start up the client
After the client starts you will see the following:

This client is not linked to any account...
Please visit https://www.dropbox.com/cli_li... to link this machine.

Copy \ paste this link into your web browser and login to your Dropbox account. Now your server is synced with dropbox. There are a few more commands to make it really work.
First create a symlink to your webroot

ln -s {/path/to/your/Statamic/folder} {Dropbox-Path}/Dropbox/{link-name}

download the Dropbox commandline tool

wget -O ~/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"

Next exclude your _cache folder because you really don’t need to access that from your desktop.

python dropbox.py exclude add ~/Dropbox/html/_cache

Add your Dropbox command to crontab so that it starts when you reboot

@reboot $HOME/.dropbox-dist/dropboxd

And there you have it, your Statamic files should not be syncing on your desktop!
Credits: Installing dropbox on your EC2 machine Install Dropbox In An Entirely Text-Based Linux Environment

Filed Under:
  • Statamic
  • DropBox