New Discussion

Notifications

You’re not receiving notifications from this thread.

Using Vagrant for Rails Development Discussion

159
General

Trying to install the librarian-chef plugin first produces an error about not being able to find the vmware-workstation plugin (or rather gem). Installing the vbguest plugin first fixed the issue.

Thanks! I'll be sure to update that.

Carlo DiCelico Carlo DiCelico

Awesome post! I had a ton of trouble installing the plugins, though. In case anyone else has the same issue, where installing plugins fails and you see a bunch of stuff about nokogiri, let me save you some Googling. Just see https://github.com/mitchell... for the cure!

Ouch, that's kind of nasty. I hope they get that fixed soon. Thanks for sharing the link!

Nice and simple, great tutorial. Any idea how I can do this behind a proxy (that requires auth).... I live in a corporate environment :(

That's a good question. I would imagine you could set a system proxy on your OS and your network traffic would flow through there. Hopefully that would take care of routing all the downloads through there without having to configure a proxy inside the Vagrant guest machine too.

Joel Taylor Joel Taylor

Perhaps I'm missing something, but is there a reason you didn't include Rails in the Cheffile?

That's what Bundler is for. Your version of Rails is application specific, so you let Bundler manage it with your app's Gemfile.

I'm stuck at this part when I run 'vagrant up'. I'm on Windows Environment.. Help?

Is it actually causing you problems? I know the "stdin: is not a tty" seems to be more of a warning than an actual problem according to this https://github.com/mitchell...

I haven't run this on Windows yet however, so keep me posted if things don't work after finishing the tutorial. This is a very long thread but someone mentions the error and you might find a solution in here: https://github.com/mitchell...

Same error here, did you manage to solve it?

Anthony Candaele Anthony Candaele

I'm having the same issue, and I'm on a Mac X (Mavericks) environment. Not sure if it's doing something and if I should wait.

This is interesting. I use VMware's Workstation for my vm, but haven't tried these tools. So are you suggesting a different vm for each dev/production project, and this is the quick way to set up the environment for each? I've just been running a bunch of projects in one vm. Reasons I shouldn't do that?

This is going to setup a separate VM for each mainly for the purpose that everyone working on the project starts with a clean machine. If you don't run into any problems with your setup, you don't really need this. The trouble comes in when you need to share your machine setup with say 50 other developers. Then you need something like this so everyone can spin up a development environment without any trouble.

I have been trying to figure out how vagrant works for a few hours. Just bumped into your article. This was very helpful and well explained. Thanks! I will be modifying the Chef portion to use http://phlippers.net/chef-p..., but other than that it was spot on for me.

Thanks. Keep it up.

I failed at step first: setup vagrant plugins. Here is an error i get:

Thanks for wanting to use Vagrant! Unfortunately, this is not the way
to install Vagrant anymore. We now make installers for the various operating
systems Vagrant supports.
Vagrant is no longer distributed as a RubyGem. Please download the latest
version for your operating system from the URL below. If you still wish
to use the RubyGem version, you can manually install version 1.0.7. Note that
the RubyGem version hasn't been updated in over a year and will no longer
receive any updates.

Prior to installing Vagrant using the installer, make sure you uninstall
all your Vagrant gems, since they sometimes conflict.
http://www.vagrantup.com
If you want to learn more about why we don't distribute using RubyGems
anymore, please read this: http://mitchellh.com/abando...

Did you install Vagrant from the rubygem before? I linked to the installer and make sure you remove the Vagrant gem.

Nice article. Will you consider to add docker for this tutorials?

Most definitely!

So there's a nasty gotcha if you're using Windows 8.1, which I believe is tied to having installed the Windows Phone dev tools - this will enabled Hyper-V by default which will silently ruin any attempts you make to run a x64 VirtualBox VM, or so I've experienced. I just had SSH time out, and then a black screen when I attempted to boot with GUI.

This post details a way to get around that: https://www.hanselman.com/b...

Not ideal, I might see if I can get this to use a x86 machine instead, if possible, and be sure to test on a x64 before production.

If you don't actually do any WP development, you can alternatively uninstall the Hyper-V components from your system, and be problem free.

Thanks for posting this Chris. I got all the way to the end and when I run `rails server` I get this error:

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ rails server
The program 'rails' can be found in the following packages:
* ruby-railties-3.2
* ruby-railties-4.0
Ask your administrator to install one of them

I ran `rbenv rehash` and then tried `rails server` again and everything works!

One other thing I learned through working this post: I have vmware_fusion as a Vagrant provider plugin, so I need to specify virtualbox when I `vagrant up --provider=virtualbox`

Great article!

Thanks for the tips Dave! :)

