Development using Roots

Despite the goal of having your dev/prod environments exactly the same, it’s never going to happen completely. SSL is one of those things.

Our Vagrant setup is completely customizable but that’s up to someone on their own. Yeah, Apache is still really popular but we can only provide a setup that we’re familiar with using.

Thanks. I’d be interested to know how people manage the different environments. I’m starting out on this different set up and I’d be interested to know how you get round potential issues.

Totally understand you will only be able to provide help with the set up you are familiar with, but I assume it wouldn’t be too hard to switch nginx for Apache?

Thanks, Scott! Good to know I’m not the only one who found this to be a challenge. Looking forward to your post about Composer.

I just instaled Vagrant. Big problems on Windows7. Not with program itself but when you download first box it takes time, for me 40min. And near the and it broke (three times). When I switch to Ubuntu it was better (even download was 4 time faster ???). But install instruction are wery poor. How hard is to tell people what to do before installation and how instalation process look like. They wanted to look simple, just install and UP, thats it. But in real life, with real people that isnt case. When I started instalation Vagrant tells you to remove Virtual-Box. Later it tells you to install it. This must be in instalation instructions. Its only few lines more of text. Did not help that I first downloaded 32 bit version and missed couple of librarys.
But when it start working its miracle to see virtual web server up with 5 lines of text and one script (example from site).

Beanstalk App really helped me out with version control and deploy.

git add -A
git commit -m "some text here"
git push beanstalk master

All done, I just go to beanstalk and click a button to deploy to my SFTP Server.

Maybe you want to give it a try.

I am starting to get my head round things, and wondering if anyone could tell me if I am on the right track?

I’m not going to even start getting my head round tools such as Puppet and Beanstalk- just one step at a time for me.

I’ve started using the Windows GitGub app and love it- works really well. I’ve started to understand Commits and been using it for an app I am developing.

As I said above, I use Windows, but I love the idea of running a Linux machine using VirtualBox. The problem is, I am not an expert in getting a server up and running. I then started looking in to what Vagrant was- and it seemed from what I was reading that this might well be what I am looking for. Am I right in saying that Vagrant builds a Virtual Machine with all the bits you need to test locally?

Ideally I would be mirroring the conditions of my web server which is Apache and suPHP. Can I get Vagrant to install Apache and a particular version of PHP? My host uses suPHP which does make a few differences, so ideally I’d have it running in the same way. Is this possible? How about other configurations to do with Apache or PHP?

I have quite a few websites that I maintain for different clients on our main web server- in fact there are over 50 of them. Does Vagrant allow more than one website or project on one machine? If so, how does that work?

I’ve watched the screencast by @swalkinshaw (thanks- very helpful) and I think I understand what composer does a little more. I think I will have to watch it a few more times though! Composer helps you manage “dependencies” which in this case could be Bootstrap, Roots, plugins and other tools for a project. It allows you to upgrade to the latest version or roll back fairly easily.

Grunt seems to be an automation tool to help you build the website for production (or testing). I am assuming that it is used for compiling the less files? Does it do anything else?

Of course the next stage is pushing the website on to the development or production server. Currently this is something I constantly do using FTP, but I think this is where a tool such as Capistrano comes in. No idea what it does or how it does it, but am I kind of right here?

I’ll get there, just might take me a few more years! :wink:

That’s the right attitude to have @iagdotme. It’s all about learning and improving which never stops.

Using the GitHub app is a great start.

