Skip to content

Commit e95e7d7

Browse files
committed
complete revamp
This is a complete revamp of the virtual machine. Notable changes: * Based on Ubuntu 14.04. * Brightbox packages for Ruby. * Shell provisioning. After dealing with Puppet for some time, with modules for apt, concat, mysql, postgres, ruby, stdlib, and what not, I had enough. This VM is designed for Rails core contributors and we do not need to learn a DSL that runs across distros and it is idempotent. It is better for this particular virtual machine to have one simple bootstrapping shell script that is procedural and anyone can understand and maintain. Support for VMware and Parallels has been removed because I cannot test the new Vagrantfile in these providers. If you really care about them for Rails **core** development please send a PR to restore them with the updated configuration. (Rails application development is not relevant for this VM, please do not send changes motivated by that use case.)
1 parent fdf0973 commit e95e7d7

File tree

598 files changed

+69
-32682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

598 files changed

+69
-32682
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## Introduction
44

5-
This project automates the setup of a development environment for working on Ruby on Rails itself. Use this virtual machine to work on a pull request with everything ready to hack and run the test suites.
5+
**Please note this VM is not designed for Rails application development, only Rails core development.**
66

7-
**Please note this virtual machine is not designed to be used for Rails application development.**
7+
This project automates the setup of a development environment for working on Ruby on Rails itself. Use this virtual machine to work on a pull request with everything ready to hack and run the test suites.
88

99
## Requirements
1010

11-
* [VirtualBox](https://www.virtualbox.org) or [VMWare Fusion](http://www.vmware.com/products/fusion) or [Parallels Desktop](http://www.parallels.com/products/desktop/)(need Vagrant 1.5+, see [vagrant-parallels](http://parallels.github.io/vagrant-parallels/docs/installation/index.html))
11+
* [VirtualBox](https://www.virtualbox.org)
1212

13-
* [Vagrant 1.1+](http://vagrantup.com) (not a Ruby gem)
13+
* [Vagrant](http://vagrantup.com)
1414

1515
## How To Build The Virtual Machine
1616

@@ -22,39 +22,39 @@ Building the virtual machine is this easy:
2222

2323
That's it.
2424

25-
(If you want to use VMWare Fusion instead of VirtualBox, write `vagrant up --provider=vmware_fusion` instead of `vagrant up` when building the VM for the first time. After that, Vagrant will remember your provider choice, and you won't need to include the `provider` flag again.)
26-
27-
(If you want to use Parallels Desktop instead of VirtualBox, you need Vagrant 1.5+, and write `vagrant up --provider=parallels` instead of `vagrant up` when building the VM for the first time. After that, Vagrant will remember your provider choice, and you won't need to include the `provider` flag again.)
28-
29-
If the base box is not present that command fetches it first. The setup itself takes about 3 minutes in my MacBook Air. After the installation has finished, you can access the virtual machine with
25+
After the installation has finished, you can access the virtual machine with
3026

3127
host $ vagrant ssh
32-
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
28+
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-36-generic i686)
3329
...
3430
vagrant@rails-dev-box:~$
3531

3632
Port 3000 in the host computer is forwarded to port 3000 in the virtual machine. Thus, applications running in the virtual machine can be accessed via localhost:3000 in the host computer.
3733

3834
## What's In The Box
3935

40-
* Git
36+
* Development tools
4137

42-
* RVM
38+
* Git
4339

44-
* Ruby 2.1.1 (binary RVM install)
40+
* Ruby 2.1
4541

4642
* Bundler
4743

4844
* SQLite3, MySQL, and Postgres
4945

50-
* System dependencies for nokogiri, sqlite3, mysql, mysql2, and pg
51-
5246
* Databases and users needed to run the Active Record test suite
5347

54-
* Node.js for the asset pipeline
48+
* System dependencies for nokogiri, sqlite3, mysql, mysql2, and pg
5549

5650
* Memcached
5751

52+
* Redis
53+
54+
* RabbitMQ
55+
56+
* An ExecJS runtime
57+
5858
## Recommended Workflow
5959

6060
The recommended workflow is

Vagrantfile

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
# -*- mode: ruby -*-
22
# vi: set ft=ruby :
33
Vagrant.configure('2') do |config|
4-
config.vm.box = 'precise32'
5-
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
4+
config.vm.box = 'ubuntu/trusty32'
65
config.vm.hostname = 'rails-dev-box'
76

8-
config.vm.provider 'vmware_fusion' do |v, override|
9-
override.vm.box = 'precise64'
10-
override.vm.box_url = 'http://files.vagrantup.com/precise64_vmware.box'
11-
end
12-
13-
config.vm.provider 'parallels' do |v, override|
14-
override.vm.box = 'parallels/ubuntu-12.04'
15-
override.vm.box_url = 'https://vagrantcloud.com/parallels/ubuntu-12.04'
16-
17-
# Can be running at background, see https://github.com/Parallels/vagrant-parallels/issues/39
18-
v.customize ['set', :id, '--on-window-close', 'keep-running']
19-
end
20-
217
config.vm.network :forwarded_port, guest: 3000, host: 3000
228

23-
config.vm.provision :puppet do |puppet|
24-
puppet.manifests_path = 'puppet/manifests'
25-
puppet.module_path = 'puppet/modules'
26-
end
9+
config.vm.provision :shell, path: 'bootstrap.sh', keep_color: true
2710
end

bootstrap.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# The ouput of all these installation steps is noisy. With this utility
2+
# the progress report is nice and concise.
3+
function install {
4+
echo installing $1
5+
shift
6+
apt-get -y install "$@" >/dev/null 2>&1
7+
}
8+
9+
echo updating package information
10+
apt-add-repository -y ppa:brightbox/ruby-ng >/dev/null 2>&1
11+
apt-get -y update >/dev/null 2>&1
12+
13+
install 'development tools' build-essential
14+
15+
install Ruby ruby2.1 ruby2.1-dev
16+
update-alternatives --set ruby /usr/bin/ruby2.1 >/dev/null 2>&1
17+
update-alternatives --set gem /usr/bin/gem2.1 >/dev/null 2>&1
18+
19+
echo installing Bundler
20+
gem install bundler -N >/dev/null 2>&1
21+
22+
install Git git
23+
install SQLite sqlite3 libsqlite3-dev
24+
install memcached memcached
25+
install Redis redis-server
26+
install RabbitMQ rabbitmq-server
27+
28+
install PostgreSQL postgresql postgresql-contrib libpq-dev
29+
sudo -u postgres createuser --superuser vagrant
30+
sudo -u postgres createdb -O vagrant activerecord_unittest
31+
sudo -u postgres createdb -O vagrant activerecord_unittest2
32+
33+
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
34+
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
35+
install MySQL mysql-server libmysqlclient-dev
36+
mysql -uroot -proot <<SQL
37+
CREATE USER 'rails'@'localhost';
38+
CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
39+
CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
40+
GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
41+
GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
42+
GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to 'rails'@'localhost';
43+
SQL
44+
45+
install 'Nokogiri dependencies' libxml2 libxml2-dev libxslt1-dev
46+
install 'ExecJS runtime' nodejs
47+
48+
# Needed for docs generation.
49+
update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
50+
51+
echo 'all set, rock on!'

puppet/manifests/default.pp

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)