Web Development. The next level

Each developer has their own preferences for the OS and tools which they use in the development. It's different for each developer. Someone uses Linux OS and installs each component separately (PHP + MySQL + Phpmyadmin). Someone is using Windows or Mac OS with turnkey solutions which are different for every OS platform.What does it lead to? Developers work on different environments of development and if they work as a team, this leads to some problems. Why do we begin to use virtual machines? Because each developer works with the same set of tools and on the same environment of development. It solves a lot of problems.

Vagrant

A vagrant is a turnkey tool for quick deployment and configuration of the virtual machine. As an emulator, you can use VMWare or VirtualBox (we use the second option).I think that many developers face the creation of virtual machines and know how much time this process takes. For this, it is necessary to create a virtual machine, configure it to load with the OS installation CD, run setup and wait for its completion. After this, you should install a specific set of development tools. Moreover, this virtual machine won’t work fast enough and will use too much RAM.

Vagrant allows avoiding large costs of deploying development environment. For creation a new virtual machine it is enough to run a single command if you already have a configured Vagrant profile:

vagrant up

This virtual machine won’t use too much RAM because it has no User Interface, only console.

Web Development. The next level 2

Together with the installation of the virtual machine all the necessary tools for the developer will be installed. We used Chef for this.

Сhef is a system configuration management server. It allows you to automate the process of configuring the server without having to do it manually. You can find cookbooks for Chef here.

There are a lot of ready cookbooks. Also, you can create own cookbooks. It is very simple if you know Ruby.

You can read how to install and configure Vagrant in the following article.

We created ADCI Solutions pre-configured Vagrant VM, you can download it from this repo:
https://github.com/ADCI/vagrant-vm

Phing

Web Development. The next level 3

Phing is a system to build projects. It allows you to automate most routine operations that developers face every day.

This is what you can do with phing:

  • run PHPUnit and SimpleTest tests;
  • make file operations (copy, delete, archive, upload);
  • perform SQL queries;
  • work with version control systems (git and svn);
  • run console commands and etc.

Command creation takes place in xml file. The command syntax is very simple. You can create small tasks and then combine them into one command. For example, before this we wrote three boring commands to upload our changes to the repository:

git add -A
git commit -m “Commit”
git push origin master

Now it is enough to write one command and your changes are already in the repository:

phing push “-Dm=Commit”

It's simple, isn’t it?

Usually, the process of development in our company is built as following: the developers work on the tasks locally and then upload their changes on a dev server. The dev server is available for customers, where they can see the process of developing and creating content, users, etc. A developer needs to have an up to date database that development is always relevant to. We use the backup_migrate module, it lets us do backups and restore databases from these backups. We spend some time on this. It is the best option, but sometimes it can be done only through Phpmyadmin which takes more developer’s time.

With phing it is enough to use two commands:

phing dump
phing db-restore

It is amazing to simplify the work process.

That might look like the process of creating a new workspace for the developer:

cd C:/Vagrant/
git clone https://github.com/ADCI/vagrant-vm.git new-project
cd new-project
vagrant up
vagrant provision
vagrant ssh
cd /var
mkdir www
cd www
git clone https://github.com/ADCI/drupal.git site
cd sitephing project-up

And the project is ready to use. The process of creating a new workspace takes very little time.Instead 

of a couple of hours, you will spend not more than 30 minutes.

With the combination of Vagrant + phing we get the following advantages:

Web Development. The next level 4
  • The same development environment for each developer in the team;
  • Equal working environment as on the live site;
  • We save time on creating development environments;
  • It’s very simple to add new developers to the project;
  • Spreading configuration changes of VM. Easy!;
  • Phing.
  • Linux console. Priceless.

No member of our team wants to return to the previous development process. This means that we are on the right way.

Migrate

We started to implement this approach of the development on one of our projects: all site settings, content, users are stored in a code. We use the following modules: Features, Strongarm, Node export, and Migrate for this. What benefits do we get? We can build the project at any time, for this we do not need a backup of a database.Since then we store all the settings of the site, content, and users in a code, then we store it in a repository git. Therefore we have the whole history of configuration changes of site, content, and can revert to any point. It also allows us to introduce a system of continuous integration, for example, Jenkins. It gets us rid of many routine tasks and provides focus on the development. Developers only work, everything else is done by Jenkins: building the project, checking code style, testing. If the project is built successfully and it doesn’t have errors during testing, this build can roll for a production server, Jenkins also makes it by himself. If during testing there are some mistakes, Jenkins notifies the developers. If after testing no errors are found, but the build has errors on the production server, you can always roll back to the previous project build.

You might also like

Why remote team?

IT-teams, both small and big ones, are on the front edge of all new trends. Telecommuting, virtual workspaces, collaborating over the seas and for the sake of particular gigs - we’ve all already been there