j-cap-recipes 0.0.1
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/Gemfile +4 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/capistrano-recipes.gemspec +24 -0
- data/lib/capistrano-recipes/check.rb +1 -0
- data/lib/capistrano-recipes/database.rb +1 -0
- data/lib/capistrano-recipes/delayed_job.rb +1 -0
- data/lib/capistrano-recipes/hpusher.rb +1 -0
- data/lib/capistrano-recipes/log.rb +1 -0
- data/lib/capistrano-recipes/monit.rb +1 -0
- data/lib/capistrano-recipes/nginx.rb +1 -0
- data/lib/capistrano-recipes/rails.rb +1 -0
- data/lib/capistrano-recipes/rake.rb +1 -0
- data/lib/capistrano-recipes/setup.rb +1 -0
- data/lib/capistrano-recipes/tasks/check.rake +31 -0
- data/lib/capistrano-recipes/tasks/database.rake +83 -0
- data/lib/capistrano-recipes/tasks/delayed_job.rake +22 -0
- data/lib/capistrano-recipes/tasks/hpusher.rake +6 -0
- data/lib/capistrano-recipes/tasks/log.rake +11 -0
- data/lib/capistrano-recipes/tasks/monit.rake +29 -0
- data/lib/capistrano-recipes/tasks/nginx.rake +23 -0
- data/lib/capistrano-recipes/tasks/rails.rake +77 -0
- data/lib/capistrano-recipes/tasks/rake.rake +12 -0
- data/lib/capistrano-recipes/tasks/setup.rake +11 -0
- data/lib/capistrano-recipes/tasks/templates/database.yml.erb +20 -0
- data/lib/capistrano-recipes/tasks/templates/nginx/site.conf.erb +28 -0
- data/lib/capistrano-recipes/tasks/unicorn.rake +22 -0
- data/lib/capistrano-recipes/unicorn.rb +1 -0
- data/lib/capistrano-recipes/version.rb +5 -0
- data/lib/capistrano-recipes.rb +1 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cfa78cdb044d937296376349fdd2ffa3f43146cd
|
4
|
+
data.tar.gz: 5e4cbb9f5ae2a42bb0e2f246ef96fe6a1612fcd3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fa43d5ee9c180e891e95349b9c7fad37593eb9146e97da50de580eb20e0cda4c9439d4218942b68af8337fddd233ef0321a30ed24ec2161f6aea6a469b4cd9bf
|
7
|
+
data.tar.gz: ff5364c94a48fc647cca895347b1be5f3979d83376141c762d8d0b3d65c30196d237c05d231667fa00720c707de7d27d298a0cb474cd4190e8f948dec05eb432
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-recipes (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
capistrano (3.0.0)
|
10
|
+
i18n
|
11
|
+
rake (>= 10.0.0)
|
12
|
+
sshkit (>= 0.0.23)
|
13
|
+
i18n (0.6.5)
|
14
|
+
net-scp (1.1.2)
|
15
|
+
net-ssh (>= 2.6.5)
|
16
|
+
net-ssh (2.7.0)
|
17
|
+
rake (10.1.0)
|
18
|
+
sshkit (1.1.0)
|
19
|
+
net-scp
|
20
|
+
net-ssh
|
21
|
+
term-ansicolor
|
22
|
+
term-ansicolor (1.2.2)
|
23
|
+
tins (~> 0.8)
|
24
|
+
tins (0.12.0)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
bundler (~> 1.3)
|
31
|
+
capistrano (>= 3.0.0)
|
32
|
+
capistrano-recipes!
|
33
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Michael Nikitochkin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Capistrano::Recipes
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'capistrano-recipes', require: false, group: :development
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install capistrano-recipes
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
In the `Capfile` to include all recipes add:
|
22
|
+
|
23
|
+
require 'capistrano-recipes'
|
24
|
+
|
25
|
+
If you want to load only specified recipe:
|
26
|
+
|
27
|
+
require 'capistrano-recipes/setup'
|
28
|
+
require 'capistrano-recipes/check'
|
29
|
+
require 'capistrano-recipes/nginx'
|
30
|
+
require 'capistrano-recipes/monit'
|
31
|
+
require 'capistrano-recipes/database'
|
32
|
+
require 'capistrano-recipes/delayed_job'
|
33
|
+
require 'capistrano-recipes/log'
|
34
|
+
require 'capistrano-recipes/rails'
|
35
|
+
require 'capistrano-recipes/unicorn'
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano-recipes/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "j-cap-recipes"
|
8
|
+
spec.version = Capistrano::Recipes::VERSION
|
9
|
+
spec.authors = ["Michael Nikitochkin"]
|
10
|
+
spec.email = ["miry.sof@gmail.com"]
|
11
|
+
spec.description = %q{}
|
12
|
+
spec.summary = %q{Capistrano 3 recipes for nginx, monit, rails log, setup, unicorn}
|
13
|
+
spec.homepage = "https://github.com/jetthoughts/capistrano-recipes"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "capistrano", '>= 3.0.0'
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/check.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/database.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/delayed_job.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/hpusher.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/log.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/monit.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/nginx.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/rails.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/rake.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/setup.rake", __FILE__)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
namespace :check do
|
4
|
+
|
5
|
+
# Check the nodejs runtime
|
6
|
+
task :nodejs do
|
7
|
+
on roles(:all) do |host|
|
8
|
+
# centos responds to node
|
9
|
+
if test("[ $(which nodejs || which node ) ]")
|
10
|
+
info "Javascript runtime nodejs is available on #{host}"
|
11
|
+
else
|
12
|
+
error "Javascript runtime nodejs is not available on #{host}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
after 'deploy:check', 'deploy:check:nodejs'
|
17
|
+
|
18
|
+
task :imagemagick do
|
19
|
+
on roles(:all) do |host|
|
20
|
+
if test("[ $(which identify) ]")
|
21
|
+
info "Javascript runtime nodejs is available on #{host}"
|
22
|
+
else
|
23
|
+
error "Javascript runtime nodejs is not available on #{host}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
after 'deploy:check', 'deploy:check:imagemagick'
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
namespace :check do
|
5
|
+
task :linked_files => 'config/database.yml'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :db do
|
10
|
+
desc 'Created the DB'
|
11
|
+
task :create do
|
12
|
+
on primary fetch(:migration_role) do
|
13
|
+
within release_path do
|
14
|
+
with rails_env: fetch(:rails_env) do
|
15
|
+
execute :rake, 'db:create'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Create backup of the DB'
|
22
|
+
task :backup do
|
23
|
+
on primary fetch(:migration_role) do
|
24
|
+
within release_path do
|
25
|
+
with rails_env: fetch(:rails_env) do
|
26
|
+
execute :rake, 'db:backup'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Restore the latest dump of the DB'
|
33
|
+
task :restore do
|
34
|
+
on primary fetch(:migration_role) do
|
35
|
+
within release_path do
|
36
|
+
with rails_env: fetch(:rails_env) do
|
37
|
+
execute :rake, 'db:restore'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Downlaod to local machine the latest backup'
|
44
|
+
task :dump_download do
|
45
|
+
on primary fetch(:migration_role) do
|
46
|
+
within release_path do
|
47
|
+
bakup_file = "db/backups/#{fetch(:application)}_#{fetch(:rails_env).to_s}_latest.dump"
|
48
|
+
download! "#{shared_path}/#{bakup_file}", bakup_file
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
remote_file 'config/database.yml' => '/tmp/database.yml', roles: :app
|
56
|
+
after 'config/database.yml', :remove_db_tmp_file do
|
57
|
+
File.delete '/tmp/database.yml'
|
58
|
+
end
|
59
|
+
|
60
|
+
file '/tmp/database.yml' do |t|
|
61
|
+
default_template = <<-EOF
|
62
|
+
base: &base
|
63
|
+
adapter: sqlite3
|
64
|
+
timeout: 5000
|
65
|
+
development:
|
66
|
+
database: #{shared_path}/db/development.sqlite3
|
67
|
+
<<: *base
|
68
|
+
test:
|
69
|
+
database: #{shared_path}/db/test.sqlite3
|
70
|
+
<<: *base
|
71
|
+
production:
|
72
|
+
database: #{shared_path}/db/production.sqlite3
|
73
|
+
<<: *base
|
74
|
+
EOF
|
75
|
+
|
76
|
+
location = fetch(:template_dir, 'lib/capistrano/tasks/templates') + '/database.yml.erb'
|
77
|
+
template = File.file?(location) ? File.read(location) : default_template
|
78
|
+
|
79
|
+
config = ERB.new(template)
|
80
|
+
File.open t.name, 'w' do |f|
|
81
|
+
f.puts config.result(binding)
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :delayed_job do
|
2
|
+
desc 'Restart the delayed_job process'
|
3
|
+
task :restart do
|
4
|
+
invoke('monit:exec', "-g #{fetch(:monit_delayed_job_name)} restart")
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'Stop the delayed_job process'
|
8
|
+
task :stop do
|
9
|
+
invoke('monit:exec', "-g #{fetch(:monit_delayed_job_name)} stop")
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Start the delayed_job process'
|
13
|
+
task :start do
|
14
|
+
invoke('monit:exec', "-g #{fetch(:monit_delayed_job_name)} start")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :load do
|
19
|
+
task :defaults do
|
20
|
+
set :monit_delayed_job_name, 'delayed_job'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :log do
|
2
|
+
desc 'Tail current log file from the remote'
|
3
|
+
task :tail, :filepattern do |t, args|
|
4
|
+
filepattern = args[:filepattern] || fetch(:stage)
|
5
|
+
on roles(:all) do |host|
|
6
|
+
within "#{shared_path}/log" do
|
7
|
+
execute :tail, '-f', "#{filepattern}.log"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :monit do
|
2
|
+
desc 'Restart monit'
|
3
|
+
task :restart do
|
4
|
+
on roles(:app), in: :sequence, wait: 5 do
|
5
|
+
execute 'sudo', '/etc/init.d/monit restart'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Stop monit'
|
10
|
+
task :stop do
|
11
|
+
on roles(:app), in: :sequence, wait: 5 do
|
12
|
+
execute 'sudo', '/etc/init.d/monit stop'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Start monit'
|
17
|
+
task :start do
|
18
|
+
on roles(:app), in: :sequence, wait: 5 do
|
19
|
+
execute 'sudo', '/etc/init.d/monit start'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Exec monit command'
|
24
|
+
task :exec, :command do |task, args|
|
25
|
+
on roles(:app), in: :sequence, wait: 5 do
|
26
|
+
execute 'sudo', 'monit', args[:command]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
namespace :nginx do
|
2
|
+
desc 'Restart nginx'
|
3
|
+
task :restart do
|
4
|
+
on roles(:app), in: :sequence, wait: 5 do
|
5
|
+
execute 'sudo', '/etc/init.d/nginx restart'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Stop nginx'
|
10
|
+
task :stop do
|
11
|
+
on roles(:app), in: :sequence, wait: 5 do
|
12
|
+
execute 'sudo', '/etc/init.d/nginx stop'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Start nginx'
|
17
|
+
task :start do
|
18
|
+
on roles(:app), in: :sequence, wait: 5 do
|
19
|
+
execute 'sudo', '/etc/init.d/nginx start'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
SSHKit.config.command_map[:rails] = "bundle exec rails"
|
2
|
+
|
3
|
+
namespace :rails do
|
4
|
+
desc 'Execute rails console'
|
5
|
+
task :console do
|
6
|
+
on roles(:app) do
|
7
|
+
within release_path do
|
8
|
+
with rails_env: fetch(:rails_env) do
|
9
|
+
_execute_interactive(:rails, :console)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
module SSHKit
|
18
|
+
module Backend
|
19
|
+
class Netssh
|
20
|
+
def _execute_interactive(*args)
|
21
|
+
command(*args).tap do |cmd|
|
22
|
+
output << cmd
|
23
|
+
cmd.started = true
|
24
|
+
ssh.open_channel do |chan|
|
25
|
+
chan.request_pty if Netssh.config.pty
|
26
|
+
chan.exec cmd.to_command do |ch, success|
|
27
|
+
chan.on_data do |ch, data|
|
28
|
+
cmd.stdout = data
|
29
|
+
cmd.full_stdout += data
|
30
|
+
|
31
|
+
if data.include?('irb(main):')
|
32
|
+
print data
|
33
|
+
command = $stdin.gets
|
34
|
+
command = "exit\n" if command == nil
|
35
|
+
ch.send_data command
|
36
|
+
else
|
37
|
+
output << cmd
|
38
|
+
end
|
39
|
+
end
|
40
|
+
chan.on_extended_data do |ch, type, data|
|
41
|
+
cmd.stderr = data
|
42
|
+
cmd.full_stderr += data
|
43
|
+
output << cmd
|
44
|
+
end
|
45
|
+
chan.on_request("exit-status") do |ch, data|
|
46
|
+
cmd.stdout = ''
|
47
|
+
cmd.stderr = ''
|
48
|
+
cmd.exit_status = data.read_long
|
49
|
+
output << cmd
|
50
|
+
end
|
51
|
+
#chan.on_request("exit-signal") do |ch, data|
|
52
|
+
# # TODO: This gets called if the program is killed by a signal
|
53
|
+
# # might also be a worthwhile thing to report
|
54
|
+
# exit_signal = data.read_string.to_i
|
55
|
+
# warn ">>> " + exit_signal.inspect
|
56
|
+
# output << cmd
|
57
|
+
#end
|
58
|
+
chan.on_open_failed do |ch|
|
59
|
+
# TODO: What do do here?
|
60
|
+
# I think we should raise something
|
61
|
+
end
|
62
|
+
chan.on_process do |ch|
|
63
|
+
# TODO: I don't know if this is useful
|
64
|
+
end
|
65
|
+
chan.on_eof do |ch|
|
66
|
+
# TODO: chan sends EOF before the exit status has been
|
67
|
+
# writtend
|
68
|
+
end
|
69
|
+
end
|
70
|
+
chan.wait
|
71
|
+
end
|
72
|
+
ssh.loop
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# store your custom template at foo/bar/database.yml.erb `set :template_dir, "foo/bar"`
|
2
|
+
#
|
3
|
+
# example of database template
|
4
|
+
|
5
|
+
base: &base
|
6
|
+
adapter: postgresql
|
7
|
+
encoding: unicode
|
8
|
+
timeout: 5000
|
9
|
+
username: deployer
|
10
|
+
# password: <%#= ask(:db_password, SecureRandom.base64(6)) && fetch(:db_password) %>
|
11
|
+
# host: localhost
|
12
|
+
# port: 5432
|
13
|
+
|
14
|
+
test:
|
15
|
+
database: <%= fetch(:application) %>_test
|
16
|
+
<<: *base
|
17
|
+
|
18
|
+
<%= fetch(:rails_env).to_s %>:
|
19
|
+
database: <%= fetch(:application) %>_<%= fetch(:rails_env).to_s %>
|
20
|
+
<<: *base
|
@@ -0,0 +1,28 @@
|
|
1
|
+
upstream <%= fetch(:application) %>_upstream {
|
2
|
+
server unix:<%= shared_path.join('tmp/sockets/unicorn.sock') %> fail_timeout=0;
|
3
|
+
}
|
4
|
+
|
5
|
+
server {
|
6
|
+
listen 80;
|
7
|
+
server_name <%= fetch(:application) %>;
|
8
|
+
|
9
|
+
error_log <%= shared_path.join('log/nginx-error.log') %>;
|
10
|
+
access_log <%= shared_path.join('log/nginx-access.log') %>;
|
11
|
+
|
12
|
+
root <%= current_path.join('public') %>;
|
13
|
+
|
14
|
+
try_files $uri/index.html $uri.html $uri @app;
|
15
|
+
|
16
|
+
location @app {
|
17
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
18
|
+
proxy_set_header Host $http_host;
|
19
|
+
proxy_redirect off;
|
20
|
+
|
21
|
+
proxy_pass http://<%= fetch(:application) %>_upstream;
|
22
|
+
}
|
23
|
+
|
24
|
+
error_page 500 502 503 504 /500.html;
|
25
|
+
location = /500.html {
|
26
|
+
root <%= current_path.join('public') %>;
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :unicorn do
|
2
|
+
desc 'Restart the unicorn process'
|
3
|
+
task :restart do
|
4
|
+
invoke('monit:exec', "-g #{fetch(:monit_unicorn_name)} restart")
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'Stop the unicorn process'
|
8
|
+
task :stop do
|
9
|
+
invoke('monit:exec', "-g #{fetch(:monit_unicorn_name)} stop")
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Start the unicorn process'
|
13
|
+
task :start do
|
14
|
+
invoke('monit:exec', "-g #{fetch(:monit_unicorn_name)} start")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :load do
|
19
|
+
task :defaults do
|
20
|
+
set :monit_unicorn_name, "unicorn"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/unicorn.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob('lib/capistrano/tasks/*.rb').each { |r| require r }
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: j-cap-recipes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Nikitochkin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capistrano
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- miry.sof@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- capistrano-recipes.gemspec
|
68
|
+
- lib/capistrano-recipes.rb
|
69
|
+
- lib/capistrano-recipes/check.rb
|
70
|
+
- lib/capistrano-recipes/database.rb
|
71
|
+
- lib/capistrano-recipes/delayed_job.rb
|
72
|
+
- lib/capistrano-recipes/hpusher.rb
|
73
|
+
- lib/capistrano-recipes/log.rb
|
74
|
+
- lib/capistrano-recipes/monit.rb
|
75
|
+
- lib/capistrano-recipes/nginx.rb
|
76
|
+
- lib/capistrano-recipes/rails.rb
|
77
|
+
- lib/capistrano-recipes/rake.rb
|
78
|
+
- lib/capistrano-recipes/setup.rb
|
79
|
+
- lib/capistrano-recipes/tasks/check.rake
|
80
|
+
- lib/capistrano-recipes/tasks/database.rake
|
81
|
+
- lib/capistrano-recipes/tasks/delayed_job.rake
|
82
|
+
- lib/capistrano-recipes/tasks/hpusher.rake
|
83
|
+
- lib/capistrano-recipes/tasks/log.rake
|
84
|
+
- lib/capistrano-recipes/tasks/monit.rake
|
85
|
+
- lib/capistrano-recipes/tasks/nginx.rake
|
86
|
+
- lib/capistrano-recipes/tasks/rails.rake
|
87
|
+
- lib/capistrano-recipes/tasks/rake.rake
|
88
|
+
- lib/capistrano-recipes/tasks/setup.rake
|
89
|
+
- lib/capistrano-recipes/tasks/templates/database.yml.erb
|
90
|
+
- lib/capistrano-recipes/tasks/templates/nginx/site.conf.erb
|
91
|
+
- lib/capistrano-recipes/tasks/unicorn.rake
|
92
|
+
- lib/capistrano-recipes/unicorn.rb
|
93
|
+
- lib/capistrano-recipes/version.rb
|
94
|
+
homepage: https://github.com/jetthoughts/capistrano-recipes
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.0.3
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Capistrano 3 recipes for nginx, monit, rails log, setup, unicorn
|
118
|
+
test_files: []
|
119
|
+
has_rdoc:
|