Skip to content

AlxGolubev/cap-recipes

 
 

Repository files navigation

Install recipes for quick server setup

This bunch of recipes is aimed to help you with automatical server setup. No handjob required.

1 Serverside

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_keys

2) Clientside

Add recipes

git submodule add [email protected]:linko/cap-recipes.git
cd cap-recipes && git checkout recap

Copy files

cp cap-recipes/Capfile.recap.example ./
mkdir config/deploy
cp cap-recipes/config/deploy/* ./config/deploy/

Update your .gitignore

Add here

config/unicorn.rb
.recap-lock
/cap-recipes

Update Gemfile

Copy everything from Gemfile.example to your Gemfile and run bundle install

Check needed recipes to be included

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'

Setup instructions

bundle exec cap deploy:install
bundle exec cap bootstrap
bundle exec cap deploy:setup

Comment recipes loading

Open 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'

Final deploy

bundle exec cap deploy

3) Rolling back

bundle exec cap deploy:rollback

4) Known issues

  • MySQL limitation to 16 symbols username can cause a problem in mysql recipe. To avoid this edit line set_default(:db_user) { "#{application}_production" } to get in this limit.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 71.4%
  • HTML 23.3%
  • Shell 5.3%