Virtualization
Too bloated and hard to use in practice :(
$ git clone git://myrepo
$ [some magic command]
$ [or maybe another command]
// now you get an isolated environment to make something big
Using virtualization to share the environment, but easy to use!
$ vagrant init ubuntu/trusty64
$ vagrant up
$ vim Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_url = 'http://box.hosts.com/trusty64.box'
end
$ vagrant ssh
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-44-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Fri Apr 17 11:27:38 UTC 2015
System load: 0.44 Processes: 87
Usage of /: 5.5% of 39.34GB Users logged in: 0
Memory usage: 12% IP address for eth0: 10.0.2.15
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Last login: Thu Mar 26 15:02:03 2015 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$
$ vagrant up
...
$ vagrant ssh
...
vagrant@precise32:~$ ls /vagrant
Vagrantfile
vagrant@precise32:~$ touch /vagrant/foo
vagrant@precise32:~$ exit
$ ls
foo Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 4567, guest: 80
end
$ vim bootstrap.sh
#!/usr/bin/env bash
apt-get update
apt-get install -y apache2
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
$ vi Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
end
$ vagrant suspend
// save the current running state of the machine and stop it
// run `vagrant up` to resume
$ vagrant halt
// shutdown and poweroff the vm
$ vagrant destory
// delete the vm from your computer
$ git clone git://...
$ vagrant up
$ vagrant ssh
(new environment in vm)
$ gulp
// run gulp to auto build your website