Skip to content

Commit

Permalink
Moving some recipe calls to more appropriate places, README update
Browse files Browse the repository at this point in the history
  • Loading branch information
Winton Welsh committed Aug 4, 2008
1 parent 55a2c18 commit e437f7a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
48 changes: 36 additions & 12 deletions README.markdown
Expand Up @@ -7,14 +7,15 @@ Cookbook takes you from a fresh Debian/Ubuntu server to a complete Nginx/Rails/P
The stack The stack
--------- ---------


- Git * Git
- Nginx * Nginx
- Monit * Monit
- MySQL * MySQL
- PHP (spawn-fcgi) * PHP (Nginx w/ spawn-fcgi)
- Rails * Rails
- Ruby * Ruby
- RubyGems * RubyGems
* Sphinx




Install Install
Expand All @@ -34,7 +35,7 @@ Install


Copy **config/cookbook/deploy.rb.example** to **config/deploy.rb** Copy **config/cookbook/deploy.rb.example** to **config/deploy.rb**


Edit **deploy.rb** to your liking. Run `cap -T` to check out your new tasks. Edit **config/deploy.rb** to your liking. Run `cap -T` to check out your new tasks.




Create the deploy user Create the deploy user
Expand All @@ -46,7 +47,7 @@ If you can't log in as root directly, but have the password (ServerBeach):


su su


### Change root's password ### Change root's password if you already haven't


passwd passwd


Expand All @@ -62,6 +63,12 @@ Add this line to the end of the file. This gives the deploy user "sudo without p


deploy ALL=NOPASSWD: ALL deploy ALL=NOPASSWD: ALL


Upload your SSH keys:

cap ssh:setup

(Just answer no to the first question if you already have local keys generated.)



Set up your fresh Debian server Set up your fresh Debian server
------------------------------- -------------------------------
Expand All @@ -70,6 +77,8 @@ Set up your fresh Debian server


cap debian:setup cap debian:setup


(See **config/cookbook/recipes/debian.rb**. You might want to run the tasks individually to know what's going on.)

### On the server ### On the server


Its probably a good idea to restart the server after all that: Its probably a good idea to restart the server after all that:
Expand All @@ -82,15 +91,30 @@ Deploy your app


### First deploy ### First deploy


cap mysql:create:user
cap mysql:create:db
cap deploy:create cap deploy:create

(See **config/cookbook/recipes/deploy.rb** to know what's going on here.)

Optionally set up log rotation and a monit entry for your mongrels:

cap log:rotate
cap monit:config:mongrel


### Subsequent deploys ### Subsequent deploys


cap deploy cap deploy




Deploy staging
--------------

See *Deploy your app*, but replace `cap` with `cap staging`.

Example:

cap staging deploy:create


Set up a PHP app Set up a PHP app
---------------- ----------------


Expand Down
6 changes: 4 additions & 2 deletions recipes/debian.rb
Expand Up @@ -4,8 +4,8 @@
desc "Configure and install a fresh Debian server" desc "Configure and install a fresh Debian server"
task :default do task :default do
if yes("Have you created the user defined in config/deploy.rb? (See vendor/plugins/cookbook/README)") if yes("Have you created the user defined in config/deploy.rb? (See vendor/plugins/cookbook/README)")
debian.config.default
debian.aptitude.default debian.aptitude.default
debian.config.default
debian.install.default debian.install.default
end end
end end
Expand Down Expand Up @@ -123,7 +123,7 @@
end end
end end


desc "Install Lighttpd" desc "Install Lighttpd" # Lighttpd install is purely for spawn-fcgi
task :lighttpd, :roles => :app do task :lighttpd, :roles => :app do
sudo_puts 'aptitude install libpcre3-dev libbz2-dev -q -y' sudo_puts 'aptitude install libpcre3-dev libbz2-dev -q -y'
install_source(:lighttpd) do |path| install_source(:lighttpd) do |path|
Expand All @@ -134,6 +134,7 @@
desc 'Install Monit' desc 'Install Monit'
task :monit, :roles => :db do task :monit, :roles => :db do
sudo_puts 'aptitude install monit -q -y' sudo_puts 'aptitude install monit -q -y'
monit.config.default
end end


desc 'Install MySQL' desc 'Install MySQL'
Expand All @@ -146,6 +147,7 @@
"See http://dev.mysql.com/doc/refman/5.1/en/mysql-secure-installation.html", "See http://dev.mysql.com/doc/refman/5.1/en/mysql-secure-installation.html",
'' ''
].join("\n") ].join("\n")
ROOT.mysql.create.user
end end


desc 'Install Nginx' desc 'Install Nginx'
Expand Down
4 changes: 3 additions & 1 deletion recipes/deploy.rb
Expand Up @@ -18,9 +18,10 @@


desc "Deploy a fresh app" desc "Deploy a fresh app"
task :create, :roles => :app do task :create, :roles => :app do
mysql.create.db
sudo_each [ sudo_each [
"mkdir -p #{base_dir}", "mkdir -p #{base_dir}",
"chown -R mongrel:mongrel #{base_dir}" "chown -R #{user}:#{user} #{base_dir}"
] ]
deploy.setup deploy.setup
if platform == :rails if platform == :rails
Expand All @@ -42,6 +43,7 @@
sudo "rm -Rf #{deploy_to}" sudo "rm -Rf #{deploy_to}"
nginx.config.destroy nginx.config.destroy
nginx.restart nginx.restart
mysql.destroy.db
end end
end end


Expand Down
1 change: 1 addition & 0 deletions recipes/monit.rb
Expand Up @@ -15,6 +15,7 @@
'/etc/monit/monitrc', '/etc/monit/monitrc',
'/etc/default/monit' '/etc/default/monit'
], binding, :chown => 'root', :chmod => '0644', :folder => 'monit' ], binding, :chown => 'root', :chmod => '0644', :folder => 'monit'
monit.config.nginx
end end


desc "Add mongrel cluster to monitrc" desc "Add mongrel cluster to monitrc"
Expand Down

0 comments on commit e437f7a

Please sign in to comment.