Your 'awesome_sauce' Statamic system

TL;DR: What would be your ideal Statamic setup? What would your development environment look like, how would you stage and test updates before pushing to production? This could either be the setup you currently use, the setup you wish you were using (plus why you're not!), or just a fantasy!


I've been thrashing myself for the last 24 hours or so, trying to better my Statamic 'system'. I'll call it the 'system' as it covers environments, both development and production; how you deploy and the platforms and services that glue all these things together.

Initially I was using MAMP for my development environment, and a Digital Ocean droplet for each site I deployed. The VPS's were a custom built LAP stack that I setup specifically for Statamic using a very helpful guide from Abhishek (link) .

My deployment to each of these servers was using Gareth's revised method, all managed in Git (using Github).

Now, a number of things have driven me to re-evaluate the best way to go about this. I was coming across a few sticking points, that whilst not problems; niggled at me:

  • The cost and hassle of maintaining multiple VPS's had started to take it's toll. I set this up originally when I only had one site to serve, and no prospects of any more.
  • As I was using the regular MAMP, I was constantly switching root folders whenever I switched projects. It wasn't an issue when I had one client (me!), but now that this has become my business; it's just hassle!
  • As well as Gareth's deployment method works, it just wasn't doing it for me. It's fine for one or two sites, but I found I was constantly referencing my server I.P & SSH details, and jumping from box to box like a madman.
  • I had the sneeking suspicion that I was behind the times in my toolset. Fine when you're a hobbyist, not when building sites pays your bills.

The over-arching theme here, is that I outgrew the infrastructure I had created. In that case, what's the alternative?

Note: I'm approaching this as a designer/developer who just wants to build things, not spend their life creating infrastructure. If you are a 'DevOps', 'sysadmin' or anything of that ilk, you can probably disregard my findings as I'm sure you know of a better way (I'd encourage you to post it below!)

PaaS

We'll start here, as it's a relatively simple one for me to rule out. Platforms like Heroku, appfog, pagodabox, etc; provide a brilliant service, but not suited to small sites I feel. I've had a little play with a few PHP variants, and they seem simple enough, albeit a little alien to those of us with little experience beyond front-end work.

The reason I ruled them out is quite simple: they are just "too much". They are too expensive, too complicated and too powerful for Statamic. Of course you could run Statamic on any of these, however you'd have to deal with an unfamiliar setup, much higher costs than associated with providers like DigitalOcean or Linode; and Statamic (being feather-weight and flat-file) won't benefit from the way they scale.

They also leave me wondering where the hell I start setting up my local dev environment? Obviously something more advanced than MAMP is required to create the Buildpackages, but what?

You may disagree with me here, but Statamic is light and simple. That's why we use it. No point driving to the shops in a (PaaS) tank when your (LAP/LEP) bicycle will do.

Laravel

This is an interesting one. I love the idea of using the infrastructure around Laravel such as Forge and Homestead.

I will admit, I have little experience with Laravel; which may explain why I was confused about many of it's features. However, it's Forge and the Homestead environment that interested me. I felt that using Homestead (through Vagrant) as my local development environment and Forge as my deployment would be a beautifully simple "plug & play" setup; that also allowed me to use DigitalOcean to keep performance high, and costs low.

We'll start with Forge (as I was able to get this working!) It's a brilliant little system that uses your own VPS as the actual server, with the setup and install managed by Forge. This isn't too dissimilar to Serverpilot.io, but adds a few extra toys such as automatic deployment on git push.

However, after a bit of reading around, I decided I wanted Stag to manage my deployment. I'm all for purpose-built tools. If I'm not using most of Forge's features such as it's close integration with Laravel and it's 'git push' deployment; then really I'm wasting my $10 a month.

The icing on my Laravel cake was Homestead. I've never used Vagrant before, but trying the 'simple' setup of Homestead on my local computer made me think twice about Vagrant.

I got Vagrant to setup Ubuntu 14.04 VM boxes with ease, however the Homestead box refused to "up", getting stuck mid-process, locking up my computer everytime, requiring a hard restart to fix it.

I'm sure I must have been doing something wrong. However, I'm not convinced that Vagrant, VMs, etc are the solution to Statamic. I found my laptop always ran hot when a VM was running, was sluggish, and sucked up massive amount of precious SSD space. Again, even if I managed to get Homestead to work; I wonder whether it's more than I need with Statamic.

Docker / Dokku

I'll admit, I chickened out here. I like everything I hear about replicable environments, lighter weight that a true VM (less processor and RAM intensive too), and relatively current. However, it was just beyond me! I tried to dip my toe in the Docker waters, and found it a little hot for me.

Any advice getting Docker running, and how it integrates with Statamic would be appreciated.


Conclusion

There's probably many other solutions, but these were the main ones I considered.

In the end, I opted for an evolution of tried and tested options.

  • MAMP Pro - old faithful, but allows multiple roots to be configured. Despite what the internet proclaims about it being obsolete, outdated, expensive (vs opensource); I found it was the only option to allow me to setup multiple local environments simply and quickly.
  • Digital Ocean (running Serverpilot.io) - a much larger Ubuntu Droplet using Serverpilot to provision multiple "apps" (read: sites), with DO managing DNS, and Serverpilot managing domains.
  • Stag - This is a brilliant tool. All credit to Jamie and the guys working on Stag. If you're using Statamic, I whole-heartedly encourage you to work Stag into your workflow. Remember what I said about purpose built tools? This is what I'm talking about. Whatever solution I find in the future, Stag needs to be a part of it!
  • Gitlab - I addressed the issue of having my Statamic license keys viewable on Github in public repos (yes, I know!) by locking everything away in Gitlab. I've not spent enough time with it yet, but so far I like my code's (free & private) new home.

Notes for the future

Over time, I'd love to swap things like Codekit for Grunt (irrelevant here), Sublime Text for Vim (again, not relevant); and potentially dip my toe in the Docker waters once more and find a workable solution. However for the time being, my above setup works brilliantly!

So, any thoughts on the above? What would you do differently? How do you do Statamic deployment for a client environment?

This post (and the resulting comments) will probably end up as a larger post or reference article after a great deal of editing and reworking, so any help making this a more structured overview of the Statamic development, deployment & production options would be greatly appreciated.

>>>>>>> Unanswered <<<<<<<
35 Replies
12 Followers