This bunch of recipes is aimed to help you with automatical server setup. No handjob required.
Assuming you have root priveligies: ###Add new user
useradd -m [username] -s /bin/bash###Install sudo (optional)
apt-get update
aup-get install sudo###Grant access rights to new user
Run visudo and add:
username ALL=(ALL:ALL) NOPASSWD: ALL
###Remote repo keys Add remote repo keys to users .ssh/known_hosts to avoid requests while running cap procedures Git:
cap system_user:copy_ssh_keysgit submodule add git@github.com:linko/cap-recipes.git
cd cap-recipes && git checkout recapcp cap-recipes/Capfile.recap.example ./
mkdir config/deploy
cp cap-recipes/config/deploy/* ./config/deploy/Add here
config/unicorn.rb
.recap-lock
/cap-recipes
Copy everything from Gemfile.example to your Gemfile and run bundle install
Verify you'd included correct recipes for your application (i.e. mysql recipe for application on postgres) in Capfile. For example:
set :recipes_dir, File.expand_path('/cap-recipes', __FILE__)
load recipes_dir + '/config/recipes/base'
load recipes_dir + '/config/recipes/nginx'
load recipes_dir + '/config/recipes/unicorn'bundle exec cap deploy:install
bundle exec cap bootstrap
bundle exec cap deploy:setupOpen Capfile and comment part with recipes loading
set :recipes_dir, File.expand_path('/cap-recipes', __FILE__)
load recipes_dir + '/config/recipes/base'
load recipes_dir + '/config/recipes/nginx'
load recipes_dir + '/config/recipes/postgresql'
load recipes_dir + '/config/recipes/rbenv'
load recipes_dir + '/config/recipes/unicorn'bundle exec cap deploybundle exec cap deploy:rollback- MySQL limitation to 16 symbols username can cause a problem in
mysqlrecipe. To avoid this edit lineset_default(:db_user) { "#{application}_production" }to get in this limit.