isn't there a cart before the horse problem here? You can't run rails new projectname until you have rails installed?

Kartik Danidhariya Kartik Danidhariya

i get same problem i run rbenv rehash ant then tried 'rails server'
but it still return
The program 'rails' can be found in the following packages:
* ruby-railties-3.2
* ruby-railties-4.0
Ask your administrator to install one of them
pls help i am new for vagrant and ROR
Thanks in advance!!!

Daniil Garmoshka Kucherenko Daniil Garmoshka Kucherenko

# After vagrant installed & provisioned, run inside vm:

cd /vagrant

gem install bundler
gem install rails -v 4.2.1
rbenv rehash
bundle

Александр Пурхало Александр Пурхало

1. sudo gem install bundler
2. bundle
3. bin/rails server -b 0.0.0.0

This should help you to deal with this problem.

Gruff Davies Gruff Davies

I've added a port forward to my host 3306 to 23360 in the vagrant file so I can access MySQL using Toad. I had to manually grant `root`@`%` privileges in mysql in order for that to work. Can I chnage the chef.json to do that automatically?

I'm not sure if you can do that with the typical json. The database recipe should let you do that, but you'll likely need to write some calls to it instead of defining json. https://github.com/opscode-...

If this is your first time setting up rails with vagrant or you don't have any rails app, you need to installl rail gem 'gem install rails' and make rails executable 'rbenv rehash' before run 'rails server'. to check your rails is installed, run 'rails -v'

Gruff Davies Gruff Davies

One gotcha worth pointing out here that I got stung by: there's a bug in the current upgrade of Vagrant. Apparently several: https://www.vagrantup.com/b.... So if you're already using vagrant, it's best to uninstall it and install fresh which fixed things for me. I also upgraded VirtualBox but this was straightforward.

Camilo Rivera Camilo Rivera

Hi,

FYI, I was getting the following error this morning:

