If you head over to our download page, you will get an option to download ERPNext in a Virtual Machine format. A Virtual Machine is essentially a self-contained virtual computer that runs on top of actual hardware.
VMs are a very quick way of being able to deploy a ready-to-use ERPNext instance. Previously we only had a single VM that was made manually at particular periods of time. Currently, we make three separate VMs. Production, Development and a Vagrant Box, that are created automatically on a daily basis. Here’s how it works:
We use Packer, a tool to create “images” using a set configuration. Think of an image like a photo in real life, it's something frozen in time. In our case, we want to make a Virtual Machine image.
Here’s how the images are made, we take a bare-bones Ubuntu 14.04 image and use that as the base. We point Packer to a JSON file with the configuration for the building process. The JSON contains data like, what kind of image we want to create (VirtualBox), what are the specs for the VirtualBox (RAM, CPUs, etc) and also the paths to Ansible scripts that will install Bench, ERPNext and Frappe along with scripts that do things like removing all empty space from the VM. Packer will take that Ubuntu image, boot it up and run all necessary scripts in order.
There are two separate configurations for the development and production VMs. According to the configuration, Packer and Ansible will install and configure things within the VM. The Production VMs come with the stable branch of ERPNext and Frappe (master) and the Development VMs come with the bleeding edge (develop) branch. They both are built differently with Production and Development setups accordingly. The development configuration has a “post-processor” that basically, turns the ERPNext Development VM into a Vagrant Box.
There is a crontab entry (think of it as a scheduler), that will run a python script every day at 23:00 server time. The python file will basically run the commands to build the images using Packer, move those files to the download directory, and then generate md5 hashes for the newly made image files.
A flow-chart of the entire process
All this magic happens on a single server, which is aptly named, The Build Server.
Note : A lot of the work was already done by @pratik, I then later picked up the project and wrapped it up.