HG cookboks for Ubuntu/Debian servers provisioning.
- ruby
- chef
- berkshelf
- knife
- knife-solo (https://matschaffer.github.io/knife-solo/)
hg_development
- Development tools setuphg_rails
- Rails stack setup (Ruby, RoR, database, dotenv)hg_server
- Server setup (creating users, deployment keys, MySQL, Redis etc.)
sample Berskfile file:
# knife solo data bag edit synerise_mailers secrets
source "https://api.berkshelf.com"
cookbook "hg_server", git: '[email protected]:Synerise/cookbooks.git', rel: "hg_server/", tag: "1.0.1"
cookbook "hg_rails", git: '[email protected]:Synerise/cookbooks.git', rel: "hg_rails/", tag: "1.0.1"
cookbook "hg_development", git: '[email protected]:Synerise/cookbooks.git', rel: "hg_development/", tag: "1.0.1"
knife solo cook username@host --why-run
- will explain what would be changed in actual run
- Get server that you would like to configure, for case of this example we will assume that you will use Vagrant machine (sample Vagrantfile is present here in the repository). Make sure it is running.
- Add to existing Gemfile or create new with following:
source "https://rubygems.org"
gem 'chef' # you can add require: false in all of these if you wish
gem "knife-solo"
gem "knife-solo_data_bag"
gem "berkshelf"
- Run
bundle install
- Run
bundle exec knife solo init ./chef/
- Create
Berskfile
file within./chef/
directory (example content is presented above) - Within
./chef/nodes
create json file connected with node that you wish to provision. For Vagrant example it is127.0.0.1.json
. Withinrun_list
key specify array of recipes to be run and of course specify all required node params and data_bags for provisioning (it depends on cookbook you will be using). - Run
knife solo prepare [email protected] -p 2222
to install Chef on server (2222 port is internal setting of Vagrant) - Finally run
knife solo cook [email protected] -p 2222