Setup a dev environment for Gitlab.
The final product contain all databases set up, working tests and all gems installed.
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
$ sudo /etc/init.d/xvfb stop
$ sudo /etc/init.d/xvfb start
The gitlabhq version is not updated when you rebuild your virtual machine with the following command:
$ vagrant destroy && vagrant up
You must update it yourself by going to the gitlabhq subdirectory in the gitlab-vagrant-vm repo and pulling the latest changes:
$ cd gitlabhq && git pull --ff origin master
A bit of background on why this is needed. When you run 'vagrant up' there is a checkout action in the recipe that points to the gitlabhq repo. You won't see any difference when running 'git status' in the gitlab-vagrant-vm repo because gitlabhq/ is in the .gitignore. You can update the gitlabhq repo yourself or remove the gitlabhq directory so the repo is checked out again.
install
on resource 'rvm_global_gem[bundler]' in chef when booting VMStacktrace 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.