NoMethodError: mysql_service[default] (mysql::server line 20) had an error: NoMethodError: undefined method `sensitive' for Chef::Resource::Execute

Apparently, this bug was introduced with the latest version of the mysql cookbook (v5.5.4 as of today).

If this ever happens to anyone, you can just specify the previous version in the Cheffile as follows:

cookbook 'apt'
cookbook 'build-essential'
cookbook 'mysql', '5.5.3'
...
cookbook 'vim'

After this, I just entered the vagrant provision command and everything worked like a charm.

Cheers.

Awesome find! Thanks for sharing this.

Thanks, I just ran into this today!

Bishisht  Bhatta Bishisht Bhatta

This
vagrant plugin install vagrant-librarian-chef

fails on my machine. I have posted full details on stackoverflow(http://stackoverflow.com/qu...

hope to get some solution from you guys.

Anthony Candaele Anthony Candaele

I have a question about this line in the Vagrantfile:

mysql: {
server_root_password: ''
}

does this mean that this setup doesn't work with Postgres?

greetings,

Anthony

You'll have to swap the MySQL instructions with Postgres ones. This tells Chef how to setup a MySQL server inside the Vagrant box, so you'll need to do the same for Postgres. I'm not sure of all the differences off the top of my head but a quick google search for postgres + chef should find you exactly whaty ou need.

Anthony Candaele Anthony Candaele

I followed the instructions in this tutorial and everything ran successfully. Then I ran the 'vagrant up' and 'vagrant ssh' command. However, I don't seem to have a /vagrant directory. I have a .vagrant directory with in it a 'machines' directory.
Am I missing something?

Anthony Candaele Anthony Candaele

oops, seems I can cd into '/vagrant', it's all good.

Anthony Candaele Anthony Candaele

I just ran into an issue with Launchy, which won't open a page in the browser, when on a virtual machine:

Failure/Error: save_and_open_page
Launchy::CommandNotFoundError:
Unable to find a browser command. If this is unexpected, Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at https://github.com/copiousf...

not being able open a page in the browser when testing with Capybara is kind of a show stopper for me : (

You might check this out http://spin.atomicobject.co...

Kartik Danidhariya Kartik Danidhariya

my os is ubuntu 12.04 64 bit
i am successfully install Vagrant
After when i try to install virtual box using this
sudo dpkg -i virtualbox-4.3_4.3.20-96996~Ubuntu~precise_i386.deb
it gives following error

Selecting previously unselected package virtualbox-4.3:i386.
(Reading database ... 185893 files and directories currently installed.)
Unpacking virtualbox-4.3:i386 (from virtualbox-4.3_4.3.20-96996~Ubuntu~precise_i386.deb) ...
dpkg: dependency problems prevent configuration of virtualbox-4.3:i386:
virtualbox-4.3:i386 depends on libdevmapper1.02.1 (>= 2:1.02.20).
virtualbox-4.3:i386 depends on libpython2.7 (>= 2.7).
virtualbox-4.3:i386 depends on libvpx1 (>= 1.0.0).
virtualbox-4.3:i386 depends on psmisc.
dpkg: error processing virtualbox-4.3:i386 (--install):
dependency problems - leaving unconfigured
Processing triggers for ureadahead ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for shared-mime-info ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Errors were encountered while processing:
virtualbox-4.3:i386

how can i solve ,thanks in advance!!!

Kartik Danidhariya Kartik Danidhariya

when i give vagrant up it sows following error

==> default: Recipe Compile Error
==> default: ================================================================================
==> default:
==> default: Chef::Exceptions::RecipeNotFound
==> default: --------------------------------
==> default: could not find recipe server for cookbook mysql
==> default:
==> default: [2014-12-24T12:22:59+00:00] ERROR: Running exception handlers
==> default: [2014-12-24T12:22:59+00:00] ERROR: Exception handlers complete
==> default: [2014-12-24T12:22:59+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-12-24T12:22:59+00:00] ERROR: could not find recipe server for cookbook mysql
==> default: [2014-12-24T12:23:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

Pls help i am new for ROR and vagrant,
Thanks in advance!!!

I got a same errors like above error messages, but i can't find the solution.

Did you find a way to solve it?

..just in case someone, run into this error:

undefined method `rbenv_rehash' for #<chef::provider::package::rbenvrubygems:0x000000049c8340>

Here's the solution:
Change the 'rbenv' line in the Cheffile:

`
cookbook 'rbenv', git: 'https://github.com/RayMangu...
`

Explanation:

I'm new to rails too, and I thought it's a rbenv / chef related problem,

then I found this in Github:

https://github.com/RayMangu...

It seems the chef-rbenv is out of date. And, the newest fork is the RayMangum's one.

This is a good guide:-) But after I run `vagrant up`, I got these errors:

