Dream Workspace

No time to read it now?

We will send a link to the article to your inbox

Read later

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 have to be easy! And it is on a unix-based system like Ubuntu. But many of us like windows that have photoshop, for example. We will solve that problem and make all OS work together to help you and not to limit you.

Dream Workspace 1

2. Your development website has to be fast

You’re not a system administrator and you prefer 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/utilities

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.

Dream Workspace 2

2. Vagrant + Chef. This is the core of the solution. Vagrant allows you to create and manipulate as many virtual boxes as you need with simple commands. Chef configures your virtual machine according to predefined cookbooks. There are really a lot of cookbooks on 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)

Dream Workspace 3

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

Dream Workspace 4

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

Dream Workspace 5

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 the 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 a virtual machine to be sure your server is running’).

Dream Workspace 6
Dream Workspace 7

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).

Dream Workspace 8

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

Good luck and enjoy your advanced dream workspace!

You might also like