February 20, 2014

Problem statement

What do you need to enjoy web-development with Drupal? You need a comfortable workspace to make all your ideas come true! Let’s come up with some criteria of a perfect workspace that would fit any web developer:

1. You shouldn’t be limited by your operational system

I’m sure, anyone would agree that Unix-based systems are the best for web-developers. Configuring web-server, using utilities like code sniffer, phing, jenkins and many, many others has to be easy! And it is on a unix-based system like ubuntu. But many of us like windows that has photoshop, for example. We will solve that problem and make all OS work together to help you and not to limit you.
1_work_together.png

2. Your development website has to be fast

You’re not a system administrator and you prerfer to use all-in-one web-server solutions like openserver, xampp and denwer. But they are extremely slow. Even new just installed Drupal website would be slow! No problem, you don’t have to be a guru to have the best speed server. We will show you.

3. Production and development/testing environments have to be similar

You know how painful it is when your application fails to run on production though it worked great on your local pc and passed all the tests. We will make all environments similar. Even if there are too many of them. Let’s solve it.

To solve all stated problems we will use following technologies/utilites

1. Virtualbox. Yes, virtual machines are what you need. You might have used one of them before, at least you heard about them. Now we will use it really tight. Download and install it.

2_virtual_box_installation.png

2. Vagrant + Chef. This is the core of the solution. Vagrant allows you to create and manipulate as many virtualboxes as you need with simple commands. Chef configures your virtual machine according to predefined cookbooks. There are really a lot of cookbooks in the web, so you don’t have to be an experienced web developer to install linux + nginx + mysql + php. It’s all there, in cookbooks. You only need to include appropriate cookbooks to your vagrant configuration file.

Download and install vagrant (chef will be there)

3_vagrant_installation.png

3. Now we are ready to run our first virtual box. To make it easier for you just download ADCI Solutions pre-configured vagrant repo

4_repo_page.png

Then you should run your OS command line and run ‘vagrant up’ command inside vagrant repo folder.

5_command_line.png

Now you have a virtual machine with:

  • Ubuntu 13.04
  • Configured Nginx + mysql + php server
  • Git, drush, phing and CodeSniffer installed
  • If you need anything else, just find an appropriate cookbook and use it!

And yes, you can use the same Chef configuration for production environment. Don’t forget to show it to your testers too.

Let’s run the website now!

You can log in to your virtual machine by ssh using ‘vagrant ssh’ command inside vagrand repo folder.

If you prefer to use another ssh client, you can get the ssh connection data with 'vagrant ssh-config' command.

Now place your site to /var/www/site/project directory (as example, we have placed there index.php file with ‘<?php phpinfo(); ?>’ line) and run 127.0.0.1:4567 in your browser inside host OS. You should see your website now (if not, try ‘sudo service nginx restart’ inside virtual machine to be sure your server is running’).

6_index_php.png
7_website_working.png

The only problem now is accessing website files inside host OS. To do that you can use vagrant Synced Folders or use sftp net drive (here is a client for windows).

pic.png

That’s it. After running and configuring sftp you’ll be able to access your files in a dedicated drive. So you can develop on host OS with any IDE you like though it will be run on virtual machine. And now you have that powerful linux command line and tools which make everyting work like a charm.

Good luck and enjoy your advanced dream workspace!

Was this article helpful? Click to rate: 
Average: 5 (1 vote)

You may also like

Table of contents Preface Security principles Key security objects...
Over the past few years, e-commerce has transformed how people buy...
A year ago Dries Buytaert told that those are the content authors and...