Setting up the awesome Statamic on Amazon EC2 and syncing via Dropbox is straight forward and once set up is dead reliable, I love the fact that I can edit files anywhere I can access Dropbox and they appear straight away on my site(s) with backups all sorted
A) A drop box account, I would recommend a new one just for this otherwise you end up either having stuff you don’t need on the server or having to exclude loads of directories which have to be updated every time you add a new one, just get a standard free one to start with as that will give you 2 gig plus data and that is well enough, then just share the directory you will be storing your website in with your normal dropbox account.
B) An Amazon web services account you will need one of these as that is where the site will actually be hosted.
C) A licensed version of Statamic
- Create a EC2 instance (just use the quick start wizard) using Amazon Linux AMI 2012.09 (32 bit)
- I prefer static IP address, so these instructions assume you have requested a ‘Elastic IP’ address and associated it with your new EC2
(I’m not putting in blow by blow instructions for creating an EC2 as the Amazon AWS site is as easy as their shopping one, kick me if you need full instructions )
Once you have your EC2 instance up you will need to connect to it via SSH for the Linux and Mac boys this is easy, you can just open up a terminal, for windows peasants I would recommend putty, use the command below remembering to have your pem (the security file you created when you make the EC2) file in the same directory as the one your are running the command from.
Now you are on the server we want to install Apache and php, this is dead easy
Next we will be installing Dropbox with the following command ( note: that this is for the 32 bit version )
Next, start the Dropbox daemon which will try and run drop box on the server
If you’re running Dropbox on your server for the first time, you will be asked to copy a link into a browser, do this and when asked to log into your new Dropbox account,
While you’re there create a folder in your Dropbox that you are going to store the site in, in this example mine will be called “XXXXX”
you will see that a folder called ‘Dropbox’ will be created in your server’s (or more precisely the ‘ec2-user’) home directory.
(by the way I had to do a ctrl-c to get my prompt back so I could carry on)
Now we need a cool little package called Dropbox.py, this is the Dropbox command line tool.
(we are storing it in our home directory root, so when you are calling it, you will either have to be in your home directory or reference it as ~/dropbox.py)
Now we’re going to add a symbolic link. This links our Dropbox folder to our web root. first run this command to stop drop box
This should give you the message ‘Dropbox daemon stopped’.
Now Link the Apache www root to your new website directory on Dropbox
Next you will have to change some security rights so that drop box can write to these directories
and restart Dropbox
you will now find that the contents of the www directory is appearing in your Dropbox folder. 🙂
you should see 4 folders , ‘cgi-bin’ , ‘error’ , ‘icons’ and ‘html’
extract the contents of your Statamic zip download into the ‘html’ directory
that should be it really and you should just be able to go to the IP address and see the default Statamic website, but I got a odd error message regarding default date formats when I tried it.
to fix this we need to set a timezone in your php.ini file, edit your php.ini file like this
find the “data.timezone” by typing
It will most likly be like this
I changed mine to
To update a file in VI, press “I” to go to edit mode, change the text, then press the escape key to move out of edit mode and “:x” to save and exit.
vi is a bit of a pain to use, you can find a nice reference [here](http://www.lagmonster.org/docs/vi.html)
That should be it, Statamic should work fine and you should be able to see the default website and update it via Dropbox.
##### Extra Notes
If you want to use the online content manager for Statamic you will need to set the following security so that it can write to directories
and finally you want the Dropbox daemon to restart if the server gets restarted
This will give you a blank text file in vi (see above on how to navigate in vi)
add the following line and save
kick me if anything is unclear.