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.