Quantcast
Channel: chrismar.sh
Viewing all articles
Browse latest Browse all 12

How I used Linode + Dropbox to code smarter

$
0
0

I use lots of different computers: my work desktop, my lovely new MacBook Pro, a desktop in our study at home, and my iPad. I use Dropbox to sync files between them all, and really like the flexibility of using different systems.

However, until now I didn’t have a simple way to push things live, especially from my iPad. I’ve used PHPFog for a couple of projects, which work from a Git repository – any changes pushed to the repo are uploaded to the live site.

That works well on my desktops and laptop, but none of the development environments for the iPad support Git yet. So I’ve been looking for a solution that allows me to code on any machine from the Dropbox files, and then push the changes to a live host.

Hosting

I’ve had a varied experience of hosting, from really basic hosting with 123-reg, to a fairly expensive but user-friendly VPS with Webfusion. I’ve also got experience of using XAMPP on my Windows machines and the inbuilt server on Mac OSX.

After looking at a few different options, the one that seemed to offer the most flexibility was Linode. It allows you to run the server yourself, giving you your own Virtual Server. And it’s pretty cheap too: $20 a month for 512MB RAM, 20GB storage amd 200GB transfer, plus $5 for backups, with a 10% discount if you pay for 12 months.

What’s more, it’s extensible. None of the sites I run get huge traffic, but if I found that I was over my limits, I can simply upgrade my plan and in 15 minutes the new limits would be in place.

And even with my pretty basic grasp of Linux (and the excellent setup instructions on the Linode site), I got my LAMP stack up and running in no time, fully secured and ready to go.

Installing Dropbox

So I wanted an easy way to upload my files to the server. What better way than Dropbox? I already use it to synchronise all my files, including personal web projects, so I use the Dropbox install instructions, excluded a few folders that it wasn’t worth syncing, using the CLI script from the same site, and I was ready to go.

Setting up virtual hosts

I set up a virtual host for www.chris5marsh.co.uk, a domain name that I own but have done nothing with, and also for dev.chris5marsh.co.uk. I made sure that the folder structure mirrored that in my Dropbox folder – in my case, its …/chris5marsh.co.uk/dev and …/chris5marsh.co.uk/public – so that I would be able to copy files over from the Dropbox directory easily.

Writing commands

After a bit of searching, I decided to use rsync to copy the files from the Dropbox directory to the virtual host’s directory. I set up a function called stage, that would take a single argument, the directory to sync. It would then rsync the files from that directory’s dev folder to the virtual host’s dev folder.

I wrote a similar function called publish for setting code live, and one called backup to copy logs and backup files back to my Dropbox.

Work fom anywhere

It’s still early days, but I like the simplicity of being able to work locally on a site (and, if I’m on my Windows machines or MacBook Pro, test in a locally running server) and then, when I’m ready to set the changes to a dev or live machine, simply to SSH in to my Linode and type stage chris5marsh.co.uk or publish chris5marsh.co.uk to set the code live.

I also like the flexibility of being able to manually change the settings on the server without going through the cumbersome front-end of Plesk or cPanel (I’m a CLI convert!), and although I’m still earning, there are a lot of great resources out there.

I’m sure my workflow process will change over the coming days and weeks, but for running small projects in a flexible way, and upping my geek quotient at the same time, Linode + Dropbox works really well! I’ll be migrating some projects over in the next couple of weeks (including this site), and will update this post as and when I figure out new ways to make my life easier.

Do you have any advice for making my workflow better? What do you do to simplify your life? Let me know in the comments!

The post How I used Linode + Dropbox to code smarter appeared first on chrismar.sh.


Viewing all articles
Browse latest Browse all 12

Trending Articles