➜ MY_RAILS_PROJECT vagrant up
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/which.rb:32: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Installing Chef cookbooks with Librarian-Chef...
[default] Destroying VM and associated drives...
[default] Running cleanup tasks for 'chef_solo' provisioner...
/Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /Users/jingqiangzhang/.vagrant.d/gems/gems/librarian-chef-0.0.4/lib/librarian/chef/source/site.rb:353:in `block in http_get'

My ruby version is:

➜ MY_RAILS_PROJECT ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

You may want to try setting `config.ssh.forward_agent = true` in your Vagrantfile. I was unable to checkout anything from github via bundler without that. It may be related to the error you're seeing.

I am sad to get the same error. could you tell me how to solve it . ths!

...except Vagrant-librarian-chef doesn't work on Windows 7 (at least it didn't work for me) causing me to have to look elsewhere to get Rails up and running

vagrant-librarian-chef-nochef

I am getting to the point with the number of apps that I work on and the diversity of environments that I need to maintain that Brew and RVM alone no longer cut it. I was hoping that the combination of Vagrant, VirtualBox, Librarian, and Chef would be the answer, but I've been struggling with these steps over the last week to setup VMs for two different projects and I'm about ready to give up and look elsewhere.

The main issue is that I keep running into conflicts/errors in the Chef recipes. It took me the better part of 3 days to successfully provision a VM using this method with Postgres 8 and PostGIS 1.5. Granted those are both deprecated versions , but that's what I needed for one particular project that we maintain. You state towards the end of the article that I should be able to just run `vagrant provision` if I change the Vagrantfile or the Cheffile and it will reprovision the box, but it's been my experience that once I run `vagrant up` the Chef recipes won't run again until I destroy the VM and start over. If I try to reprovision it just tells me that the server is already setup and Chef never runs again. Since each fresh start takes anywhere from 45 minutes to an hour and a half, that all adds up when I have to keep starting over every time there's a new error.

In my last attempt I ran into a bug with Ubuntu 14 and Chef 12 (https://github.com/opscode/... that took me a while to figure out. Since there's no way (that I've found) to specify what version of Chef gets installed on the VM during provisioning, the only way around it was to downgrade to Ubuntu 12 instead.

And now I'm stuck trying to get the default MySQL recipe to run but it keeps telling me "You must supply a name when declaring a package resource", and I see no way to do that in the instructions for the MySQL cookbook.

I've never had much luck with Chef in general. I generally just need to setup very simple servers, and Chef seems like too much overhead for that task. The alternative of setting things up manually is just as tedious though, so I'm at a crossroads.

I should have RTFM as far as specifying a version of Chef to install on the server: https://docs.vagrantup.com/...

In case anyone else runs into the issues I kept running into:

Chef doesn't run again on `vagrant provision` if you install RVM. See https://github.com/opscode/... and https://github.com/opscode/... for possible fixes, or don't use RVM. If you do use RVM, you'll also need to figure out a way to get around the issue with RVM updates and PGP keys in subsequent provisioning runs, detailed at https://github.com/fnichol/....

For my MySQL problem, I had to code dive into the mysql recipe files to discover that the mysql cookbook is not configured to install the version of MySQL I needed on the version of Ubuntu I was using, so I had to downgrade Ubuntu yet again to 10.04. Frustrating that they wouldn't provide a table of supported installs.

It looks like nodejs-cookbook is deprecated, here's what the readme says:
Important notice: this repository has been deprecated and the development of the nodejs cookbook has been moved here: https://github.com/redguide...

If you do not need chef, this will work in 5 minutes ;)
https://github.com/rails/ra...
and it is, unlike this tutorial, up-to-date!

Thanks for sharing!

This is not for rails development, it's for developing rails itself.

I also had to specify a version for mysql, but after I did that it worked perfect.

When I use vagrant up, it puts me in the user directory "~", and I can run ruby -v and get the correct output. However, when I cd to /vagrant, and run ruby -v it says "rbenv: version `ruby-1.9.3-p551' is not installed". Why can't I use the ruby command outside of the user directory with this setup?

Finally a working cookbook for rbenv:

cookbook 'rbenv', git: 'https://github.com/john-tel...

Finally a working cookbook for rbenv:
cookbook 'rbenv', git: 'https://github.com/john-tel...

Łukasz Antkowiak Łukasz Antkowiak

why such tutorials always ends when the most important part begins? Am I supposed to install my dev tools on guest (it may not be full blown ide, I think that configured vim still counts), or still use it on my host? If tools still should be on host, how did you debug your app?

There is basically no difference in your workflow other than SSHing in for running the server. Like I mentioned, the folder is shared between the host and the VM guest. You have to install all the tools inside the VM to run the app, but since it's shared you can edit in either place. You debug your app exactly like normal through the terminal. It just happens to be inside SSH to the VM, but there is almost no difference.

Siddhartha Majji Siddhartha Majji

Hello there! after installing the bundler, I'm getting an error message that
"Bundler::GemfileNotFound"
thanks in advance!

Ryan Carter Ryan Carter

Chris, great tutorial. Thanks. Got me up and running quick. Question for you though. If I wanted to add java, git, nginx, and others, I would include their cookbook in Cheffile, then config in vagrantfile, correct?

Yeah that should do it. You can sometimes use the apt packages for those or if you want to customize the install (like get the latest version) then cookbooks usually make the most sense.

So do I have to run virtualbox and vagrant in production server as well?

Nope, this is mainly just to emulate production on your development machine.

Hi, everything works great except for bundler is not getting installed when the vm is provisioned. I navigate to my directory and then run bundle install and get this message:

