railslove_deploy 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README +12 -0
- data/TODO +4 -0
- data/bin/deployify +31 -0
- data/lib/railslove/recipes/apache.rb +45 -0
- data/lib/railslove/recipes/backup.rb +8 -0
- data/lib/railslove/recipes/db.rb +52 -0
- data/lib/railslove/recipes/deploy.rb +49 -0
- data/lib/railslove/recipes/ferm.rb +12 -0
- data/lib/railslove/recipes/gems.rb +50 -0
- data/lib/railslove/recipes/helpers.rb +35 -0
- data/lib/railslove/recipes/hooks.rb +31 -0
- data/lib/railslove/recipes/job_runner.rb +17 -0
- data/lib/railslove/recipes/logrotate.rb +35 -0
- data/lib/railslove/recipes/memcache.rb +21 -0
- data/lib/railslove/recipes/misc.rb +36 -0
- data/lib/railslove/recipes/monit.rb +32 -0
- data/lib/railslove/recipes/passenger.rb +25 -0
- data/lib/railslove/recipes/shared.rb +16 -0
- data/lib/railslove/recipes/sphinx.rb +37 -0
- data/lib/railslove/recipes/workling.rb +26 -0
- data/lib/railslove/recipes.rb +7 -0
- data/lib/railslove/sprinkle/apache.rb +45 -0
- data/lib/railslove/sprinkle/essentials.rb +14 -0
- data/lib/railslove/sprinkle/ferm.rb +23 -0
- data/lib/railslove/sprinkle/git.rb +15 -0
- data/lib/railslove/sprinkle/image_magick.rb +5 -0
- data/lib/railslove/sprinkle/memcache.rb +42 -0
- data/lib/railslove/sprinkle/monit.rb +34 -0
- data/lib/railslove/sprinkle/mysql.rb +20 -0
- data/lib/railslove/sprinkle/nginx.rb +16 -0
- data/lib/railslove/sprinkle/passenger.rb +68 -0
- data/lib/railslove/sprinkle/rails_user.rb +19 -0
- data/lib/railslove/sprinkle/ruby_enterprise.rb +38 -0
- data/lib/railslove/sprinkle/sphinx.rb +14 -0
- data/lib/railslove/sprinkle/sqlite.rb +15 -0
- data/lib/railslove/sprinkle/subversion.rb +4 -0
- data/lib/railslove/sprinkle/usefull_gems.rb +10 -0
- data/lib/railslove/sprinkle.rb +3 -0
- data/lib/railslove/templates/deploy.rb +177 -0
- data/lib/railslove/templates/ferm.conf.erb +56 -0
- data/lib/railslove/templates/maintenance.html +0 -0
- data/lib/railslove/templates/memcache_init +31 -0
- data/lib/railslove/templates/monit_init +115 -0
- data/lib/railslove/templates/monitoring/apache.monit.erb +18 -0
- data/lib/railslove/templates/monitoring/job_worker.monit.erb +4 -0
- data/lib/railslove/templates/monitoring/memcached.monit.erb +4 -0
- data/lib/railslove/templates/monitoring/mysql.monit.erb +5 -0
- data/lib/railslove/templates/monitoring/nginx.monit.erb +4 -0
- data/lib/railslove/templates/monitoring/sphinx.monit.erb +0 -0
- data/lib/railslove/templates/monitoring/sshd.monit.erb +5 -0
- data/lib/railslove/templates/monitrc.erb +236 -0
- data/lib/railslove/templates/nginx.conf +0 -0
- data/lib/railslove/templates/nginx_init +65 -0
- data/lib/railslove/templates/passenger.conf +3 -0
- data/lib/railslove/templates/passenger.load +1 -0
- data/lib/railslove/templates/post_logrotate +1 -0
- data/lib/railslove/templates/safe.rb +42 -0
- data/lib/railslove/templates/sprinkle.rb +43 -0
- data/lib/railslove/templates/sprinkle_config.rb +2 -0
- data/lib/railslove/templates/sshd_config.erb +81 -0
- data/lib/railslove/templates/stack_readme.txt +4 -0
- data/lib/railslove/templates/vhost.erb +42 -0
- data/lib/railslove_deploy.rb +0 -0
- data/test/railslove_deploy_test.rb +7 -0
- data/test/test_helper.rb +7 -0
- metadata +132 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
package :essentials do
|
2
|
+
description 'Essential Tools'
|
3
|
+
apt %w{sudo wget make unzip curl libcurl3 libcurl3-dev libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev libgcrypt11-dev openssl libssl-dev gcc g++ gettext libreadline-dev logrotate ssl-cert flex} do
|
4
|
+
pre :install, 'apt-get update'
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_executable "sudo"
|
9
|
+
has_executable "wget"
|
10
|
+
has_executable "make"
|
11
|
+
has_executable "unzip"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package :ferm do
|
2
|
+
description 'ferm - for Easy Rule Making. a tool to maintain complex firewalls.'
|
3
|
+
requires :essentials
|
4
|
+
apt 'ferm'
|
5
|
+
|
6
|
+
verify do
|
7
|
+
has_executable "ferm"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
package :ferm_conf do
|
12
|
+
requires :ferm
|
13
|
+
|
14
|
+
ferm_server_tcp_ports = "http https ssh"
|
15
|
+
|
16
|
+
transfer "#{File.dirname(__FILE__)}/../templates/ferm.conf.erb", "/etc/ferm/ferm.conf", :render => true, :sudo => true do
|
17
|
+
post :install, '/etc/init.d/ferm restart'
|
18
|
+
end
|
19
|
+
|
20
|
+
verify do
|
21
|
+
has_file '/etc/ferm/ferm.conf'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.6.3.1'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_file '/usr/local/bin/git'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :git_dependencies do
|
13
|
+
description 'Git Build Dependencies'
|
14
|
+
apt 'git', :dependencies_only => true
|
15
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
package :memcached_daemon, :provides => :memcached do
|
2
|
+
description 'Memcached, a distributed memory object store'
|
3
|
+
source 'http://danga.com/memcached/dist/memcached-1.2.6.tar.gz'
|
4
|
+
|
5
|
+
verify do
|
6
|
+
has_executable 'memcached'
|
7
|
+
end
|
8
|
+
requires :libevent
|
9
|
+
end
|
10
|
+
|
11
|
+
package :memcached_conf do
|
12
|
+
|
13
|
+
transfer "#{File.dirname(__FILE__)}/../templates/memcache_init", "/etc/init.d/memcached", :render => true, :sudo => true do
|
14
|
+
post :install, "groupadd -f memcached"
|
15
|
+
post :install, "useradd -g memcached -s /bin/false -d /dev/null memcached"
|
16
|
+
post :install, "mkdir /var/run/memcached"
|
17
|
+
post :install, "chown memcached:memcached /var/run/memcached"
|
18
|
+
|
19
|
+
post :install, 'update-rc.d memcached defaults'
|
20
|
+
post :install, 'chmod +x /etc/init.d/memcached'
|
21
|
+
post :install, '/etc/init.d/memcached start'
|
22
|
+
end
|
23
|
+
requires :memcached_daemon
|
24
|
+
|
25
|
+
verify do
|
26
|
+
has_file '/etc/init.d/memcached'
|
27
|
+
has_process 'memcached'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
package :libmemcached do
|
32
|
+
source 'http://download.tangent.org/libmemcached-0.25.tar.gz'
|
33
|
+
requires :memcached_daemon
|
34
|
+
end
|
35
|
+
|
36
|
+
package :libevent do
|
37
|
+
source 'http://monkey.org/~provos/libevent-1.4.8-stable.tar.gz' do
|
38
|
+
post :install, 'touch /etc/ld.so.conf.d/libevent-i386.conf'
|
39
|
+
post :install, 'echo "/usr/local/lib/" | sudo tee -a /etc/ld.so.conf.d/libevent-i386.conf'
|
40
|
+
post :install, 'sudo ldconfig'
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package :monit, :provides => :monitoring do
|
2
|
+
description 'installs monit - a system monitoring utility which allows an admin to easily monitor files, processes, directories, or devices on your system.'
|
3
|
+
|
4
|
+
source 'http://mmonit.com/monit/dist/monit-5.0.3.tar.gz' do
|
5
|
+
post :install, 'mkdir /etc/monit'
|
6
|
+
post :install, 'mkdir /etc/monit.d'
|
7
|
+
post :install, 'mkdir /var/lib/monit'
|
8
|
+
end
|
9
|
+
|
10
|
+
requires :essentials, :monit_dependencies
|
11
|
+
|
12
|
+
#verify do
|
13
|
+
# has_executable "monit"
|
14
|
+
#end
|
15
|
+
end
|
16
|
+
|
17
|
+
package :monit_init_d do
|
18
|
+
description "Monit init.d script."
|
19
|
+
requires :monit
|
20
|
+
|
21
|
+
transfer "#{File.dirname(__FILE__)}/../templates/monit_init", "/etc/init.d/monit" do
|
22
|
+
post :install, "chmod +x /etc/init.d/monit"
|
23
|
+
end
|
24
|
+
|
25
|
+
#verify do
|
26
|
+
# has_file "/etc/init.d/monit"
|
27
|
+
#end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
package :monit_dependencies do
|
32
|
+
description "Dependencies to build monit from source"
|
33
|
+
apt 'flex byacc'
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
package :mysql, :provides => :database do
|
2
|
+
description 'MySQL Database'
|
3
|
+
apt %w( mysql-server mysql-client libmysqlclient15-dev ) do
|
4
|
+
post :install, "echo \"create user 'readonly';grant select on *.* to 'readonly'@'localhost';\" | mysql -u root"
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_executable 'mysql'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :mysql_driver, :provides => :database_driver do
|
13
|
+
description 'Ruby MySQL database driver'
|
14
|
+
gem 'mysql'
|
15
|
+
|
16
|
+
verify do
|
17
|
+
has_gem 'mysql'
|
18
|
+
end
|
19
|
+
requires :ruby_enterprise
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
package :nginx, :provides => :webserver do
|
2
|
+
description "nginx webserver installed by passenger and configured"
|
3
|
+
# NOTE: THE NGINX IS INSTALLED BY THE PASSENGER GEM... WHICH HAS IT'S OWN PACKAGE AND IS JUST REQUIRED HERE
|
4
|
+
requires :passenger_nginx
|
5
|
+
|
6
|
+
transfer "#{File.dirname(__FILE__)}/../templates/nginx_init", "/etc/init.d/nginx", :render => true, :sudo => true do
|
7
|
+
post :install, 'update-rc.d nginx defaults'
|
8
|
+
post :install, '/etc/init.d/nginx start'
|
9
|
+
end
|
10
|
+
|
11
|
+
verify do
|
12
|
+
has_file "/etc/init.d/nginx"
|
13
|
+
has_file "/etc/init.d/nginx"
|
14
|
+
has_executable "/opt/nginx/sbin/nginx"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
package :passenger_gem do
|
2
|
+
description 'Phusion Passenger (aka mod_rails)'
|
3
|
+
version '2.2.8'
|
4
|
+
gem 'passenger'
|
5
|
+
requires :ruby_enterprise
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_gem 'passenger'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :passenger_apache, :provides => :appserver do
|
13
|
+
description "Installs and configures Passenger for use with apache webserver"
|
14
|
+
# require the apache passenger module load/conf files before installation because of a sprinkle limitation.
|
15
|
+
requires :apache, :passenger_gem, :passenger_module_load, :passenger_module_conf
|
16
|
+
|
17
|
+
passenger_version = '2.2.8'
|
18
|
+
|
19
|
+
noop do
|
20
|
+
pre :install, 'passenger-install-apache2-module --auto'
|
21
|
+
post :install, "sudo a2enmod passenger"
|
22
|
+
post :install, 'echo "NameVirtualHost *:80" | sudo tee -a /etc/apache2/httpd.conf'
|
23
|
+
# Restart apache to enable changes
|
24
|
+
post :install, '/etc/init.d/apache2 restart'
|
25
|
+
end
|
26
|
+
|
27
|
+
verify do
|
28
|
+
has_file '/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
package :passenger_module_load do
|
33
|
+
|
34
|
+
description "Uploads the passenger module load configuration. -sprinkle currently does not allow multiple installers per package, that's why the configuration files have it's own packages"
|
35
|
+
requires :apache, :passenger_gem
|
36
|
+
|
37
|
+
#TODO: :render => true seems not to work? hello sprinkle?!
|
38
|
+
passenger_version = '2.2.8'
|
39
|
+
transfer "#{File.dirname(__FILE__)}/../templates/passenger.load", "/etc/apache2/mods-available/passenger.load", :render => true
|
40
|
+
|
41
|
+
verify do
|
42
|
+
has_file '/etc/apache2/mods-available/passenger.load'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
package :passenger_module_conf do
|
47
|
+
|
48
|
+
description "Uploads the passenger module conf configuration. -sprinkle currently does not allow multiple installers per package, that's why the configuration files have it's own packages"
|
49
|
+
requires :apache, :passenger_gem
|
50
|
+
|
51
|
+
#TODO: :render => true seems not to work? hello sprinkle?!
|
52
|
+
passenger_version = '2.2.8'
|
53
|
+
transfer "#{File.dirname(__FILE__)}/../templates/passenger.conf", "/etc/apache2/mods-available/passenger.conf", :render => true
|
54
|
+
|
55
|
+
verify do
|
56
|
+
has_file '/etc/apache2/mods-available/passenger.conf'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
package :passenger_nginx, :provides => :appserver do
|
61
|
+
description "Installs and configures Passenger for use with the awesome nginx webserver"
|
62
|
+
|
63
|
+
requires :passenger_gem
|
64
|
+
|
65
|
+
noop do
|
66
|
+
pre :install, "passenger-install-nginx-module --auto --auto-download"
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
package :rails_user do
|
2
|
+
description 'Creates a special user (sudoer) for all the Rails stuff'
|
3
|
+
|
4
|
+
noop do
|
5
|
+
|
6
|
+
pre :install, "groupadd -f rails"
|
7
|
+
pre :install, "useradd -g rails -m rails;echo 0"
|
8
|
+
pre :install, "echo 'rails\tALL=(ALL) ALL' | tee -a /etc/sudoers"
|
9
|
+
pre :install, "mkdir /home/rails/.ssh; echo 0"
|
10
|
+
pre :install, "chown -R rails:rails /home/rails/.ssh; echo 0"
|
11
|
+
#run "cat /tmp/ssh_key.pub.client >> /home/rails/.ssh/authorized_keys"
|
12
|
+
pre :install, "mkdir /var/www/rails_apps;echo 0"
|
13
|
+
pre :install, "chown rails:rails -R /var/www/rails_apps;echo 0"
|
14
|
+
pre :install, "cp /root/.gemrc /home/rails/.gemrc"
|
15
|
+
pre :install, "chown rails:rails /home/rails/.gemrc;echo 0"
|
16
|
+
pre :install, "mkdir /backup;echo 0"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
package :ruby_enterprise, :provides => :ruby do
|
3
|
+
description 'Ruby Enterprise Edition'
|
4
|
+
|
5
|
+
source_url = Net::HTTP.get( 'www.rubyenterpriseedition.com', '/download.html' ).scan(/http:.*\.tar\.gz/).first
|
6
|
+
version "#{source_url[/(ruby-enterprise.*)(.tar.gz)/, 1]}"
|
7
|
+
install_path = "/usr/local/ruby-enterprise"
|
8
|
+
|
9
|
+
source source_url do
|
10
|
+
custom_install 'sudo ./installer --auto=/usr/local/ruby-enterprise'
|
11
|
+
|
12
|
+
["","#Adding rubyenterprise as path",
|
13
|
+
"PATH=$PATH:#{install_path}/bin",
|
14
|
+
"export PATH"].each do |line|
|
15
|
+
post :install, "echo '#{line}' |sudo tee -a /etc/profile"
|
16
|
+
end
|
17
|
+
|
18
|
+
#TODO: figure out how setting the ruby-enterprise dir in PATH variable for sudo
|
19
|
+
post :install, "ln -s /usr/local/ruby-enterprise/bin/* /usr/local/bin/"
|
20
|
+
|
21
|
+
#reload /etc/profile
|
22
|
+
post :install, "source /etc/profile"
|
23
|
+
post :install, "gem sources -a http://gems.github.com"
|
24
|
+
post :install, "gem install gemcutter"
|
25
|
+
post :install, "gem tumble"
|
26
|
+
end
|
27
|
+
|
28
|
+
verify do
|
29
|
+
has_directory install_path
|
30
|
+
has_executable "#{install_path}/bin/ruby"
|
31
|
+
end
|
32
|
+
|
33
|
+
requires :ree_dependencies
|
34
|
+
end
|
35
|
+
|
36
|
+
package :ree_dependencies do
|
37
|
+
apt %w(libopenssl-ruby zlib1g-dev libreadline5-dev libssl-dev)
|
38
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
package :sphinx, :provides => :searchengine do
|
2
|
+
description 'Sphinx SQL full-text search engine'
|
3
|
+
version '0.9.8.1'
|
4
|
+
source "http://www.sphinxsearch.com/downloads/sphinx-#{version}.tar.gz" do
|
5
|
+
post :extract, "wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar zxvf libstemmer_c.tgz"
|
6
|
+
custom_install "./configure --with-libstemmer --prefix=#{@options[:prefix]} && make && make install"
|
7
|
+
end
|
8
|
+
requires :sphinx_dependencies
|
9
|
+
end
|
10
|
+
|
11
|
+
package :sphinx_dependencies do
|
12
|
+
description 'Sphinx Dependencies'
|
13
|
+
apt %w(libaspell-dev aspell-de aspell-en aspell-fr aspell-es)
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# from the original sprinkle gem: http://github.com/crafterm/sprinkle/tree/master
|
2
|
+
# Packages to install sqlite3 and the sqlite3 ruby driver.
|
3
|
+
package :sqlite3, :provides => :database do
|
4
|
+
description 'SQLite3 database'
|
5
|
+
apt 'sqlite3 libsqlite3-dev libsqlite3-ruby1.8'
|
6
|
+
end
|
7
|
+
|
8
|
+
package :sqlite3_ruby_driver, :provides => :database_driver do
|
9
|
+
description 'Ruby SQLite3 library.'
|
10
|
+
gem 'sqlite3-ruby'
|
11
|
+
|
12
|
+
verify do
|
13
|
+
ruby_can_load 'sqlite3'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
package :usefull_gems do
|
2
|
+
USEFUL_GEMS ="aws-s3 astrails-safe bcrypt-ruby chronic daemons dm-core dm-more erubis eventmachine haml hpricot json json_pure memcache-client money mime-types net-sftp net-ssh newrelic_rpm oauth ParseTree rails RedCloth ruby-openid ruby2ruby RubyInline sinatra starling thor thoughtbot-factory_girl will_paginate wvanbergen-request-log-analyzer xml-simple xmpp4r xmpp4r-simple"
|
3
|
+
gem USEFUL_GEMS
|
4
|
+
|
5
|
+
verify do
|
6
|
+
USEFUL_GEMS.split(" ").each do |gem|
|
7
|
+
has_gem gem
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
# uncomment that if you want to deploy to several stages and want to use the capistrano multistage extensions
|
2
|
+
# if so, you should also create a custom stage deploy script i.e. config/deploy/staging.rb
|
3
|
+
# set :stages, %w(staging production)
|
4
|
+
# set :default_stage, "staging"
|
5
|
+
# require 'capistrano/ext/multistage'
|
6
|
+
require "railslove/recipes"
|
7
|
+
|
8
|
+
|
9
|
+
#############################################################################
|
10
|
+
# Application Server Configuration
|
11
|
+
#############################################################################
|
12
|
+
|
13
|
+
# the name of your application. This will be used as name for the deployment directory and webserver configuration
|
14
|
+
set :application, ""
|
15
|
+
# the primary domain for your application
|
16
|
+
set :domain, ""
|
17
|
+
# comma seperated list of additional domains
|
18
|
+
set :domain_alias, ""
|
19
|
+
# set to true if you want to rewrite the additional domains to the default domain. (www.example.com => example.com)
|
20
|
+
set :force_default_domain, false
|
21
|
+
|
22
|
+
# The IP addresses of your deployment servers
|
23
|
+
role :app, ""
|
24
|
+
role :web, ""
|
25
|
+
role :db, "", :primary => true
|
26
|
+
|
27
|
+
# target directory for the application
|
28
|
+
set :deploy_to, "/var/www/rails_apps/#{application}"
|
29
|
+
|
30
|
+
#############################################################################
|
31
|
+
# Application Dependencies
|
32
|
+
#############################################################################
|
33
|
+
|
34
|
+
depend :remote, :gem, "mislav-will_paginate", ">=2.2.2"
|
35
|
+
depend :remote, :gem, "right_aws", ">=1.9.0"
|
36
|
+
depend :remote, :gem, "astrails-safe"
|
37
|
+
depend :remote, :gem, "json"
|
38
|
+
depend :remote, :gem, "haml"
|
39
|
+
depend :remote, :gem, "oauth"
|
40
|
+
|
41
|
+
|
42
|
+
#############################################################################
|
43
|
+
# Source Code Repository Configuration
|
44
|
+
#############################################################################
|
45
|
+
|
46
|
+
# URL and configuration of the application source code repository.
|
47
|
+
set :repository, ""
|
48
|
+
set :scm, "git"
|
49
|
+
# This will specify the branch that gets checked out for the deployment.
|
50
|
+
set :branch, "master"
|
51
|
+
# Remote caching will keep a local git repo on the server you're deploying to and simply run a fetch from that rather than an entire clone.
|
52
|
+
set :deploy_via, :remote_cache
|
53
|
+
# If you're using git's submodule support for edge rails or merb, set this guy to make sure the submodules "git" checked out.
|
54
|
+
# set :git_enable_submodules, 1
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
#############################################################################
|
59
|
+
# SSH/Connection Configuration
|
60
|
+
#############################################################################
|
61
|
+
|
62
|
+
# SSH Configuration. By default we're using forwar_agent
|
63
|
+
set :ssh_options, {:forward_agent => true, :port => 22}
|
64
|
+
default_run_options[:pty] = true
|
65
|
+
on :start do
|
66
|
+
`ssh-add`
|
67
|
+
end
|
68
|
+
|
69
|
+
# the user. this user ownes the used to login an
|
70
|
+
set :user, "rails"
|
71
|
+
set :use_sudo, false
|
72
|
+
|
73
|
+
|
74
|
+
#############################################################################
|
75
|
+
# Shared files
|
76
|
+
#############################################################################
|
77
|
+
|
78
|
+
# the files and directories that you want to share between the releases of your application
|
79
|
+
# for example:
|
80
|
+
# set :shared_files, {:files => "files"}
|
81
|
+
# symlinks <release>/files to <shared>/files and
|
82
|
+
|
83
|
+
set :shared_files, {}
|
84
|
+
|
85
|
+
|
86
|
+
#############################################################################
|
87
|
+
# Monit configuration
|
88
|
+
#############################################################################
|
89
|
+
|
90
|
+
# this allows you to set some basic monit configuration.
|
91
|
+
# monit is a utility for managing and monitoring, processes, files, directories and devices on a UNIX system.
|
92
|
+
# for example it can alert your if apache goes down and reboot it.
|
93
|
+
# for advanced configuration edit /etc/monit/minit.rc on your server
|
94
|
+
|
95
|
+
# options are:
|
96
|
+
# :mailserver: the complete monit mail server configuration (see: http://mmonit.com/monit/documentation/monit.html#setting_a_mail_server_for_alert_messages)
|
97
|
+
# :webserver: the complete monit web server configuration (see: http://mmonit.com/monit/documentation/monit.html#monit_httpd)
|
98
|
+
# :send_alerts_to: array with email addresses to notify
|
99
|
+
|
100
|
+
set :monit_config, {}
|
101
|
+
|
102
|
+
# Monit is a system-wide configuration so you should run this only once on your server.
|
103
|
+
# after "deploy:setup",
|
104
|
+
# "monit:setup",
|
105
|
+
# "monit:start"
|
106
|
+
#
|
107
|
+
# Example:
|
108
|
+
#set :monit_config, {
|
109
|
+
# :mailserver => %Q{
|
110
|
+
# set mailserver mail.example.com
|
111
|
+
# username "username" password "password" using tlsv1
|
112
|
+
# using hostname "host.example.org"
|
113
|
+
# },
|
114
|
+
# :mail_format => "set mail-format { from: monit@foo.bar }"
|
115
|
+
# :alerts => "set alert admin@example.com",
|
116
|
+
# :mail_format => "set mail-format { from: monit@example.com }",
|
117
|
+
# :webserver => %Q{
|
118
|
+
# set httpd port 2812 and
|
119
|
+
# use address localhost
|
120
|
+
# allow localhost
|
121
|
+
# allow monit:kse31gf78oA
|
122
|
+
# }
|
123
|
+
#}
|
124
|
+
|
125
|
+
|
126
|
+
#############################################################################
|
127
|
+
# Ferm configuration
|
128
|
+
#############################################################################
|
129
|
+
|
130
|
+
# ferm is a to to easily configure your IPtables.
|
131
|
+
# for more information visit: http://ferm.foo-projects.org/
|
132
|
+
# just add the ports that should be available here.
|
133
|
+
set :ferm_server_tcp_ports, "http https ssh 2812" # only http (port 80) https (port 433) ssh (port 22) and port 2812 (used by monit) are open.
|
134
|
+
|
135
|
+
# IPtables is a system-wide configuration so you should run this only once on your server. (deactivate this if you have several apps on your server)
|
136
|
+
after "deploy:setup",
|
137
|
+
"ferm:configure"
|
138
|
+
|
139
|
+
|
140
|
+
#############################################################################
|
141
|
+
# Logrotation configuration
|
142
|
+
#############################################################################
|
143
|
+
|
144
|
+
set :logrotate_options, [ { :rotate => 30, :size => "10MB" }, :delaycompress, :daily, :missingok, :compress, :delaycompress, :notifempty, :copytruncate, :sharedscripts ]
|
145
|
+
set :logrotate_directory, "#{shared_path}/system/logs"
|
146
|
+
|
147
|
+
|
148
|
+
#############################################################################
|
149
|
+
# Capistrano Callbacks
|
150
|
+
#############################################################################
|
151
|
+
|
152
|
+
# run backups before each deployment?
|
153
|
+
#before "deploy",
|
154
|
+
# "backup:run"
|
155
|
+
|
156
|
+
# disable the app before deployment?
|
157
|
+
# it will upload config/server/maintenance.html to your server.
|
158
|
+
#before "deploy",
|
159
|
+
# "deploy:web:disable"
|
160
|
+
#after "deploy",
|
161
|
+
# "deploy:web:enable"
|
162
|
+
|
163
|
+
after "deploy:setup",
|
164
|
+
"logrotate:configure",
|
165
|
+
"apache:upload_vhost_config",
|
166
|
+
"db:upload_config_yml",
|
167
|
+
"gems:install"
|
168
|
+
|
169
|
+
after "deploy:cold",
|
170
|
+
"apache:enable_site",
|
171
|
+
"apache:reload"
|
172
|
+
|
173
|
+
after "deploy:finalize_update",
|
174
|
+
"db:symlink_config_yml",
|
175
|
+
"db:create",
|
176
|
+
"shared:symlink",
|
177
|
+
"deploy:cleanup"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#
|
2
|
+
# -*- shell-script -*-
|
3
|
+
#
|
4
|
+
# Configuration file for ferm(1).
|
5
|
+
#
|
6
|
+
|
7
|
+
def $SERVER_TCP_PORTS = (<%= ferm_server_tcp_ports %>);
|
8
|
+
|
9
|
+
table filter {
|
10
|
+
chain INPUT {
|
11
|
+
policy DROP;
|
12
|
+
|
13
|
+
# connection tracking
|
14
|
+
mod state state INVALID DROP;
|
15
|
+
mod state state (ESTABLISHED RELATED) ACCEPT;
|
16
|
+
|
17
|
+
# allow local packages
|
18
|
+
interface lo ACCEPT;
|
19
|
+
|
20
|
+
# respond to ping, but limit that
|
21
|
+
proto icmp ACCEPT;
|
22
|
+
|
23
|
+
# allow IPsec
|
24
|
+
proto udp dport 500 ACCEPT;
|
25
|
+
proto (esp ah) ACCEPT;
|
26
|
+
|
27
|
+
# allow the defined tcp connections
|
28
|
+
#proto tcp dport ssh ACCEPT;
|
29
|
+
proto tcp dport $SERVER_TCP_PORTS ACCEPT;
|
30
|
+
}
|
31
|
+
chain OUTPUT {
|
32
|
+
policy ACCEPT;
|
33
|
+
|
34
|
+
# connection tracking
|
35
|
+
#mod state state INVALID DROP;
|
36
|
+
mod state state (ESTABLISHED RELATED) ACCEPT;
|
37
|
+
}
|
38
|
+
chain FORWARD {
|
39
|
+
policy DROP;
|
40
|
+
|
41
|
+
# connection tracking
|
42
|
+
mod state state INVALID DROP;
|
43
|
+
mod state state (ESTABLISHED RELATED) ACCEPT;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
# IPv6:
|
48
|
+
#domain ip6 {
|
49
|
+
# table filter {
|
50
|
+
# chain INPUT {
|
51
|
+
# policy ACCEPT;
|
52
|
+
# # ...
|
53
|
+
# }
|
54
|
+
# # ...
|
55
|
+
# }
|
56
|
+
#}
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# /etc/init.d/memcached
|
3
|
+
#
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
DAEMON=/usr/local/bin/memcached
|
8
|
+
PIDFILE=/var/run/memcached/memcached.pid
|
9
|
+
NAME=memcached
|
10
|
+
|
11
|
+
test -x ${DAEMON} || exit 0
|
12
|
+
|
13
|
+
case "$1" in
|
14
|
+
start)
|
15
|
+
echo -n "Starting ${NAME}"
|
16
|
+
start-stop-daemon --start --pidfile ${PIDFILE} --exec ${DAEMON} -- -d -P ${PIDFILE} -u memcached -l 127.0.0.1
|
17
|
+
echo "."
|
18
|
+
;;
|
19
|
+
stop)
|
20
|
+
echo -n "Stopping ${NAME}"
|
21
|
+
start-stop-daemon --stop --pidfile ${PIDFILE} --oknodo --exec ${DAEMON}
|
22
|
+
rm -f ${PIDFILE}
|
23
|
+
echo "."
|
24
|
+
;;
|
25
|
+
*)
|
26
|
+
echo "Usage: /etc/init.d/${NAME} {start|stop}"
|
27
|
+
exit 1
|
28
|
+
;;
|
29
|
+
esac
|
30
|
+
|
31
|
+
exit 0
|