capistrano-rails-server 1.2.0 → 2.0.2
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 +6 -14
- data/README.md +163 -173
- data/capistrano-rails-server.gemspec +19 -19
- data/lib/capistrano-rails-server.rb +16 -0
- data/lib/capistrano-rails-server/recipes/base.rb +16 -8
- data/lib/capistrano-rails-server/recipes/check.rb +1 -7
- data/lib/capistrano-rails-server/recipes/common.rb +18 -8
- data/lib/capistrano-rails-server/recipes/key.rb +23 -27
- data/lib/capistrano-rails-server/recipes/nginx.rb +10 -20
- data/lib/capistrano-rails-server/recipes/passenger.rb +23 -0
- data/lib/capistrano-rails-server/recipes/postfix.rb +26 -0
- data/lib/capistrano-rails-server/recipes/postgresql.rb +43 -22
- data/lib/capistrano-rails-server/recipes/rvm.rb +25 -0
- data/lib/capistrano-rails-server/recipes/templates/nginx_init.erb +75 -0
- data/lib/capistrano-rails-server/recipes/templates/nginx_passenger.erb +127 -0
- data/lib/capistrano-rails-server/recipes/templates/postfix_main.erb +39 -0
- data/lib/capistrano-rails-server/recipes/templates/postgresql.conf.erb +595 -0
- metadata +37 -19
- data/lib/capistrano-rails-server/recipes/rbenv.rb +0 -35
- data/lib/capistrano-rails-server/recipes/templates/nginx_unicorn.erb +0 -27
- data/lib/capistrano-rails-server/recipes/templates/unicorn.rb.erb +0 -8
- data/lib/capistrano-rails-server/recipes/templates/unicorn_init.erb +0 -84
- data/lib/capistrano-rails-server/recipes/unicorn.rb +0 -35
metadata
CHANGED
@@ -1,45 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-rails-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drakula2k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.15'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rvm-capistrano
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
description: That gem includes capistrano recipes to install and configure ROR production
|
42
|
-
|
56
|
+
environment with RVM, Nginx, Passenger, Postgresql and Postfix.
|
43
57
|
email: drakula2k@gmail.com
|
44
58
|
executables: []
|
45
59
|
extensions: []
|
@@ -47,18 +61,21 @@ extra_rdoc_files: []
|
|
47
61
|
files:
|
48
62
|
- README.md
|
49
63
|
- capistrano-rails-server.gemspec
|
64
|
+
- lib/capistrano-rails-server.rb
|
50
65
|
- lib/capistrano-rails-server/recipes/base.rb
|
51
66
|
- lib/capistrano-rails-server/recipes/check.rb
|
52
67
|
- lib/capistrano-rails-server/recipes/common.rb
|
53
68
|
- lib/capistrano-rails-server/recipes/key.rb
|
54
69
|
- lib/capistrano-rails-server/recipes/nginx.rb
|
70
|
+
- lib/capistrano-rails-server/recipes/passenger.rb
|
71
|
+
- lib/capistrano-rails-server/recipes/postfix.rb
|
55
72
|
- lib/capistrano-rails-server/recipes/postgresql.rb
|
56
|
-
- lib/capistrano-rails-server/recipes/
|
57
|
-
- lib/capistrano-rails-server/recipes/templates/
|
73
|
+
- lib/capistrano-rails-server/recipes/rvm.rb
|
74
|
+
- lib/capistrano-rails-server/recipes/templates/nginx_init.erb
|
75
|
+
- lib/capistrano-rails-server/recipes/templates/nginx_passenger.erb
|
76
|
+
- lib/capistrano-rails-server/recipes/templates/postfix_main.erb
|
77
|
+
- lib/capistrano-rails-server/recipes/templates/postgresql.conf.erb
|
58
78
|
- lib/capistrano-rails-server/recipes/templates/postgresql.yml.erb
|
59
|
-
- lib/capistrano-rails-server/recipes/templates/unicorn.rb.erb
|
60
|
-
- lib/capistrano-rails-server/recipes/templates/unicorn_init.erb
|
61
|
-
- lib/capistrano-rails-server/recipes/unicorn.rb
|
62
79
|
homepage: https://github.com/Drakula2k/capistrano-rails-server
|
63
80
|
licenses: []
|
64
81
|
metadata: {}
|
@@ -68,19 +85,20 @@ require_paths:
|
|
68
85
|
- lib
|
69
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
87
|
requirements:
|
71
|
-
- -
|
88
|
+
- - ">="
|
72
89
|
- !ruby/object:Gem::Version
|
73
90
|
version: '0'
|
74
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
92
|
requirements:
|
76
|
-
- -
|
93
|
+
- - ">="
|
77
94
|
- !ruby/object:Gem::Version
|
78
95
|
version: '0'
|
79
96
|
requirements: []
|
80
97
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.2.1
|
82
99
|
signing_key:
|
83
100
|
specification_version: 4
|
84
|
-
summary: Capistrano recipes to setup
|
85
|
-
environment.
|
101
|
+
summary: Capistrano recipes to setup RVM, Nginx, Passenger, Postgresql and Postfix
|
102
|
+
production environment.
|
86
103
|
test_files: []
|
104
|
+
has_rdoc:
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "capistrano-rails-server/recipes/common"
|
2
|
-
|
3
|
-
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
4
|
-
Capistrano::Configuration.instance(:must_exist) :
|
5
|
-
Capistrano.configuration(:must_exist)
|
6
|
-
|
7
|
-
configuration.load do
|
8
|
-
set_default :ruby_version, "2.0.0-p247"
|
9
|
-
set_default :rbenv_bootstrap, "bootstrap-ubuntu-12-04"
|
10
|
-
|
11
|
-
namespace :rbenv do
|
12
|
-
desc "Install rbenv, Ruby, and the Bundler gem"
|
13
|
-
task :install, roles: :app do
|
14
|
-
run "#{sudo} apt-get -y install curl git-core"
|
15
|
-
run "curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash"
|
16
|
-
bashrc = <<-BASHRC
|
17
|
-
if [ -d $HOME/.rbenv ]; then
|
18
|
-
export PATH="$HOME/.rbenv/bin:$PATH"
|
19
|
-
eval "$(rbenv init -)"
|
20
|
-
fi
|
21
|
-
BASHRC
|
22
|
-
put bashrc, "/tmp/rbenvrc"
|
23
|
-
run "cat /tmp/rbenvrc ~/.bashrc > ~/.bashrc.tmp"
|
24
|
-
run "mv ~/.bashrc.tmp ~/.bashrc"
|
25
|
-
run %q{export PATH="$HOME/.rbenv/bin:$PATH"}
|
26
|
-
run %q{eval "$(rbenv init -)"}
|
27
|
-
run "rbenv #{rbenv_bootstrap}"
|
28
|
-
run "rbenv install -f #{ruby_version}"
|
29
|
-
run "rbenv global #{ruby_version}"
|
30
|
-
run "gem install bundler --no-ri --no-rdoc"
|
31
|
-
run "rbenv rehash"
|
32
|
-
end
|
33
|
-
after "deploy:install", "rbenv:install"
|
34
|
-
end
|
35
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
upstream unicorn {
|
2
|
-
server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
|
3
|
-
}
|
4
|
-
|
5
|
-
server {
|
6
|
-
listen 80 default deferred;
|
7
|
-
# server_name example.com;
|
8
|
-
root <%= current_path %>/public;
|
9
|
-
|
10
|
-
location ^~ /assets/ {
|
11
|
-
gzip_static on;
|
12
|
-
expires max;
|
13
|
-
add_header Cache-Control public;
|
14
|
-
}
|
15
|
-
|
16
|
-
try_files $uri/index.html $uri @unicorn;
|
17
|
-
location @unicorn {
|
18
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
19
|
-
proxy_set_header Host $http_host;
|
20
|
-
proxy_redirect off;
|
21
|
-
proxy_pass http://unicorn;
|
22
|
-
}
|
23
|
-
|
24
|
-
error_page 500 502 503 504 /500.html;
|
25
|
-
client_max_body_size 4G;
|
26
|
-
keepalive_timeout 10;
|
27
|
-
}
|
@@ -1,84 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
### BEGIN INIT INFO
|
3
|
-
# Provides: unicorn
|
4
|
-
# Required-Start: $remote_fs $syslog
|
5
|
-
# Required-Stop: $remote_fs $syslog
|
6
|
-
# Default-Start: 2 3 4 5
|
7
|
-
# Default-Stop: 0 1 6
|
8
|
-
# Short-Description: Manage unicorn server
|
9
|
-
# Description: Start, stop, restart unicorn server for a specific application.
|
10
|
-
### END INIT INFO
|
11
|
-
set -e
|
12
|
-
|
13
|
-
# Feel free to change any of the following variables for your app:
|
14
|
-
TIMEOUT=${TIMEOUT-60}
|
15
|
-
APP_ROOT=<%= current_path %>
|
16
|
-
PID=<%= unicorn_pid %>
|
17
|
-
CMD="cd <%= current_path %>; bundle exec unicorn -D -c <%= unicorn_config %> -E <%= unicorn_env %>"
|
18
|
-
AS_USER=<%= unicorn_user %>
|
19
|
-
set -u
|
20
|
-
|
21
|
-
OLD_PIN="$PID.oldbin"
|
22
|
-
|
23
|
-
sig () {
|
24
|
-
test -s "$PID" && kill -$1 `cat $PID`
|
25
|
-
}
|
26
|
-
|
27
|
-
oldsig () {
|
28
|
-
test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
|
29
|
-
}
|
30
|
-
|
31
|
-
run () {
|
32
|
-
if [ "$(id -un)" = "$AS_USER" ]; then
|
33
|
-
eval $1
|
34
|
-
else
|
35
|
-
su -c "$1" - $AS_USER
|
36
|
-
fi
|
37
|
-
}
|
38
|
-
|
39
|
-
case "$1" in
|
40
|
-
start)
|
41
|
-
sig 0 && echo >&2 "Already running" && exit 0
|
42
|
-
run "$CMD"
|
43
|
-
;;
|
44
|
-
stop)
|
45
|
-
sig QUIT && exit 0
|
46
|
-
echo >&2 "Not running"
|
47
|
-
;;
|
48
|
-
force-stop)
|
49
|
-
sig TERM && exit 0
|
50
|
-
echo >&2 "Not running"
|
51
|
-
;;
|
52
|
-
restart|reload)
|
53
|
-
sig HUP && echo reloaded OK && exit 0
|
54
|
-
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
55
|
-
run "$CMD"
|
56
|
-
;;
|
57
|
-
upgrade)
|
58
|
-
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
|
59
|
-
then
|
60
|
-
n=$TIMEOUT
|
61
|
-
while test -s $OLD_PIN && test $n -ge 0
|
62
|
-
do
|
63
|
-
printf '.' && sleep 1 && n=$(( $n - 1 ))
|
64
|
-
done
|
65
|
-
echo
|
66
|
-
|
67
|
-
if test $n -lt 0 && test -s $OLD_PIN
|
68
|
-
then
|
69
|
-
echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
|
70
|
-
exit 1
|
71
|
-
fi
|
72
|
-
exit 0
|
73
|
-
fi
|
74
|
-
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
75
|
-
run "$CMD"
|
76
|
-
;;
|
77
|
-
reopen-logs)
|
78
|
-
sig USR1
|
79
|
-
;;
|
80
|
-
*)
|
81
|
-
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
|
82
|
-
exit 1
|
83
|
-
;;
|
84
|
-
esac
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "capistrano-rails-server/recipes/common"
|
2
|
-
|
3
|
-
configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
4
|
-
Capistrano::Configuration.instance(:must_exist) :
|
5
|
-
Capistrano.configuration(:must_exist)
|
6
|
-
|
7
|
-
configuration.load do
|
8
|
-
set_default(:unicorn_user) { user }
|
9
|
-
set_default(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
|
10
|
-
set_default(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
|
11
|
-
set_default(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
|
12
|
-
set_default(:unicorn_workers, 2)
|
13
|
-
set_default(:unicorn_env, "production")
|
14
|
-
|
15
|
-
namespace :unicorn do
|
16
|
-
desc "Setup Unicorn initializer and app configuration"
|
17
|
-
task :setup, roles: :app do
|
18
|
-
run "mkdir -p #{shared_path}/config"
|
19
|
-
template "unicorn.rb.erb", unicorn_config
|
20
|
-
template "unicorn_init.erb", "/tmp/unicorn_init"
|
21
|
-
run "chmod +x /tmp/unicorn_init"
|
22
|
-
run "#{sudo} mv /tmp/unicorn_init /etc/init.d/unicorn_#{application}"
|
23
|
-
run "#{sudo} update-rc.d -f unicorn_#{application} defaults"
|
24
|
-
end
|
25
|
-
after "deploy:setup", "unicorn:setup"
|
26
|
-
|
27
|
-
%w[start stop restart].each do |command|
|
28
|
-
desc "#{command} unicorn"
|
29
|
-
task command, roles: :app do
|
30
|
-
run "service unicorn_#{application} #{command}"
|
31
|
-
end
|
32
|
-
after "deploy:#{command}", "unicorn:#{command}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|