capistrano-memcached 1.0.0 → 1.1.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.
- checksums.yaml +7 -0
- data/README.md +6 -3
- data/lib/capistrano/memcached/version.rb +1 -1
- data/lib/capistrano/tasks/memcached.rake +13 -16
- data/lib/generators/capistrano/memcached/templates/memcached.erb +41 -5
- data/lib/generators/capistrano/memcached/templates/memcached.yml.erb +8 -1
- metadata +16 -29
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08c7994a3efaa51855d4ef96394c6a77eb523e54
|
4
|
+
data.tar.gz: f3c50b41488b2e626b010480a77dc13ab24f11f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 76e4cdd71f4d5f6acd2204f71006c30cdbd0fa8dc67a6f8a929cd12da99439333cbcfd2f244ed38f2b7557fa0c6467fca663bd882d7ea98bc4cd4ff05f9d100a
|
7
|
+
data.tar.gz: b80880afb79a280c72b10442e969ff1f25c6105cf2f9f6d1c1accb733709fef7755740023e89cd92a0d8a0e1f9e09ccc1a735b7592c2a9604aa6bb7df93d6ac1
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ see below for all available tasks
|
|
17
17
|
`capistrano-memcached` works only with Capistrano 3!
|
18
18
|
|
19
19
|
This project was heavily inspired (i.e. copied and reworked) by
|
20
|
-
[capistrano-nginx-unicorn](https://github.com/bruno-/capistrano-nginx-unicorn).
|
20
|
+
[capistrano-nginx-unicorn](https://github.com/bruno-/capistrano-nginx-unicorn) and [capistrano-recipes](https://github.com/mattdbridges/capistrano-recipes).
|
21
21
|
|
22
22
|
### Installation
|
23
23
|
|
@@ -77,7 +77,9 @@ Location of memcached log file.
|
|
77
77
|
The port memcached listens on.
|
78
78
|
|
79
79
|
* `set :memcached_ip, "127.0.0.1" # default listen only on localhost (for security) `<br/>
|
80
|
-
The IP memcached listens on.
|
80
|
+
The IP memcached listens on. If set to `:all`, memcached will listen on all IP addresses.
|
81
|
+
This parameter is one of the only security measures that memcached has, so make sure
|
82
|
+
it's listening on a firewalled interface.
|
81
83
|
|
82
84
|
* `set :memcached_roles, [:app]`<br/>
|
83
85
|
The roles on which memcached will be installed. `memcached.yml` will be available to all :app roles.
|
@@ -103,7 +105,8 @@ You can also provide path, where to generate templates:
|
|
103
105
|
|
104
106
|
|
105
107
|
### TODO
|
106
|
-
*
|
108
|
+
* Configure memcached server and clients for distributed setup.
|
109
|
+
* SASL authentication setup for memcached when running on multiple servers.
|
107
110
|
|
108
111
|
### More Capistrano automation?
|
109
112
|
|
@@ -9,11 +9,12 @@ namespace :load do
|
|
9
9
|
set :memcached_memory_limit, 128
|
10
10
|
set :memcached_log_file, "/var/log/memcached.log"
|
11
11
|
set :memcached_port, 11211
|
12
|
-
set :memcached_ip, "127.0.0.1" # listen only on localhost (for security)
|
12
|
+
set :memcached_ip, "127.0.0.1" # listen only on localhost by default (for security)
|
13
13
|
|
14
14
|
# this is where memcached will be installed. A handy memcached.yml file will be created on all :app roles in
|
15
15
|
# shared/config
|
16
16
|
set :memcached_roles, [:app]
|
17
|
+
set :memcached_client_roles, [:app]
|
17
18
|
set :memcached_user, "memcache"
|
18
19
|
|
19
20
|
set :memcached_app_config, -> { memcached_default_app_config_file }
|
@@ -22,42 +23,38 @@ namespace :load do
|
|
22
23
|
end
|
23
24
|
|
24
25
|
namespace :memcached do
|
26
|
+
%w[start stop restart].each do |command|
|
27
|
+
desc "#{command} Memcached"
|
28
|
+
task command do
|
29
|
+
on roles fetch(:memcached_roles) do
|
30
|
+
sudo :service, "memcached #{command}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
25
34
|
|
26
35
|
desc "Setup Memcached config file"
|
27
36
|
task :setup do
|
28
37
|
on roles fetch(:memcached_roles) do
|
29
38
|
sudo "useradd #{fetch(:memcached_user)}; true" # create user, but don't fail if it already exists
|
30
|
-
sudo "apt-get", "-y install memcached"
|
31
|
-
|
32
39
|
sudo_upload! mem_template("memcached.erb"), memcached_config_file
|
33
|
-
invoke "memcached:restart"
|
34
40
|
end
|
35
41
|
end
|
42
|
+
after 'memcached:setup', 'memcached:restart'
|
36
43
|
|
37
44
|
desc 'Setup Memcached app configuration'
|
38
45
|
task :setup_app_config do
|
39
|
-
on roles :
|
46
|
+
on roles fetch(:memcached_client_roles) do
|
40
47
|
execute :mkdir, '-pv', File.dirname(fetch(:memcached_app_config))
|
41
48
|
upload! mem_template('memcached.yml.erb'), fetch(:memcached_app_config)
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
45
52
|
task :memcached_yml_symlink do
|
46
|
-
on roles :
|
53
|
+
on roles fetch(:memcached_client_roles) do
|
47
54
|
set :linked_files, fetch(:linked_files, []).push("config/memcached.yml")
|
48
55
|
end
|
49
56
|
end
|
50
|
-
|
51
57
|
before 'deploy:symlink:linked_files', 'memcached:memcached_yml_symlink'
|
52
|
-
|
53
|
-
%w[start stop restart].each do |command|
|
54
|
-
desc "#{command} Memcached"
|
55
|
-
task command do
|
56
|
-
on roles fetch(:memcached_roles) do
|
57
|
-
sudo :service, "memcached #{command}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
58
|
end
|
62
59
|
|
63
60
|
desc 'Server setup tasks'
|
@@ -1,15 +1,51 @@
|
|
1
|
-
#
|
1
|
+
# memcached default config file.
|
2
|
+
# Adapted by capistrano-memcached gem: https://github.com/capistrano-plugins/capistrano-memcached
|
3
|
+
# Last change: <%= Time.now.to_s %>
|
4
|
+
# 2003 - Jay Bonci <jaybonci@debian.org>
|
5
|
+
# This configuration file is read by the start-memcached script provided as
|
6
|
+
# part of the Debian GNU/Linux distribution.
|
7
|
+
|
8
|
+
# Run memcached as a daemon. This command is implied, and is not needed for the
|
9
|
+
# daemon to run. See the README.Debian that comes with this package for more
|
10
|
+
# information.
|
2
11
|
-d
|
3
12
|
|
13
|
+
# Log memcached's output to /var/log/memcached
|
4
14
|
logfile <%= fetch(:memcached_log_file) %>
|
5
15
|
|
6
|
-
#
|
16
|
+
# Be verbose
|
17
|
+
# -v
|
18
|
+
|
19
|
+
# Be even more verbose (print client commands as well)
|
20
|
+
# -vv
|
21
|
+
|
22
|
+
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
|
23
|
+
# Note that the daemon will grow to this size, but does not start out holding this much
|
24
|
+
# memory
|
7
25
|
-m <%= fetch(:memcached_memory_limit) %>
|
8
26
|
|
9
|
-
# port
|
27
|
+
# Default connection port is 11211
|
10
28
|
-p <%= fetch(:memcached_port) %>
|
11
29
|
|
12
|
-
#
|
30
|
+
# Run the daemon as root. The start-memcached will default to running as root if no
|
31
|
+
# -u command is present in this config file
|
13
32
|
-u <%= fetch(:memcached_user) %>
|
14
33
|
|
15
|
-
|
34
|
+
# Specify which IP address to listen on. The default is to listen on all IP addresses
|
35
|
+
# This parameter is one of the only security measures that memcached has, so make sure
|
36
|
+
# it's listening on a firewalled interface.
|
37
|
+
<% unless fetch(:memcached_ip) == :all %>
|
38
|
+
-l <%= fetch(:memcached_ip) %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
# Limit the number of simultaneous incoming connections. The daemon default is 1024
|
42
|
+
# -c 1024
|
43
|
+
|
44
|
+
# Lock down all paged memory. Consult with the README and homepage before you do this
|
45
|
+
# -k
|
46
|
+
|
47
|
+
# Return error when memory is exhausted (rather than removing items)
|
48
|
+
# -M
|
49
|
+
|
50
|
+
# Maximize core file limit
|
51
|
+
# -r
|
@@ -1,2 +1,9 @@
|
|
1
1
|
<%= fetch(:stage) %>:
|
2
|
-
host:
|
2
|
+
host:
|
3
|
+
<% if fetch(:memcached_ip) == :all %>
|
4
|
+
<% roles(fetch(:memcached_roles)).each do |role| %>
|
5
|
+
- '<%= role.hostname %>:<%= fetch(:memcached_port)%>'
|
6
|
+
<% end %>
|
7
|
+
<% else %>
|
8
|
+
'<%=fetch(:memcached_ip)%>:<%=fetch(:memcached_port)%>'
|
9
|
+
<% end %>
|
metadata
CHANGED
@@ -1,82 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ruben Stranders
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capistrano
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '3.1'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: sshkit
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.2.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.2.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
|
-
description:
|
63
|
-
|
55
|
+
description: |
|
56
|
+
Capistrano tasks for automatic and sensible memcached configuration.
|
64
57
|
Enables zero downtime deployments of Rails applications. Configs can be
|
65
|
-
|
66
58
|
copied to the application using generators and easily customized.
|
67
|
-
|
68
59
|
Works *only* with Capistrano 3+.
|
69
|
-
|
70
60
|
Heavily inspired (i.e. copied and reworked) by https://github.com/bruno-/capistrano-unicorn-nginx
|
71
|
-
|
72
|
-
'
|
73
61
|
email:
|
74
62
|
- r.stranders@gmail.com
|
75
63
|
executables: []
|
76
64
|
extensions: []
|
77
65
|
extra_rdoc_files: []
|
78
66
|
files:
|
79
|
-
- .gitignore
|
67
|
+
- ".gitignore"
|
80
68
|
- Gemfile
|
81
69
|
- LICENSE.md
|
82
70
|
- README.md
|
@@ -94,26 +82,25 @@ files:
|
|
94
82
|
- lib/generators/capistrano/memcached/templates/memcached.yml.erb
|
95
83
|
homepage: https://github.com/rhomeister/capistrano-memcached
|
96
84
|
licenses: []
|
85
|
+
metadata: {}
|
97
86
|
post_install_message:
|
98
87
|
rdoc_options: []
|
99
88
|
require_paths:
|
100
89
|
- lib
|
101
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
91
|
requirements:
|
104
|
-
- -
|
92
|
+
- - ">="
|
105
93
|
- !ruby/object:Gem::Version
|
106
94
|
version: '0'
|
107
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
96
|
requirements:
|
110
|
-
- -
|
97
|
+
- - ">="
|
111
98
|
- !ruby/object:Gem::Version
|
112
99
|
version: '0'
|
113
100
|
requirements: []
|
114
101
|
rubyforge_project:
|
115
|
-
rubygems_version:
|
102
|
+
rubygems_version: 2.2.2
|
116
103
|
signing_key:
|
117
|
-
specification_version:
|
104
|
+
specification_version: 4
|
118
105
|
summary: Capistrano tasks for automatic and sensible memcached configuration.
|
119
106
|
test_files: []
|