-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aee52a3
commit 2095b50
Showing
14 changed files
with
714 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Sprinkle Packages | ||
================= | ||
|
||
This is a small collection of packages for Sprinkle. | ||
|
||
Sprinkle is a software provisioning tool you can use to build remote | ||
servers. It's kind of like a simple version of Chef-solo, I think. | ||
|
||
* <http://github.com/crafterm/sprinkle> | ||
* <http://github.com/opscode/chef> | ||
|
||
Example packages include those for nginx with Passenger, Ruby Enterprise, | ||
Monit, memcached, Capistrano, Varnish, etc. | ||
|
||
I don't really intend to update these packages, nor do I think they're entirely | ||
complete or exactly right for your needs. I've pulled them out of existing | ||
Sprinkle stacks, so they probably won't even run as-is. Still, they may serve | ||
as a useful starting point for someone.... they've been handy for me. | ||
|
||
|
||
Usage | ||
----- | ||
|
||
gem install crafterm-sprinkle capistrano capistrano-ext | ||
sprinkle -s example.rb example.com | ||
|
||
See example.rb for the packages that would be installed, and the packages | ||
directory to view the details of those packages. | ||
|
||
|
||
MIT License | ||
----------- | ||
|
||
Copyright (c) 2010 Trevor Turk | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Dir.glob(File.join(File.dirname(__FILE__), 'packages/*.rb')).each { |f| require f } | ||
IP = ARGV.first | ||
|
||
policy :setup, :roles => :app do | ||
requires :apt_base | ||
requires :ssh_keys | ||
requires :deploy | ||
requires :capistrano_dirs | ||
requires :htop | ||
requires :git | ||
requires :ruby_enterprise | ||
requires :nginx_with_passenger | ||
requires :nginx_conf | ||
requires :logrotate_app | ||
requires :sqlite3 | ||
requires :bundler | ||
requires :libmysql | ||
requires :memcached | ||
requires :monit_base | ||
requires :monit_nginx | ||
requires :monit_memcached | ||
requires :monit_start | ||
end | ||
|
||
deployment do | ||
delivery :capistrano do | ||
set :user, 'root' | ||
role :app, IP | ||
end | ||
|
||
source do | ||
prefix '/usr/local' | ||
archives '/usr/local/sources' | ||
builds '/usr/local/build' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package :apt_base do | ||
apt 'build-essential' do | ||
pre :install, 'aptitude update' | ||
end | ||
end | ||
|
||
package :libmysql do | ||
apt 'libmysqlclient15-dev' | ||
end | ||
|
||
package :libssl do | ||
apt 'libssl-dev' | ||
end | ||
|
||
package :htop do | ||
apt 'htop' | ||
|
||
verify do | ||
has_executable 'htop' | ||
end | ||
end | ||
|
||
package :git do | ||
apt 'git-core' | ||
|
||
verify do | ||
has_executable 'git' | ||
end | ||
end | ||
|
||
package :sqlite3 do | ||
apt 'sqlite3 libsqlite3-dev libsqlite3-ruby1.8' | ||
|
||
verify do | ||
has_executable 'sqlite3' | ||
end | ||
end | ||
|
||
package :logrotate do | ||
apt 'logrotate' | ||
|
||
verify do | ||
has_executable 'logrotate' | ||
end | ||
end | ||
|
||
package :subversion do | ||
apt 'subversion' | ||
|
||
verify do | ||
has_executable 'svn' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package :capistrano_dirs do | ||
noop do | ||
pre :install, 'mkdir -p /var/www/app/releases/' | ||
pre :install, 'mkdir -p /var/www/app/shared/' | ||
pre :install, 'mkdir -p /var/www/app/shared/config' | ||
pre :install, 'mkdir -p /var/www/app/shared/log' | ||
pre :install, 'mkdir -p /var/www/app/shared/pids' | ||
pre :install, 'mkdir -p /var/www/app/shared/system' | ||
pre :install, 'chown -R deploy:deploy /var/www/app/' | ||
pre :install, 'chmod -R ug=rwx /var/www/app/' | ||
end | ||
|
||
verify do | ||
has_directory '/var/www/app/shared/system' | ||
end | ||
|
||
requires :git | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package :deploy do | ||
requires :deploy_user, :deploy_id_rsa, :deploy_id_rsa_pub, :deploy_sudoers | ||
end | ||
|
||
package :deploy_user do | ||
noop do | ||
pre :install, 'groupadd deploy' | ||
pre :install, 'useradd -m -g deploy deploy' | ||
pre :install, 'mkdir -p /home/deploy/.ssh' | ||
pre :install, 'touch /home/deploy/.ssh/id_rsa' | ||
pre :install, 'touch /home/deploy/.ssh/id_rsa.pub' | ||
pre :install, 'touch /home/deploy/.ssh/known_hosts' | ||
pre :install, 'cp /root/.ssh/authorized_keys /home/deploy/.ssh/authorized_keys' | ||
pre :install, 'chown -R deploy:deploy /home/deploy/.ssh/' | ||
pre :install, 'chmod 0600 /home/deploy/.ssh/id_rsa' | ||
end | ||
|
||
verify do | ||
has_file '/home/deploy/.ssh/id_rsa' | ||
has_file '/home/deploy/.ssh/authorized_keys' | ||
end | ||
end | ||
|
||
# generate keys to use with your "deploy" user(s), see ssh.rb for an example | ||
package :deploy_id_rsa do | ||
config_file = '/home/deploy/.ssh/id_rsa' | ||
config_text = %q[ | ||
-----BEGIN RSA PRIVATE KEY----- [etc...] | ||
].lstrip | ||
|
||
push_text config_text, config_file | ||
|
||
verify do | ||
file_contains config_file, "..." | ||
end | ||
end | ||
|
||
package :deploy_id_rsa_pub do | ||
config_file = '/home/deploy/.ssh/id_rsa.pub' | ||
config_text = %q[ | ||
ssh-rsa [etc...] | ||
].lstrip | ||
|
||
push_text config_text, config_file | ||
|
||
verify do | ||
file_contains config_file, "..." | ||
end | ||
end | ||
|
||
package :deploy_sudoers do | ||
config_file = '/etc/sudoers' | ||
config_text = %q[ | ||
deploy ALL=NOPASSWD: ALL | ||
].lstrip | ||
|
||
push_text config_text, config_file | ||
|
||
verify do | ||
file_contains config_file, "deploy ALL=NOPASSWD: ALL" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package :logrotate_app do | ||
requires :logrotate, :logrotate_app_logs | ||
end | ||
|
||
package :logrotate_app_logs do | ||
config_file = '/etc/logrotate.d/app' | ||
config_text = %q[ | ||
/var/www/app/shared/log/*.log { | ||
rotate 30 | ||
daily | ||
missingok | ||
notifempty | ||
compress | ||
delaycompress | ||
copytruncate | ||
} | ||
].lstrip | ||
|
||
push_text config_text, config_file do | ||
pre :install, "touch #{config_file} && rm #{config_file} && touch #{config_file}" # clear the file | ||
post :install, "chmod 0644 #{config_file}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package :memcached do | ||
requires :memcached_apt, :memcached_conf, :memcached_logrotate | ||
end | ||
|
||
package :memcached_apt do | ||
apt 'memcached' do | ||
pre :install, "mkdir -p /var/log/memcached" | ||
pre :install, "chown deploy:deploy -R /var/log/memcached" | ||
end | ||
|
||
verify do | ||
has_executable 'memcached' | ||
end | ||
end | ||
|
||
package :memcached_conf do | ||
config_file = '/etc/memcached.conf' | ||
config_text = %q[ | ||
# memcached_conf v1 | ||
logfile /var/log/memcached/memcached.log | ||
-d | ||
-v | ||
-m 64 | ||
-p 11211 | ||
-u deploy | ||
-l 127.0.0.1 | ||
].lstrip | ||
|
||
push_text config_text, config_file do | ||
pre :install, "touch #{config_file} && rm #{config_file} && touch #{config_file}" # clear the file | ||
end | ||
|
||
verify do | ||
file_contains config_file, "memcached_conf v1" | ||
end | ||
end | ||
|
||
package :memcached_logrotate do | ||
config_file = '/etc/logrotate.d/memcached' | ||
config_text = %q[ | ||
/var/log/memcached/*.log { | ||
rotate 30 | ||
daily | ||
missingok | ||
notifempty | ||
compress | ||
delaycompress | ||
copytruncate | ||
} | ||
].lstrip | ||
|
||
push_text config_text, config_file do | ||
pre :install, "touch #{config_file} && rm #{config_file} && touch #{config_file}" # clear the file | ||
post :install, "chmod 0644 #{config_file}" | ||
end | ||
|
||
requires :logrotate | ||
end |
Oops, something went wrong.