Hello all, I had a problem when i was working with Rails can any one help me please. I have successfully created a Vagrant/Chef configuration to replicate my development local VM machine, but now I am trying to deploy the same settings on a Digital Ocean VPS that I connect obviously by ssh.
It’s a bit confusing how to trigger chef-solo from “inside” the vm without the need of an external server. I actually have one VPS for now. I am pushing my Chef files to github, then clone them from inside the remote development VPS and run chef-solo
.
Steps I’ve followed:
Installed Chef-DK
Added some cookbooks inside Berksfile
Did a berks install and then a berks vendor cookbooks to create everything inside ./cookbooks
Created a solo.rb
file
cookbook_path File.join(File.dirname(File.expand_path(__FILE__)), "cookbooks")
json_attribs File.join(File.dirname(File.expand_path(__FILE__)), "node.json")
Then a node.json file:
{
"run_list": [
"recipe[main]",
"recipe[apt]",
"recipe[nginx]",
"recipe[postgresql]",
"recipe[git]",
"recipe[ruby_build]",
"recipe[rvm]",
"recipe[rails]",
"recipe[bundler]",
"recipe[nodejs]"
]
}
Then a metadata.rb file in the root of my tree structure:
name 'test’
maintainer 'Me Myself’
maintainer_email 'me@myself.com’
license 'All rights reserved’
description 'Installs/Configures test’
long_description 'Installs/Configures test’
version '0.1.0’
depends ‘apt’, '~> 2.6.1’
depends ‘nginx’, '~> 2.7.6’
depends 'postgresql’
depends ‘git’, '~> 4.3.3’
depends 'build-essential’
depends ‘ruby_build’, '~> 0.8.0’
depends ‘rvm’, '~> 0.9.4’
depends ‘rails’, '~> 0.9.2’
depends ‘bundler’, '~> 0.2.0’
depends ‘nodejs’, ‘~> 2.4.2’
And finally I executed:
sudo chef-solo -c solo.rb -j node.json
My questions:
How does this procedure look to you ? Am I missing something ? Any good/common practices ?
The cookbooks folder is deleted and re-generated when I execute berks… Am I doing something wrong ? If not,
What is the meaning of tweaking the default.rb file in each cookbook to customise ? For example, I want to install Ruby 2.2.2 with RVM.
depends doesn’t seem to install cookbooks. I needed to add them inside node.jsonin order for them to work because I was getting a ‘Failed dependencies’ message. Why?
Chef Devopes| DevOps
Any ideas/opinions will be appreciated