The program 'bundle' is currently not installed. To run 'bundle' please ask your administrator to install the package 'bundler'

I modified the following from the Vagrantfile listed in this tutorial to use ruby 2.1.3 and added docker to pull and run redis:

# Install Ruby 2.1.3 and Bundler

# Set an empty root password for MySQL to make things simple

chef.json = {

rbenv: {

user_installs: [{

user: 'vagrant',

rubies: ["2.1.3"],

global: "2.1.3",

gems: {

"2.1.3" => [

{ name: "bundler" }

]

}

}]

},

mysql: {

server_root_password: ''

}

}

end

config.vm.provision "docker" do |d|

d.pull_images "redis"

d.run "redis"

end

end

-------------

Does anyone know why bundler isn't being installed and how to configure the vagrant file so that it does get installed? I've already tried rbenv rehash before running bundle install, and get the same "bundler not installed" message. This isn't the biggest issue, because I can run gem install bundler, but I'm attempting to automate the deployment process of our ruby dev environments as much as possible.. so finding the solution would be great!

Any help appreciated, thanks!

I ran into the same problem recently. Couldn't figure out what was wrong but maybe the gem had updated and it no longer recognized the option. You can install it manually and things work fine. Would love if someone finds a good solution for this.

I was getting this error no matter what ... "The program bundle is not currently installed". However, here is the combination that fixed it for me.
1. Locate the version of Bundler used in project I wanted to Vagrant
2. Downgraded Vagrant to match the version
3. Run rbenv rehash AFTER the bundler install
4. Bundle project and make money

Mincă Daniel Andrei Mincă Daniel Andrei

Mine loops through "Connection timeout...Retrying..."

Rovin Varshney Rovin Varshney

Thanks. Really helpful vagrant tutorial

Thanks for sharing this information. I have not come across this issue while working on Rail development. But i hope this blog will help the one who are looking for this information.I have bookmarked this Blog.

everytime I try to run bundle, it says "Could not locate Gemfile or .bundle/ directory"
I've already made sure bundler was installed and rails 4.2, since i know some people were having problems with that, any idea whats wrong?

nvm got it fixed, but still can't access the forwarded port

Carlton Smith III Carlton Smith III

How did you fix it?

Runy Calmera Runy Calmera

I'm getting this information when I put in the first comment. Is this still the way to use Vagrant with Ruby on Rails development?

:

Vagrant is no longer distributed as a RubyGem. Please download the latest

version for your operating system from the URL below. If you still wish

to use the RubyGem version, you can manually install version 1.0.7. Note that

the RubyGem version hasn't been updated in over a year and will no longer

receive any updates.

Prior to installing Vagrant using the installer, make sure you uninstall

all your Vagrant gems, since they sometimes conflict.

http://www.vagrantup.com

If you want to learn more about why we don't distribute using RubyGems

anymore, please read this: http://mitchellh.com/abando...

Sounds like you installed the vagrant rubygem before. You'll want to uninstall that and download it from vagrant's website instead.

Hi,

um just to be clear, the _code/landingpage_ folder is empty...?!

It is weird. When I ssh inti vagrant and run pwd I see `/home/vagrant` but when I run ls I don't see any files.If I run `ls /vagrant' I see all my files though that are being synced.

This boggled my mind for at least 4 or 5 hours.

If I `cd /vagrant` and `ls` I'll see all my files. But if I run `pwd` from there I am in `/vagrant`.

Is anyone else confused why vagrant would create a folder in my home folder `/home/vagrant` but actually sync with `/home`??

So happy now that I have figured this out!!! :D

Carlton Smith III Carlton Smith III

Do I need to have rails set up on my main machine also for this to work? Everything seems fine until I run 'bundle' and it says, "The program 'bundle' is currently not installed..." - I see that someone else has this issue as well, but I don't see a workable solution. I'm just wondering if this is happening because I don't have rails installed on my windows machine. I was hoping I could avoid doing that for this solution.

Carlton Smith III Carlton Smith III

I found the problem. I had installed the vagrant plugins on a previous attempt and didn't realize I needed to do it again. After installing the plugins again and provisioning everything worked as it should.

Excuse me, why yesterday with "bin/rails s" with webrick (and also Puma) I can open the localhost:3000 and today (with nothing changed) I can't and have to start with "bin/rails s -b 0.0.0.0" ???

