Setup a dev environment for Gitlab.
The final product contain all databases set up, working tests and all gems installed.
- VirtualBox
- Vagrant
- the NFS packages. Already there if you are using Mac OS, and not necessary if you are using Windows.
- some patience :)
Clone the repository:
$ git clone https://github.com/gitlabhq/gitlab-vagrant-vm
$ cd gitlab-vagrant-vm
And install gems and chef's necessary packages:
$ bundle install
$ bundle exec librarian-chef install
Finally, you should be able to use:
$ vagrant up
You'll be asked for your password to set up NFS shares.
Once everything is done you can log into the virtual machine to run tests:
$ vagrant ssh
$ cd /vagrant/gitlabhq/
$ bundle exec rake gitlab:test
You should also configure your own remote since by default it's going to grab gitlab's master branch.
$ git remote add mine git://github.com/me/gitlabhq.git
$ # or if you prefer set up your origin as your own repository
$ git remote set-url origin git://github.com/me/gitlabhq.git
When done just log out with ^D
and suspend the virtual machine
$ vagrant suspend
then, resume to hack again
$ vagrant resume
Run
$ vagrant halt
to shutdown the virtual machine, and
$ vagrant up
to boot it again.
You can find out the state of a virtual machine anytime by invoking
$ vagrant status
Finally, to completely wipe the virtual machine from the disk destroying all its contents:
$ vagrant destroy # DANGER: all is gone
- Virtual Machine IP: 192.168.3.14
- User/password: vagrant/vagrant
- MySQL user/password: vagrant/Vagrant
- MySQL root password: nonrandompasswordsaregreattoo
- Xvfb is used as a service and it should be already running, but in case you need to restart it manually:
$ sudo /etc/init.d/xvfb stop
$ sudo /etc/init.d/xvfb start
Stacktrace of this failure can be found in this gist . This is caused by an error in rvm which causes chef-rvm cookbook to fail. This problem should be fixed with rvm version 1.16.18. Temporary solution for this is provided in this commit. In cookbooks/rvm/libraries/chef_rvm_ruby_helpers.rb change the line 41 to
@installed_rubies = @rvm_env.list_strings.reject {|e| e == 'nil'}
and run vagrant up again to complete the installation.