Sorry, but this is probably going to be a newbie question since I have no real knowledge of ruby, gems or chef. I am confused about how different ruby versions relate to the chef resources (cookbooks, recipes etc) on my local PC, the version the application requires, and what is available on the application server (where chef client runs). We manage ruby versions using rbenv.
We have a web application that requires ruby version 2.1.2. On my local PC, from which we manage chef, I can see that versions 2.1.2, 2.3.1 and the system version of 2.3.3 are available. Version 2.1.2 has been set as the global version on the PC. On the (web) application server I can see that versions 2.0.0, 2.1.1 and 2.1.2 are available. Version 2.1.2 has been set as the global version on the server.
Several of the cookbooks (from the chef supermarket) are quite old. If we try and upgrade them some give a dependency error that we need to use ruby version 2.2 (for example) or above. If I change the PC global version to (for example) 2.3.3, then it seems that the local gems are missing for that version. So I assume I need to reinstall all the gems for that version (using ‘bundle install’ if I remember correctly)?
If we then upload the cookbooks to the (opscode) chef server, and these are downloaded to the application server when I run ‘chef-client’, I assume the app server needs to have the same version of ruby installed as well? How does chef client know which version of ruby to use, and will this interfere in any way with the global version which is set according to the version required by the application, not the version required by chef client?
I assume this is how things are supposed to work - the application uses one version of ruby (installed on the app server and set as global), chef client can use a different version (also installed on the app server), and the local PC also uses the same version as chef client on the app server? That way we can update cookbooks and gems on the PC, and use the latest ruby version, without it affecting the actual web app or its running on the app server. Does that sound right?