Anyone?

Runy Calmera Runy Calmera

Hi thanks for the tutorial. I can't get bundle installed. I get this: Could not locate Gemfile or .bundle/ directory

Have anymore gotten this problem?

Runy

Runy Calmera Runy Calmera

What I don't understand is this. If I'm making an app called testapp and then also work on another app called testapp2. Do I need to go in the /vagrant directory and then put there rails new testapp and rails new testapp2? So do these rails apps go IN the vagrant folder?

My set up is as follows:

I created a folder called railsprojects
I did vagrant init from within this folder railsprojects.

I had NO rails apps installed in this folder.

So I went to this folder railsprojects
Then I did vagrant up
And then vagrant ssh.

And now I want to start creating rails apps. I have many rails apps to create and they all use the same virtual machine.

In which folder should I run the rails new testapp comment?

Many thanks.

Runy

German Mendoza German Mendoza

Where is my synced folder, I have created a project in vagrant, but I can not find in my local system, somebody help me please!!!.

It's /vagrant

German Mendoza German Mendoza

Thanks for information.

But I want create in my local host a url as

http://api.test.com

how can I do this?

I m getting error like these. May be i miss something?

The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.

If you're adding a box from HashiCorp's Atlas, make sure the box is
released.

Name: ubuntu/trusty64
Address: https://atlas.hashicorp.com...
Requested provider: ["vmware_desktop", "vmware_fusion", "vmware_workstation"]

Awesome tutorial!
Do the other developers on the same team who don't have Vagrant yet have to install plugins as well?

John Roberson John Roberson

Can someone please clarify what the Vagrantfile should look like if you wanted rails to be installed automatically on vagrant up? :-) Thanks for the tutorial btw! I've got it up and running. I just want to be able to automate it further for future use and still have a bit to learn about Chef and Vagrant.

C Lokesh Reddy C Lokesh Reddy

I followed the whole post and successfully configured everything. But when I've restarted the system and opened vagrant linux terminal in the folder and run following command 'cd /vagrant' & 'ls', I'm not able to see the files in the directory. It happened to me 3 times and every time I had to do all the process again copying all my progect files into other folder and all commands of vagrant, all updates of ubuntu and rails again every time. Someody please help why is the link between vagrant getting vanished once the system is restarted?

Fritz Rodriguez Jr. Fritz Rodriguez Jr.

Hey Chris! As always my man! Thanks for another great screencast. After going through the tutorial notes, I couldn't get the server up and running. Then I checked out the video and you mentioned using 'rails server -b 0.0.0.0' to start the rails server and it worked. Might want to include that in the documentation

Also, there is another resource I found that might be helpful... https://railsbox.io/

Take care and thanks again...Best!

Thanks for your guide! I am kinda stuck though!

1. Right after the installation of Vagrant and then VB, what is the next step? I just opened a cmd and went from there. Didn't know what else to do.

2. Since I am in Windows 7 x64 I am getting the "'touch' is not recognized as an internal or external command, operable program or batch file." message. Any workarounds ?

Thanks

Edit for anyone wondering.

1. I am using Cygwin with some extra plugins to implement commands like top, diff and a few others. It is the best option when working in Windows and want to do simple stuff.

2. Using Cygwin I can use the touch command.
However since "touch" is not availiable in windows, this tutorial should instuct the user to use this command. So if you are having trouble in this step of the tutorial, when instructed to "touch Cheffile" simply create a file at the specific folder you are working on and name it Cheffile.

Łukasz Siwiński Łukasz Siwiński

Thanks for this tutorial Chris. Works fine for me, but I've encountered 1 problem during `vagrant up` on my Windows 10 x64 Box:

%userprofile%/.vagrant.d/gems/gems/vagrant-vbguest-0.11.0/lib/vagrant-vbguest/download.rb:23:in `unlink': Permission denied @ unlink_internal - %userprofile%/.vagrant.d/tmp/VBoxGuestAdditions_5.0.10.iso (Errno::EACCES)

This post on stackoverflow help me to solve it http://stackoverflow.com/qu...

But I think that's just a "workaround" of some real problem that was reported here: https://github.com/refile/r... and here: https://openedx.atlassian.n... too.

I am getting the error "ERROR: You must specify at least one cookbook repo path". Will come back if I figure it out. The only changes I have made to Chris' code is making it Postgres instead of MySQL.

I hadn't run the line `vagrant plugin install vagrant-librarian-chef-nochef`. I have done that although now Chef installation takes so long I stopped it. 1hr + so I don't think that classifies for 'This can take a while.`

