gigpark-ec2onrails 0.9.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +190 -0
- data/COPYING +339 -0
- data/Manifest +160 -0
- data/README.textile +233 -0
- data/Rakefile +31 -0
- data/TODO +104 -0
- data/ec2onrails.gemspec +46 -0
- data/echoe_config.rb +27 -0
- data/examples/Capfile +3 -0
- data/examples/deploy.rb +103 -0
- data/examples/s3.yml +9 -0
- data/lib/ec2onrails.rb +20 -0
- data/lib/ec2onrails/capistrano_utils.rb +47 -0
- data/lib/ec2onrails/recipes.rb +146 -0
- data/lib/ec2onrails/recipes/db.rb +366 -0
- data/lib/ec2onrails/recipes/deploy.rb +26 -0
- data/lib/ec2onrails/recipes/server.rb +517 -0
- data/lib/ec2onrails/version.rb +29 -0
- data/server/build +74 -0
- data/server/files/etc/README +7 -0
- data/server/files/etc/aliases +5 -0
- data/server/files/etc/cron.d/ec2onrails +16 -0
- data/server/files/etc/cron.daily/app +31 -0
- data/server/files/etc/cron.daily/logrotate_post +25 -0
- data/server/files/etc/cron.hourly/app +31 -0
- data/server/files/etc/cron.monthly/app +31 -0
- data/server/files/etc/cron.weekly/app +31 -0
- data/server/files/etc/default/varnish +33 -0
- data/server/files/etc/default/varnishncsa +11 -0
- data/server/files/etc/denyhosts.conf +628 -0
- data/server/files/etc/dpkg/dpkg.cfg +13 -0
- data/server/files/etc/ec2onrails/rails_env +1 -0
- data/server/files/etc/ec2onrails/roles.yml +5 -0
- data/server/files/etc/environment +2 -0
- data/server/files/etc/event.d/god +8 -0
- data/server/files/etc/god/db_primary.god +16 -0
- data/server/files/etc/god/dkim_filter.god +17 -0
- data/server/files/etc/god/master.conf +40 -0
- data/server/files/etc/god/memcache.god +15 -0
- data/server/files/etc/god/notifications.god +11 -0
- data/server/files/etc/god/proxy.god +40 -0
- data/server/files/etc/god/system.god +37 -0
- data/server/files/etc/god/web.god +23 -0
- data/server/files/etc/init.d/ec2-every-startup +29 -0
- data/server/files/etc/init.d/ec2-first-startup +37 -0
- data/server/files/etc/init.d/nginx +78 -0
- data/server/files/etc/logrotate.d/nginx +10 -0
- data/server/files/etc/logrotate.d/rails +8 -0
- data/server/files/etc/logrotate.d/varnish +14 -0
- data/server/files/etc/memcached.conf +47 -0
- data/server/files/etc/motd.tail +13 -0
- data/server/files/etc/mysql/my.cnf +152 -0
- data/server/files/etc/nginx/conf.d/custom.conf +1 -0
- data/server/files/etc/nginx/nginx.conf.erb +152 -0
- data/server/files/etc/postfix/main.cf +4 -0
- data/server/files/etc/ssh/sshd_config +96 -0
- data/server/files/etc/sudoers +31 -0
- data/server/files/etc/syslog.conf +63 -0
- data/server/files/etc/varnish/default.vcl.erb +140 -0
- data/server/files/usr/local/ec2onrails/COPYING +339 -0
- data/server/files/usr/local/ec2onrails/bin/archive_file +44 -0
- data/server/files/usr/local/ec2onrails/bin/backup_app_db +160 -0
- data/server/files/usr/local/ec2onrails/bin/backup_dir +89 -0
- data/server/files/usr/local/ec2onrails/bin/ec2_meta_data +80 -0
- data/server/files/usr/local/ec2onrails/bin/exec_runner +76 -0
- data/server/files/usr/local/ec2onrails/bin/in_role +33 -0
- data/server/files/usr/local/ec2onrails/bin/init_services +43 -0
- data/server/files/usr/local/ec2onrails/bin/install_system_files +56 -0
- data/server/files/usr/local/ec2onrails/bin/optimize_mysql +346 -0
- data/server/files/usr/local/ec2onrails/bin/public-hostname +24 -0
- data/server/files/usr/local/ec2onrails/bin/rails_env +33 -0
- data/server/files/usr/local/ec2onrails/bin/rebundle +62 -0
- data/server/files/usr/local/ec2onrails/bin/restore_app_db +58 -0
- data/server/files/usr/local/ec2onrails/bin/set_rails_env +36 -0
- data/server/files/usr/local/ec2onrails/bin/set_roles +36 -0
- data/server/files/usr/local/ec2onrails/bin/uninstall_system_files +34 -0
- data/server/files/usr/local/ec2onrails/config +30 -0
- data/server/files/usr/local/ec2onrails/lib/aws_helper.rb +75 -0
- data/server/files/usr/local/ec2onrails/lib/god_helper.rb +84 -0
- data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +100 -0
- data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +156 -0
- data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +116 -0
- data/server/files/usr/local/ec2onrails/lib/system_files_helper.rb +110 -0
- data/server/files/usr/local/ec2onrails/lib/system_files_manifest.rb +107 -0
- data/server/files/usr/local/ec2onrails/lib/utils.rb +26 -0
- data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/README +5 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/create-mysqld-pid-dir +26 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/README +5 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs +45 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key +49 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/get-hostname +27 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc +27 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir +24 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials +32 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-file-permissions +30 -0
- data/server/rakefile-wrapper +26 -0
- data/server/rakefile.rb +267 -0
- data/test/autobench.conf +60 -0
- data/test/spec/lib/s3_helper_spec.rb +154 -0
- data/test/spec/lib/s3_old.yml +3 -0
- data/test/spec/lib/system_files_manifest_spec.rb +122 -0
- data/test/spec/test_files/system_files1/_manifest +13 -0
- data/test/spec/test_files/system_files1/test1 +0 -0
- data/test/spec/test_files/system_files1/test2 +0 -0
- data/test/spec/test_files/system_files1/testfolder/test3 +0 -0
- data/test/spec/test_files/system_files2/_manifest +2 -0
- data/test/spec/test_files/system_files2/test1 +0 -0
- data/test/spec/test_files/system_files2/test2 +0 -0
- data/test/spec/test_files/system_files2/testfolder/test3 +0 -0
- data/test/spec/test_files/test2 +0 -0
- data/test/test_app/Capfile +3 -0
- data/test/test_app/README +243 -0
- data/test/test_app/Rakefile +10 -0
- data/test/test_app/app/controllers/application_controller.rb +10 -0
- data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
- data/test/test_app/app/controllers/fast_controller.rb +5 -0
- data/test/test_app/app/controllers/slow_controller.rb +6 -0
- data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
- data/test/test_app/app/helpers/application_helper.rb +3 -0
- data/test/test_app/config/boot.rb +110 -0
- data/test/test_app/config/database.yml +24 -0
- data/test/test_app/config/deploy.rb +22 -0
- data/test/test_app/config/ec2onrails/config.rb +5 -0
- data/test/test_app/config/environment.rb +41 -0
- data/test/test_app/config/environments/development.rb +17 -0
- data/test/test_app/config/environments/production.rb +28 -0
- data/test/test_app/config/environments/test.rb +28 -0
- data/test/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/test_app/config/initializers/inflections.rb +10 -0
- data/test/test_app/config/initializers/mime_types.rb +5 -0
- data/test/test_app/config/initializers/new_rails_defaults.rb +19 -0
- data/test/test_app/config/initializers/session_store.rb +15 -0
- data/test/test_app/config/locales/en.yml +5 -0
- data/test/test_app/config/routes.rb +43 -0
- data/test/test_app/doc/README_FOR_APP +2 -0
- data/test/test_app/public/404.html +30 -0
- data/test/test_app/public/422.html +30 -0
- data/test/test_app/public/500.html +30 -0
- data/test/test_app/public/favicon.ico +0 -0
- data/test/test_app/public/images/rails.png +0 -0
- data/test/test_app/public/index.html +275 -0
- data/test/test_app/public/javascripts/application.js +2 -0
- data/test/test_app/public/javascripts/controls.js +963 -0
- data/test/test_app/public/javascripts/dragdrop.js +973 -0
- data/test/test_app/public/javascripts/effects.js +1128 -0
- data/test/test_app/public/javascripts/prototype.js +4320 -0
- data/test/test_app/public/robots.txt +5 -0
- data/test/test_app/script/about +4 -0
- data/test/test_app/script/console +3 -0
- data/test/test_app/script/dbconsole +3 -0
- data/test/test_app/script/destroy +3 -0
- data/test/test_app/script/generate +3 -0
- data/test/test_app/script/performance/benchmarker +3 -0
- data/test/test_app/script/performance/profiler +3 -0
- data/test/test_app/script/plugin +3 -0
- data/test/test_app/script/runner +3 -0
- data/test/test_app/script/server +3 -0
- data/test/test_app/test/performance/browsing_test.rb +9 -0
- data/test/test_app/test/test_helper.rb +38 -0
- metadata +266 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
# dpkg configuration file
|
2
|
+
#
|
3
|
+
# This file can contain default options for dpkg. All command-line
|
4
|
+
# options are allowed. Values can be specified by putting them after
|
5
|
+
# the option, separated by whitespace and/or an `=' sign.
|
6
|
+
#
|
7
|
+
|
8
|
+
# ec2onrails note: if we have a config file already up here, we want to use
|
9
|
+
# that over the packages default.
|
10
|
+
force-confold
|
11
|
+
|
12
|
+
# Log status changes and actions to a file.
|
13
|
+
log /var/log/dpkg.log
|
@@ -0,0 +1 @@
|
|
1
|
+
production
|
@@ -0,0 +1,16 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = 'mysql'
|
3
|
+
w.group = 'db_primary'
|
4
|
+
w.autostart = false
|
5
|
+
|
6
|
+
w.start = "/etc/init.d/mysql start"
|
7
|
+
w.stop = "/etc/init.d/mysql stop;"
|
8
|
+
w.restart = "/etc/init.d/mysql restart"
|
9
|
+
|
10
|
+
w.pid_file = "/var/run/mysqld/mysqld.pid"
|
11
|
+
|
12
|
+
default_configurations(w)
|
13
|
+
w.grace = 60.seconds
|
14
|
+
|
15
|
+
restart_if_resource_hog(w, :memory_usage => false)
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
if File.exists?('/etc/init.d/dkim-filter')
|
2
|
+
#we have it installed, so lets register it with God
|
3
|
+
God.watch do |w|
|
4
|
+
w.name = 'dkim_filter'
|
5
|
+
w.group = 'app'
|
6
|
+
w.autostart = false
|
7
|
+
|
8
|
+
w.start = "/etc/init.d/dkim-filter start"
|
9
|
+
w.stop = "/etc/init.d/dkim-filter stop"
|
10
|
+
w.restart = "/etc/init.d/dkim-filter restart"
|
11
|
+
|
12
|
+
w.pid_file = "/var/run/dkim-filter/dkim-filter.pid"
|
13
|
+
|
14
|
+
default_configurations(w)
|
15
|
+
restart_if_resource_hog(w, :memory_usage => 20.megabytes, :cpu_usage => 10.percent)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# For TextMate users, change the language type (at bottom of window, next to line/column counter, to ruby)
|
2
|
+
#
|
3
|
+
|
4
|
+
# TODO move to event-based config
|
5
|
+
|
6
|
+
applog(nil, :info, "loading /etc/god/master.conf")
|
7
|
+
|
8
|
+
require '/usr/local/ec2onrails/lib/god_helper'
|
9
|
+
require '/usr/local/ec2onrails/lib/roles_helper'
|
10
|
+
require '/usr/local/ec2onrails/lib/utils'
|
11
|
+
require "fileutils"
|
12
|
+
|
13
|
+
include GodHelper
|
14
|
+
include Ec2onrails::RolesHelper
|
15
|
+
|
16
|
+
APP_ROOT = "/mnt/app/current"
|
17
|
+
|
18
|
+
@configs = GodHelper::Configs.new
|
19
|
+
|
20
|
+
God.pid_file_directory = "/var/run/god"
|
21
|
+
|
22
|
+
applog(nil, :info, "About to load system configs at /etc/god/*.god")
|
23
|
+
God.load "/etc/god/*.god"
|
24
|
+
|
25
|
+
applog(nil, :info, "About to load application-specific configs at #{APP_ROOT}/config/god/*.god")
|
26
|
+
God.load "#{APP_ROOT}/config/god/*.god"
|
27
|
+
|
28
|
+
|
29
|
+
# at the end, we want to init the correct services
|
30
|
+
# need to put it into a thread because god is not finished
|
31
|
+
# initalizing at this point, so we need to let it finish
|
32
|
+
# so we can call init_services, which calls god directly
|
33
|
+
#
|
34
|
+
# using a fork copies over the processing space, causing
|
35
|
+
# god to reload again..and again...and again...
|
36
|
+
Thread.new do
|
37
|
+
sleep(2)
|
38
|
+
applog(nil, :info, "initializing services....")
|
39
|
+
system("/usr/local/ec2onrails/bin/init_services")
|
40
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = "memcached"
|
3
|
+
w.group = 'memcache'
|
4
|
+
w.autostart = false
|
5
|
+
|
6
|
+
w.start = "/etc/init.d/memcached start"
|
7
|
+
w.stop = "/etc/init.d/memcached stop"
|
8
|
+
w.restart = "/etc/init.d/memcached restart"
|
9
|
+
w.pid_file = "/var/run/memcached.pid"
|
10
|
+
|
11
|
+
default_configurations(w)
|
12
|
+
w.grace = 10.seconds
|
13
|
+
|
14
|
+
restart_if_resource_hog(w, :memory_usage => false)
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = "varnish"
|
3
|
+
w.group = "proxy"
|
4
|
+
w.autostart = false
|
5
|
+
|
6
|
+
w.start = "/etc/init.d/varnish start"
|
7
|
+
w.stop = "/etc/init.d/varnish stop"
|
8
|
+
w.restart = "/etc/init.d/varnish restart"
|
9
|
+
w.pid_file = "/var/run/varnishd.pid"
|
10
|
+
w.grace = 10.seconds
|
11
|
+
|
12
|
+
default_configurations(w)
|
13
|
+
|
14
|
+
# I'm not sure if it's very useful to monitor the varnishd memory usage,
|
15
|
+
# because it writes the pid of the varnishd parent process in it's pid file,
|
16
|
+
# so I assume that's what god is monitoring, and the varnishd parent starts
|
17
|
+
# a child process to do the real work.
|
18
|
+
# Also, the child process allocates all cache storage with malloc, so the
|
19
|
+
# VSS size can get very large and depends on the amount of storage
|
20
|
+
# configured. It relies on the OS to page unused portions to disk, but at
|
21
|
+
# the moment we don't have much swap configured (just using the defaults
|
22
|
+
# from Eric Hammond's base image).
|
23
|
+
restart_if_resource_hog(w, :memory_usage => 100.megabytes, :cpu_usage => 50.percent)
|
24
|
+
end
|
25
|
+
|
26
|
+
God.watch do |w|
|
27
|
+
w.name = "varnishncsa"
|
28
|
+
w.group = "proxy"
|
29
|
+
w.autostart = false
|
30
|
+
|
31
|
+
w.start = "/etc/init.d/varnishncsa start"
|
32
|
+
w.stop = "/etc/init.d/varnishncsa stop"
|
33
|
+
w.restart = "/etc/init.d/varnishncsa restart"
|
34
|
+
w.pid_file = "/var/run/varnishncsa.pid"
|
35
|
+
w.grace = 10.seconds
|
36
|
+
|
37
|
+
default_configurations(w)
|
38
|
+
|
39
|
+
restart_if_resource_hog(w, :memory_usage => 100.megabytes, :cpu_usage => 50.percent)
|
40
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = "system-checks"
|
3
|
+
w.start = true
|
4
|
+
w.interval = 10.minutes
|
5
|
+
|
6
|
+
|
7
|
+
w.behavior(:clean_pid_file)
|
8
|
+
|
9
|
+
|
10
|
+
# lifecycle
|
11
|
+
w.lifecycle do |on|
|
12
|
+
on.condition(:disk_usage) do |c|
|
13
|
+
c.mount_point = "/"
|
14
|
+
c.above = 75
|
15
|
+
c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
|
16
|
+
end
|
17
|
+
|
18
|
+
on.condition(:disk_usage) do |c|
|
19
|
+
c.mount_point = "/mnt"
|
20
|
+
c.above = 75
|
21
|
+
c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
|
22
|
+
end
|
23
|
+
|
24
|
+
on.condition(:memory_usage) do |c|
|
25
|
+
c.above = 80.percent
|
26
|
+
c.times = [3, 5] # 3 out of 5 intervals
|
27
|
+
c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
|
28
|
+
end
|
29
|
+
|
30
|
+
on.condition(:cpu_usage) do |c|
|
31
|
+
c.above = 90.percent
|
32
|
+
c.times = [5, 8]
|
33
|
+
c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = "nginx"
|
3
|
+
w.group = 'web'
|
4
|
+
|
5
|
+
w.start = "/etc/init.d/nginx start"
|
6
|
+
w.stop = "/etc/init.d/nginx stop"
|
7
|
+
w.restart = "/etc/init.d/nginx restart"
|
8
|
+
w.pid_file = "/var/run/nginx.pid"
|
9
|
+
w.autostart = false
|
10
|
+
|
11
|
+
default_configurations(w)
|
12
|
+
|
13
|
+
restart_if_resource_hog(w, :memory_usage => 250.megabytes) do |restart|
|
14
|
+
restart.condition(:http_response_code) do |c|
|
15
|
+
c.host = '127.0.0.1'
|
16
|
+
c.port = in_role?(:proxy) ? 81 : 80
|
17
|
+
c.path = '/nginx_status'
|
18
|
+
c.code_is_not = 200
|
19
|
+
c.timeout = 5.seconds
|
20
|
+
c.times = [3, 5] # 3 out of 5 intervals
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
# This script runs the ec2 startup scripts
|
23
|
+
|
24
|
+
# this is an ugly hack to make sure DHCP initialization is finished:
|
25
|
+
sleep 15
|
26
|
+
|
27
|
+
for SCRIPT in `ls -I README /usr/local/ec2onrails/startup-scripts/every-startup` ; do
|
28
|
+
"/usr/local/ec2onrails/startup-scripts/every-startup/$SCRIPT"
|
29
|
+
done
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
# This script runs the ec2 startup scripts
|
23
|
+
|
24
|
+
FILE=/mnt/.ec2onrails-first-boot
|
25
|
+
|
26
|
+
if [ ! -e $FILE ] ; then
|
27
|
+
|
28
|
+
# TODO improve this:
|
29
|
+
# this is an ugly hack to make sure DHCP initialization is finished:
|
30
|
+
sleep 15
|
31
|
+
|
32
|
+
for SCRIPT in `ls -I README /usr/local/ec2onrails/startup-scripts/first-startup` ; do
|
33
|
+
"/usr/local/ec2onrails/startup-scripts/first-startup/$SCRIPT"
|
34
|
+
done
|
35
|
+
|
36
|
+
touch $FILE
|
37
|
+
fi
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
#This is a start script for nginx. Tested on Unbuntu Edge.
|
4
|
+
#Should work on Ubuntu, Debian and probably a few other Linux distros.
|
5
|
+
#Change DAEMON and CONFIG_FILE if neccessary
|
6
|
+
|
7
|
+
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
8
|
+
|
9
|
+
|
10
|
+
#Location of nginx binary. Change path as neccessary
|
11
|
+
DAEMON=/usr/sbin/nginx
|
12
|
+
# DAEMON=/usr/local/nginx/sbin/nginx
|
13
|
+
#Location of configuration file. Change path as neccessary
|
14
|
+
CONFIG_FILE=/etc/nginx/nginx.conf
|
15
|
+
# CONFIG_FILE=/usr/local/nginx/conf/nginx.conf
|
16
|
+
|
17
|
+
|
18
|
+
DAEMON_OPTS="-c $CONFIG_FILE"
|
19
|
+
NAME=nginx
|
20
|
+
DESC="web server"
|
21
|
+
PIDFILE=/var/run/$NAME.pid
|
22
|
+
SCRIPTNAME=/etc/init.d/$NAME
|
23
|
+
|
24
|
+
|
25
|
+
#only run if binary can be found
|
26
|
+
test -x $DAEMON || exit 0
|
27
|
+
|
28
|
+
set -e
|
29
|
+
|
30
|
+
#import init-functions
|
31
|
+
. /lib/lsb/init-functions
|
32
|
+
|
33
|
+
case "$1" in
|
34
|
+
start)
|
35
|
+
log_daemon_msg "Starting $DESC" $NAME
|
36
|
+
if ! start-stop-daemon --start --quiet\
|
37
|
+
--pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
|
38
|
+
log_end_msg 1
|
39
|
+
else
|
40
|
+
log_end_msg 0
|
41
|
+
fi
|
42
|
+
;;
|
43
|
+
stop)
|
44
|
+
log_daemon_msg "Stopping $DESC" $NAME
|
45
|
+
if start-stop-daemon --quiet --stop --oknodo --retry 30\
|
46
|
+
--pidfile $PIDFILE --exec $DAEMON; then
|
47
|
+
rm -f $PIDFILE
|
48
|
+
log_end_msg 0
|
49
|
+
else
|
50
|
+
log_end_msg 1
|
51
|
+
fi
|
52
|
+
;;
|
53
|
+
reload)
|
54
|
+
log_daemon_msg "Reloading $DESC configuration" $NAME
|
55
|
+
if start-stop-daemon --stop --signal 2 --oknodo --retry 30\
|
56
|
+
--quiet --pidfile $PIDFILE --exec $DAEMON; then
|
57
|
+
if start-stop-daemon --start --quiet \
|
58
|
+
--pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
|
59
|
+
log_end_msg 0
|
60
|
+
else
|
61
|
+
log_end_msg 1
|
62
|
+
fi
|
63
|
+
else
|
64
|
+
log_end_msg 1
|
65
|
+
fi
|
66
|
+
;;
|
67
|
+
restart|force-reload)
|
68
|
+
$0 stop
|
69
|
+
sleep 1
|
70
|
+
$0 start
|
71
|
+
;;
|
72
|
+
*)
|
73
|
+
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
74
|
+
exit 1
|
75
|
+
;;
|
76
|
+
esac
|
77
|
+
|
78
|
+
exit 0
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/mnt/log/varnish/varnish.log /mnt/log/varnish/varnishncsa.log {
|
2
|
+
daily
|
3
|
+
rotate 7
|
4
|
+
missingok
|
5
|
+
dateext
|
6
|
+
sharedscripts
|
7
|
+
postrotate
|
8
|
+
for service in varnishlog varnishncsa; do
|
9
|
+
if /usr/bin/pgrep -P 1 $service >/dev/null; then
|
10
|
+
/usr/sbin/invoke-rc.d $service reload > /dev/null
|
11
|
+
fi
|
12
|
+
done
|
13
|
+
endscript
|
14
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# memcached default config file
|
2
|
+
# 2003 - Jay Bonci <jaybonci@debian.org>
|
3
|
+
# This configuration file is read by the start-memcached script provided as
|
4
|
+
# part of the Debian GNU/Linux distribution.
|
5
|
+
|
6
|
+
# Run memcached as a daemon. This command is implied, and is not needed for the
|
7
|
+
# daemon to run. See the README.Debian that comes with this package for more
|
8
|
+
# information.
|
9
|
+
-d
|
10
|
+
|
11
|
+
# Log memcached's output to /var/log/memcached
|
12
|
+
logfile /mnt/log/memcached.log
|
13
|
+
|
14
|
+
# Be verbose
|
15
|
+
# -v
|
16
|
+
|
17
|
+
# Be even more verbose (print client commands as well)
|
18
|
+
# -vv
|
19
|
+
|
20
|
+
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
|
21
|
+
# Note that the daemon will grow to this size, but does not start out holding this much
|
22
|
+
# memory
|
23
|
+
-m 128
|
24
|
+
|
25
|
+
# Default connection port is 11211
|
26
|
+
-p 11211
|
27
|
+
|
28
|
+
# Run the daemon as root. The start-memcached will default to running as root if no
|
29
|
+
# -u command is present in this config file
|
30
|
+
-u nobody
|
31
|
+
|
32
|
+
# Specify which IP address to listen on. The default is to listen on all IP addresses
|
33
|
+
# This parameter is one of the only security measures that memcached has, so make sure
|
34
|
+
# it's listening on a firewalled interface.
|
35
|
+
#-l 127.0.0.1
|
36
|
+
|
37
|
+
# Limit the number of simultaneous incoming connections. The daemon default is 1024
|
38
|
+
# -c 1024
|
39
|
+
|
40
|
+
# Lock down all paged memory. Consult with the README and homepage before you do this
|
41
|
+
# -k
|
42
|
+
|
43
|
+
# Return error when memory is exhausted (rather than removing items)
|
44
|
+
# -M
|
45
|
+
|
46
|
+
# Maximize core file limit
|
47
|
+
# -r
|