Vagrant: yes, it helps you build a Virtual Machine and automates it a little. You have 2 options with Vagrant:

  1. Start with a bare base box like Ubuntu 12.04 and then install everything yourself.
  2. Try and a base box already configured how you want it (Some here: http://www.vagrantbox.es/)

So yes it’s possible to get a virtual machine with Apache and suPHP going but if someone hasn’t already created/shared one, you have to do that on your own.

Since Vagrant is specifically meant for development environments, it’s usually best to have 1 box per project. You include a Vagrantfile (http://docs.vagrantup.com/v2/vagrantfile/index.html) in your project’s repository. Then whenever you go to work on a new project, you just do vagrant up. It keeps everything nice and separated (of course you’d probably want to shutdown each VM when you’re done with it so you don’t have 50 VMs running at once).

Grunt: it’s simply a task runner which is great for automation. Grunt has a massive list of plugins http://gruntjs.com/plugins. You can browse through those to get an idea of what it does. It’s most popular for compiling things, concatenating files, minifying, etc. You could use it to optimize all your images in a project for example.

1 Like

Thanks, Scott. For the time being, I’m going to start with Git and Grunt. I’ve got Grunt & Git working on Windows. I’ve also managed to get shared folders working on Ubuntu on VirtualBox. I’ll leave Vagrant until the blog post is out.

1 Like

Today I started my first project with Grunt in Roots. So easy! Run Grunt Watch one time and you are done.

You are right @iagdotme I am too wont to introduce git first. I have three pools to roots but stil do not know how it works, or I am not shure how it works.

Using the Grunt script ended up being a lot easier than I thought. Are you using Windows, Linux or a Mac?

I transfer all development to ubuntu because I have troubles on Windows. Till this year I was exclusevly xammp-nootepadpp-windows developer. Then I get sick with troubles with it and transfer my self to lamp-sublimetext-ubuntu. Thruth is that there was no so much troubles on win but thay occured in absolutly wrong moments. I plan migration for long time but never done it, till now. My trouble is that I do not have ssh with provider so I stick all development to local and only ftp (or sftp) it to site. Has limitation, eg. can not test facebook plugins localy or caches but my provider is very slow for admins (I think for purpose) so if I can do it it will be very hard and boring.
For a grunt part, for now, I just type grunt and that it is. Truthfully, again, made me looking in to .less files and discovering more of roots theme, (bootstrap part).

Now I saw your later post. In my opinion VirtualBox is wrong way to learn OS. Because it enable you to switch between OSs whenever “hard times” comes, when you dont know how to do something. If you want to learn faster stick to one OS and found your way. And, may the force (of internet) be with you.

I’m still in the cowboy coding camp unfortunately, but I’ve been taking my time and reading up on git for the past few weeks. I’ve found the greatest difficulty in establishing a workflow model that works for me, since I’m nearly always the only coder on my projects.

I actually came across what looks to be a really great playlist on Youtube: http://www.youtube.com/playlist?list=PLmw3IgYjTuTZazmvA0RcLaeHh-ykTEEzr for a WordPress + git + Bitbucket workflow. I’m still working through it and trying to fully understand each step before weaving Roots and Grunt into the mix but it looks promising and it’s a very nice introduction to DVCS and WP.

Enjoy!

I can’t comment on the quality of those videos but going from the titles it looks like a great introduction. Learning proper development practices will definitely be worthwhile. Cowboy coding can be fun at times but sooner or later it will catch up with you.

Agree with @ctx. Watch same playlist and must say that help me, more then some others. Maybe its women “touch”.

I’m following the videos and finding them useful.

When she gets to video 5 and clones the theme repo, then deletes the .git folder and .gitignore, DO NOT delete .gitignore. If you do, you’ll be keeping the node_modules directory in your repo, adds 1800 files to the repo that are only for development tools. Lesson learned. @_@

I’m actually not sure why she deletes any of the git files. Won’t those come in handy when it comes time to upgrade the theme? Confused…

@iagdotme, i’m glad you brought this topic up, as i too am currently trying to improve my workflow (also using Dreamweaver using code view). I am a lone freelancer, so up until this point didn’t really see the need for Git etc, as i am the only one dealing with the code. When the new Roots website came online, i started looking into Git, Grunt, etc and have already improved my workflow:

Created a local roots repository
learned a few git commands on how to copy and rename to my current project (usually the website name)
use grunt watch to compile my code on save
I use the following Dreamweaver extension to utilise LESS - http://www.dmxzone.com/go/21528/dmxzone-less-css-compiler

I too currently use Dreamweaver to push to ftp, but am investigating better ways to do this, such as has been mentioned in the above posts. I would be interested to hear how you go, and i will also update as i learn new ways of doing things.

I did think of using git-ftp (https://github.com/git-ftp/git-ftp), but it looks to be a bit of a pain on windows and i still need to incorporate version control.

@cfx, thanks for the video links- am going through them now. I like that Bitbucket has free private repositories, as that was what concerned me about git.

I’ve used git-ftp for deployment, it’s pretty good. But more recently I’ve moved to using grunt as it does staging and production servers really nicely.

Instructions in the bottom of this post: http://mattbanks.me/grunt-wordpress-development-deployments/

I’m interested in seeing what capistrano can do though.