superiorpaper superiorpaper

This might really become useful and really helpful for them to have especially that people might need to know on how are they going to use some certain kind of tools that will surely guide them with their work or will going to help them in promoting something for their work.

Jorge Anzola Jorge Anzola

I'm getting this error after "vagrant up"

from C:/Users/JorgeAnzola/.vagrant.d/gems/gems/librarian-chef-nochef-0.2.0/lib/librarian/chef/source/site.rb:354:in `block in http_get'

folloewd by a bunch of code lines. Does any one knows how to solve it?

Rahmat Awalludin Rahmat Awalludin

when "vagrant plugin install vagrant-librarian-chef-nochef", i get error "Could not find gem 'vagrant-librarian-chef-nochefvagrant (>= 0) ruby' in any of the gem sources listed in your Gemfile or available on this machine."

Ryan R Wilkins Ryan R Wilkins

Even after I assign 0.0.0.0 I am still unable to get my localhost to work on chrome.

"This site can’t be reached

localhost refused to connect.
"

Make sure you use

chef.channel = "stable"

So you don't accidentally get an unstable build that doesn't work with your vagrant setup.

Following these instructions I've been hit with this error:

[2016-06-22T22:33:38+00:00] INFO: HTTP Request Returned 404 Not Found: Parent not found: chefzero://localhost:8889/nodes

The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect.

chef_server_url "chefzero://localhost:8889"

I'm very new to all this and not sure what would need changed to fix it?!

Any help/hand holding would be great!

I struggled with this for a while, finding multiple stack overflow and github issues saying to specify a version of specify the channel to be stable. Finally figured out I had missed this step. Hope it helps someone
vagrant plugin install vagrant-librarian-chef-nochef

How to change the Vagrantfile to install Ruby 2.3.1, which is not downloadable as a binary?

Since we're using rbenv, it should compile Ruby instead of downloading it as a binary. You should be able to change the version numbers, although I haven't tried it with 2.3.1 yet.

It's been awhile since this guide was posted. In an effort to help those that come across it, here's a link to a more modern Vagrantfile based off of this guide. Hope it helps.

https://github.com/realchri...

Also, the official Vagrant image for xenial64 doesn't include a 'vagrant' user. See https://bugs.launchpad.net/... for more info. There's a workaround in the Vagrantfile I linked to that references this bug.

Thanks Chris! I'm going to try updating the tutorial this weekend using your notes. It's been a while since I've updated this. 🤘

Тупорылые авторы статей - после
vagrant up

- пишет:

ubuntu@127.0.0.1's password:

и всё блять, какой блять пасворд? долбаебы напишут а людям непонятно. вы хоть проверяли ваш код перед тем как людям предоставлять.

Nice job. But if I change anything in Vagrant file (i.e. add docker, change default ruby version) I get this notice on subsequent
`vagrant up` commands.
==> default: Installing Chef cookbooks with Librarian-Chef...
==> default: The cookbook path '/Users/lacoste/dev/testvagrant/site-cookbooks' doesn't exist. Ignoring...
Same when I try to run `vagrant provision`. So it looks likes whatever chef is doing only works on initial provision, or am I missing something? Thanks!

Add a site-cookbooks folder to your directory

Gerald Nah Gerald Nah

HI there, im having this problem after running vagrant up.

Followed all steps from copying both Vagrant and Cheffile into the same directory

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `initialize': The requested address is not valid in its context. - connect(2) for "0.0.0.0" port 3000 (Errno::EADDRNOTAVAIL)
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `new'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:21:in `block in is_port_open?'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `block in catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in `timeout'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/util/is_port_open.rb:19:in `is_port_open?'

Hey I keep getting `NoMethodError: undefined method `include_default_source' for Custom resource ruby_rbenv_gem from cookbook ruby_rbenv`

Error executing action `install` on resource '[2.4.0::bundler (ubuntu)] (ubuntu)'

