Wednesday morning, six thirty am. The sky is a grey shade of blue, and the moon is glazed behind a blanket of cloud,. The orange glow of street lights hovers in the distance through a thin layer of mist sitting in the valley between two dew covered hills as your morning train zips through.
The train is empty, and you are lucky enough to have a table to yourself – perfect conditions.
Mobile internet is about as effective as sending your packet data via carrier pigeon
Pulling your laptop out of your rucksack, you decide to work on that piece of code you’ve been sinking your teeth in to and developing on your desktop. Optimistically you switch on your laptop and – disaster – you haven’t got the USB stick with the code on, and the mobile internet is about as effective as sending your packet data via carrier pigeon.
Frustrated you stare out of the window. Truly flying through the sticks now, all hope of connectivity flees you – and you consign yourself to coming up with something new, or writing blog posts.
This, my friends, has befallen me on plenty of occasions. When developing at home, or in an office, I like to use a desktop – benefiting from the horsepower and multi-screen setup. However often for a change of scenery, and not because I’m a pretentious hipster, I like to work in different environments to keep the creative juices flowing – whether this is in a coffee shop, library, train – the location itself isn’t important, it’s getting away from the same four walls that can make the difference.
How do I get round this limitation of storage and potential connectivity issues (therefore limiting my access to remote repos)?
A work flow change, and making good use of Dropboxes cloud storage.
First things first, if you haven’t got one, get a Dropbox account (from http://dropbox.com), you can use OneDrive or an alternative service, however I choose Dropbox for three reasons.
It’s a very mature service, and very secure – if you’re storing sensitive files, then it’s a good choice.
You can share files with other users, and therefore give visibility if required.
The desktop applications for Dropbox are multi platform, this is especially important for me at this point – because my Desktop is running Ubuntu 15.something, and my laptop is running Windows 10 (because I’m waiting for a window to migrate my data off).
Next, install the Dropbox desktop application.
In the local Dropbox folder, you’ll want to create a folder to hold your project(s) unless you want to place these in route, its personal preference at this stage. If you’re looking to host multiple languages or projects – pick a directory structure that suits your requirements.
PHP Specific Advice
This section is for you PHP programmers specifically, you’ll want to point your local web server at this location, using virtual hosts. I’ll add a blog post on this shortly, however it’s as simple as ensuring the conf/extra/httpd-vhosts.conf is included by httpd.conf, and following the documentation at http://httpd.apache.org/docs/2.4/vhosts/ to setup a new virtual host to point at the local Dropbox document route – again I’ll elaborate further in a separate blog post.
Next you will also want to install the Dropbox desktop application on the machine you want to sync files to, and enter the same credentials you entered on the original machine – so they are both pushing and pulling from the same account.
The beauty of this is that the Dropbox application synchronizes locally, so your system just sees the Dropbox folder as just a local folder, it doesn’t see a special folder that syncs to the cloud. As such you can use the folders in here as project folders, and use git with them. The syncing is all automatic, so all you need to do is remember to switch your second machine on and log in to your desktop account – and the automatic job will take care of the rest.
Now you can spend more time coding, less time fretting.
Words of warning
Obviously this won’t synchronise your databases, so you’ll still have to either mirror this or do a daily SQL dump. If I figure out a neat way of doing this – I’ll update this blog.