I don't use rbenv on my local machine. Does that matter for installing it on vb?

Ziyan Junaideen Ziyan Junaideen

For me it worked for 2.4.0 but not 2.2.7 which is a requirement for an old project of mine... any clue what caused it?

*** ALERT *** If you want a simple vagrant install that is Rails 5, ruby 2.4, and postgres. WITHOUT ansible or Cheffile. Listen here.
While this post was great at some point, it no longer is helpful without doing some troubleshooting. (This guide gave me outdated dependencies and errors that drove me nuts). Download the rails-dev-box and follow their simple instructions. The shell script file does everything without spitting 100's of lines of code. It just works.

Once again, not hating on this guide, I just found a much simpler one.

TLDR; https://github.com/rails/ra...

After I fire the command `vagrant provision`
I get this error

==> default: executable=/opt/chef/bin/chef-solo
==> default: Running handlers:
==> default: [2017-07-17T12:19:39+00:00] ERROR: Running exception handlers
==> default: Running handlers complete

==> default: [2017-07-17T12:19:39+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 0 resources updated in 01 seconds
==> default: [2017-07-17T12:19:39+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2017-07-17T12:19:39+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> default: [2017-07-17T12:19:39+00:00] ERROR: 412 "Precondition Failed"
==> default: [2017-07-17T12:19:39+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the

I m new to this vagrant, i googled it but was not able to get the right answer to this problem
pls help

Peter Blackledge Peter Blackledge

On Windows 10 I'm trying to install Rails on Vagrant on drive D:. After creating the Cheffile and Vagrantfile as directed, the 'vagrant up' command fails with error message: 'D:/vboxes/gems/2.3.4/gems/librarian-chef-nochef-0.2.0/lib/librarian/chef/source/site.rb:309:in `unpack_package!': The package archive has too many children! (RuntimeError)' followed by dozens more file and command errors.
There are a few online discussions - going back several years - about this 'too many children' Chef error. Some possible solutions are proposed, most beyond my technical know-how, and no definite resolution that I can see.
Can anyone point to a reliable answer?

same issue

I'm working through this now. https://github.com/applicat... Looks like this issue was closed long ago but has reemerged. Will try to come back with a fix if I figure it out... which I will probably forget to do once I have figured it out :P

I too have battled with this for ages, using vagrant et al on Ubuntu 17.10. Kept getting the "too many children" error. I discovered that many thought the problem was with "archive-tar-minitar" gem, which used to be true but has been fixed by giving Vagrant a new dependency on "minitar" instead - see here.  So that line of research proved fruitless, however, inspired by Chris' debugging adventures, I dug deeper. The error message located the problem at ~/.vagrant.d/gems/2.3.3/gems/librarian-chef-nochef-0.2.0/lib/librarian/chef/source/site.rb:309. So I had a look and found the following:
303             # Cookbook files, as pulled from Opscode Community Site API, are
304             # embedded in a subdirectory of the tarball. If created by git archive they
305             # can include the subfolder `pax_global_header`, which is ignored.
306             subtemps = temp.children
307             subtemps.empty? and raise "The package archive was empty!"
308             subtemps.delete_if{|pth| pth.to_s[/pax_global_header/]}
309             subtemps.size > 1 and raise "The package archive has too many children!"

I tracked down the first package to fail (system) and examined the value of subtemps to find that there was a second child subdirectory, but its name did not match the 'pax_global_header' string. It was 'PaxHeader'.
I added in a line to delete that..
308             subtemps.delete_if{|pth| pth.to_s[/pax_global_header/]}
309(new)        subtemps.delete_if{|pth| pth.to_s[/PaxHeader/]}
... and Hey Presto! the 'vagrant up' command now completes and we are up and running.

Ah! WAIT... that's not quite true. So much junk lying around from previous attempts that it masked the error in my thinking. PaxHeader may seem to be something useful, so a re-think is required. I'll update you all when I unravel it :)

Hi There, i get the following error can you please help
/Users/khashayaryousefi/.vagrant.d/gems/2.3.4/gems/librarian-chef-nochef-0.2.0/lib/librarian/chef/source/site.rb:309:in `unpack_package!': The package archive has too many children! (RuntimeError)

unsubscripe

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 88,834+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.