teleporter 0.0.9 → 0.0.11
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 +4 -4
- data/README.md +1 -1
- data/lib/generators/initial/capistrano.rb +26 -0
- data/lib/generators/initial/gemfile.rb +1 -5
- data/lib/generators/initial/rspec_base.rb +6 -9
- data/lib/generators/initial/start.rb +1 -0
- data/lib/generators/initial/templates/capistrano/lib/substitute_strings.rb +12 -0
- data/lib/generators/initial/templates/capistrano/lib/template.rb +32 -0
- data/lib/generators/initial/templates/capistrano/shared/application.yml.erb +2 -0
- data/lib/generators/initial/templates/capistrano/shared/database.example.yml.erb +11 -0
- data/lib/generators/initial/templates/capistrano/shared/log_rotation.erb +11 -0
- data/lib/generators/initial/templates/capistrano/shared/monit.erb +22 -0
- data/lib/generators/initial/templates/capistrano/shared/monit_sidekiq.erb +11 -0
- data/lib/generators/initial/templates/capistrano/shared/nginx.conf.erb +55 -0
- data/lib/generators/initial/templates/capistrano/shared/sidekiq.yml.erb +3 -0
- data/lib/generators/initial/templates/capistrano/shared/sidekiq_init.sh.erb +40 -0
- data/lib/generators/initial/templates/capistrano/shared/unicorn.rb.erb +42 -0
- data/lib/generators/initial/templates/capistrano/shared/unicorn_init.sh.erb +86 -0
- data/lib/generators/initial/templates/capistrano/tasks/check_revision.cap +14 -0
- data/lib/generators/initial/templates/capistrano/tasks/compile_assets_locally.cap +16 -0
- data/lib/generators/initial/templates/capistrano/tasks/logs.cap +14 -0
- data/lib/generators/initial/templates/capistrano/tasks/restart.cap +10 -0
- data/lib/generators/initial/templates/capistrano/tasks/setup_config.cap +33 -0
- data/lib/generators/initial/templates/{capybara.rb → rspec_base/capybara.rb} +0 -0
- data/lib/generators/initial/templates/{database_cleaner.rb → rspec_base/database_cleaner.rb} +0 -0
- data/lib/generators/initial/templates/{devise.rb → rspec_base/devise.rb} +0 -0
- data/lib/generators/initial/templates/{factory_girl.rb → rspec_base/factory_girl.rb} +0 -0
- data/lib/generators/initial/templates/{spec_helpers.rb → rspec_base/spec_helpers.rb} +0 -0
- data/lib/teleporter.rb +1 -0
- data/lib/teleporter/version.rb +1 -1
- metadata +25 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17414a836c561b0aefd60564d1b2176c174bac9c
|
4
|
+
data.tar.gz: e14d47f25e565d830a12194b21d5b221f7b3c082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26999c65b3738e7eed44faffd1bdaa265f5cdb0dcd9f92c1a0123a6ef672dd30aae71a9e2a2296aaf990804a31d01e55f2ebeb52d9fd398f296a9d5348d9a290
|
7
|
+
data.tar.gz: adc56f0a369909e7108e269ee0258f705bc096b77ec08179c448d5dc4c1dd0ded26c00ffcb6ba588548c574e26de29c24422b3637c252b4394a1776ab79609fa
|
data/README.md
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Initial
|
2
|
+
class CapistranoGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path("../templates", __FILE__)
|
4
|
+
|
5
|
+
def add
|
6
|
+
gem_group :development do
|
7
|
+
gem 'capistrano'
|
8
|
+
gem 'capistrano-rbenv'
|
9
|
+
gem 'capistrano-bundler'
|
10
|
+
gem 'capistrano-rails'
|
11
|
+
gem 'capistrano-sidekiq' , github: 'seuros/capistrano-sidekiq'
|
12
|
+
end
|
13
|
+
|
14
|
+
run "bundle install"
|
15
|
+
|
16
|
+
directory 'capistrano/tasks', 'lib/capistrano/tasks'
|
17
|
+
directory 'capistrano/shared', 'config/deploy/shared'
|
18
|
+
|
19
|
+
files = %w(substitute_strings.rb template.rb)
|
20
|
+
files.each do |f|
|
21
|
+
template "capistrano/lib/#{f}", "lib/capistrano/#{f}"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -6,13 +6,9 @@ module Initial
|
|
6
6
|
gem 'russian'
|
7
7
|
gem 'sidekiq'
|
8
8
|
gem 'haml-rails'
|
9
|
+
gem 'therubyracer'
|
9
10
|
|
10
11
|
gem_group :development do
|
11
|
-
gem 'capistrano'
|
12
|
-
gem 'capistrano-rbenv'
|
13
|
-
gem 'capistrano-bundler'
|
14
|
-
gem 'capistrano-rails'
|
15
|
-
gem 'capistrano-sidekiq' , github: 'seuros/capistrano-sidekiq'
|
16
12
|
gem 'quiet_assets'
|
17
13
|
gem 'letter_opener'
|
18
14
|
end
|
@@ -18,18 +18,15 @@ module Initial
|
|
18
18
|
gem 'webmock'
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
run "bundle install"
|
23
|
-
#end
|
21
|
+
run "bundle install"
|
24
22
|
|
25
|
-
#Rails::Generators.invoke 'rspec:install'
|
26
23
|
generate 'rspec:install'
|
27
24
|
|
28
|
-
template 'capybara.rb',
|
29
|
-
template 'database_cleaner.rb', 'spec/support/database_cleaner.rb'
|
30
|
-
template 'factory_girl.rb',
|
31
|
-
template 'spec_helpers.rb',
|
32
|
-
template 'devise.rb',
|
25
|
+
template 'rspec_base/capybara.rb', 'spec/support/capybara.rb'
|
26
|
+
template 'rspec_base/database_cleaner.rb', 'spec/support/database_cleaner.rb'
|
27
|
+
template 'rspec_base/factory_girl.rb', 'spec/support/factory_girl.rb'
|
28
|
+
template 'rspec_base/spec_helpers.rb', 'spec/support/spec_helpers.rb'
|
29
|
+
template 'rspec_base/devise.rb', 'spec/support/devise.rb'
|
33
30
|
|
34
31
|
end
|
35
32
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# we often want to refer to variables which
|
2
|
+
# are defined in subsequent stage files. This
|
3
|
+
# let's us use the {{var}} to represent fetch(:var)
|
4
|
+
# in strings which are only evaluated at runtime.
|
5
|
+
|
6
|
+
def sub_strings(input_string)
|
7
|
+
output_string = input_string
|
8
|
+
input_string.scan(/{{(\w*)}}/).each do |var|
|
9
|
+
output_string.gsub!("{{#{var[0]}}}", fetch(var[0].to_sym))
|
10
|
+
end
|
11
|
+
output_string
|
12
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# will first try and copy the file:
|
2
|
+
# config/deploy/#{full_app_name}/#{from}.erb
|
3
|
+
# to:
|
4
|
+
# shared/config/to
|
5
|
+
# if the original source path doesn exist then it will
|
6
|
+
# search in:
|
7
|
+
# config/deploy/shared/#{from}.erb
|
8
|
+
# this allows files which are common to all enviros to
|
9
|
+
# come from a single source while allowing specific
|
10
|
+
# ones to be over-ridden
|
11
|
+
# if the target file name is the same as the source then
|
12
|
+
# the second parameter can be left out
|
13
|
+
def smart_template(from, to=nil)
|
14
|
+
to ||= from
|
15
|
+
full_to_path = "#{shared_path}/config/#{to}"
|
16
|
+
if from_erb_path = template_file(from)
|
17
|
+
from_erb = StringIO.new(ERB.new(File.read(from_erb_path)).result(binding))
|
18
|
+
upload! from_erb, full_to_path
|
19
|
+
info "copying: #{from_erb} to: #{full_to_path}"
|
20
|
+
else
|
21
|
+
error "error #{from} not found"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def template_file(name)
|
26
|
+
if File.exist?((file = "config/deploy/#{fetch(:full_app_name)}/#{name}.erb"))
|
27
|
+
return file
|
28
|
+
elsif File.exist?((file = "config/deploy/shared/#{name}.erb"))
|
29
|
+
return file
|
30
|
+
end
|
31
|
+
return nil
|
32
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= fetch(:rails_env) %>:
|
2
|
+
adapter: postgresql
|
3
|
+
timeout: 5000
|
4
|
+
encoding: utf8
|
5
|
+
reconnect: false
|
6
|
+
database: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
|
7
|
+
pool: 5
|
8
|
+
username: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
|
9
|
+
password:
|
10
|
+
host:
|
11
|
+
port: 5432
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% application = fetch(:application) %>
|
2
|
+
set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE }
|
3
|
+
|
4
|
+
check process unicorn
|
5
|
+
with pidfile <%= current_path %>/tmp/pids/unicorn.pid
|
6
|
+
start program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> start"
|
7
|
+
stop program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> stop"
|
8
|
+
if mem is greater than 300.0 MB for 1 cycles then restart # eating up memory?
|
9
|
+
if cpu is greater than 50% for 2 cycles then alert # send an email to admin
|
10
|
+
if cpu is greater than 80% for 30 cycles then restart # hung process?
|
11
|
+
group unicorn
|
12
|
+
|
13
|
+
<% (0..(fetch(:unicorn_worker_count) -1)).each do |worker| %>
|
14
|
+
check process unicorn_worker_<%= (5000 + worker).to_s %>
|
15
|
+
with pidfile <%= current_path %>/tmp/pids/unicorn.<%= (5000 + worker).to_s %>.pid
|
16
|
+
start program = "/bin/true"
|
17
|
+
stop program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> kill_worker <%= (5000 + worker).to_s %>"
|
18
|
+
if mem is greater than 350.0 MB for 1 cycles then restart
|
19
|
+
if cpu is greater than 80% for 30 cycles then restart
|
20
|
+
|
21
|
+
group unicorn_workers
|
22
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% application = fetch(:application) %>
|
2
|
+
set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE }
|
3
|
+
|
4
|
+
check process sidekiq
|
5
|
+
with pidfile <%= current_path %>/tmp/pids/sidekiq.pid
|
6
|
+
start program = "/etc/init.d/sidekiq_<%= application %>_<%= fetch(:rails_env)%> start"
|
7
|
+
stop program = "/etc/init.d/sidekiq_<%= application %>_<%= fetch(:rails_env)%> stop"
|
8
|
+
if mem is greater than 500.0 MB for 1 cycles then restart # eating up memory?
|
9
|
+
if cpu is greater than 50% for 2 cycles then alert # send an email to admin
|
10
|
+
if cpu is greater than 80% for 30 cycles then restart # hung process?
|
11
|
+
group sidekiq
|
@@ -0,0 +1,55 @@
|
|
1
|
+
upstream unicorn {
|
2
|
+
server unix:/tmp/unicorn.<%= fetch(:full_app_name) %>.sock fail_timeout=0;
|
3
|
+
}
|
4
|
+
|
5
|
+
server {
|
6
|
+
listen 80 default deferred;
|
7
|
+
root <%= fetch(:deploy_to) %>/current/public;
|
8
|
+
|
9
|
+
location ^~ /assets/ {
|
10
|
+
gzip_static on;
|
11
|
+
expires max;
|
12
|
+
add_header Cache-Control public;
|
13
|
+
}
|
14
|
+
|
15
|
+
try_files $uri/index.html $uri @unicorn;
|
16
|
+
location @unicorn {
|
17
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
18
|
+
proxy_set_header Host $http_host;
|
19
|
+
proxy_redirect off;
|
20
|
+
proxy_pass http://unicorn;
|
21
|
+
}
|
22
|
+
|
23
|
+
error_page 500 502 503 504 /500.html;
|
24
|
+
client_max_body_size 4G;
|
25
|
+
keepalive_timeout 10;
|
26
|
+
}
|
27
|
+
|
28
|
+
<% if fetch(:enable_ssl) %>
|
29
|
+
server {
|
30
|
+
listen 443 default deferred;
|
31
|
+
root <%= fetch(:deploy_to) %>/current/public;
|
32
|
+
|
33
|
+
location ^~ /assets/ {
|
34
|
+
gzip_static on;
|
35
|
+
expires max;
|
36
|
+
add_header Cache-Control public;
|
37
|
+
}
|
38
|
+
|
39
|
+
try_files $uri/index.html $uri @unicorn;
|
40
|
+
location @unicorn {
|
41
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
42
|
+
proxy_set_header X-Forwarded-Proto https;
|
43
|
+
proxy_set_header Host $http_host;
|
44
|
+
proxy_redirect off;
|
45
|
+
proxy_pass http://unicorn;
|
46
|
+
}
|
47
|
+
|
48
|
+
error_page 500 502 503 504 /500.html;
|
49
|
+
client_max_body_size 4G;
|
50
|
+
keepalive_timeout 10;
|
51
|
+
ssl on;
|
52
|
+
ssl_certificate <%= fetch(:deploy_to) %>/shared/ssl_cert.crt;
|
53
|
+
ssl_certificate_key <%= fetch(:deploy_to) %>/shared/ssl_private_key.key;
|
54
|
+
}#
|
55
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
set -e
|
3
|
+
|
4
|
+
APP_ROOT=<%= current_path %>
|
5
|
+
PID=$APP_ROOT/tmp/pids/sidekiq.pid
|
6
|
+
CMD="cd $APP_ROOT; RAILS_ENV=<%= "#{fetch(:rails_env)}" %> nohup bundle exec sidekiq -e <%= "#{fetch(:rails_env)}" %> -C <%= current_path %>/config/sidekiq.yml -i 0 -P $PID >> <%= current_path %>/log/sidekiq.log 2>&1 &"
|
7
|
+
AS_USER="deploy"
|
8
|
+
|
9
|
+
run () {
|
10
|
+
if [ "$(id -un)" = "$AS_USER" ]; then
|
11
|
+
eval $1
|
12
|
+
else
|
13
|
+
su -c "$1" - $AS_USER
|
14
|
+
fi
|
15
|
+
}
|
16
|
+
|
17
|
+
sig () {
|
18
|
+
test -s "$PID" && kill -$1 `cat $PID`
|
19
|
+
}
|
20
|
+
|
21
|
+
case "$1" in
|
22
|
+
start)
|
23
|
+
sig 0 && echo >&2 "Already Running" && exit 0
|
24
|
+
run "$CMD"
|
25
|
+
;;
|
26
|
+
stop)
|
27
|
+
if kill -0 `cat $PID`
|
28
|
+
then
|
29
|
+
cd $APP_ROOT
|
30
|
+
bundle exec sidekiqctl stop $APP_ROOT/tmp/pids/sidekiq.pid 10
|
31
|
+
echo "stopping...."
|
32
|
+
else
|
33
|
+
echo "not running"
|
34
|
+
fi
|
35
|
+
;;
|
36
|
+
*)
|
37
|
+
echo >&2 "Usage: $0 <start|stop>"
|
38
|
+
exit 1
|
39
|
+
;;
|
40
|
+
esac
|
@@ -0,0 +1,42 @@
|
|
1
|
+
root = "<%= current_path %>"
|
2
|
+
working_directory root
|
3
|
+
pid "#{root}/tmp/pids/unicorn.pid"
|
4
|
+
stderr_path "#{root}/log/unicorn_err.log"
|
5
|
+
stdout_path "#{root}/log/unicorn.log"
|
6
|
+
|
7
|
+
listen "/tmp/unicorn.<%= fetch(:full_app_name) %>.sock"
|
8
|
+
worker_processes <%= fetch(:unicorn_worker_count) %>
|
9
|
+
timeout 40
|
10
|
+
preload_app true
|
11
|
+
|
12
|
+
# Force unicorn to look at the Gemfile in the current_path
|
13
|
+
# otherwise once we've first started a master process, it
|
14
|
+
# will always point to the first one it started.
|
15
|
+
before_exec do |server|
|
16
|
+
ENV['BUNDLE_GEMFILE'] = "<%= current_path %>/Gemfile"
|
17
|
+
end
|
18
|
+
|
19
|
+
before_fork do |server, worker|
|
20
|
+
defined?(ActiveRecord::Base) and
|
21
|
+
ActiveRecord::Base.connection.disconnect!
|
22
|
+
# Quit the old unicorn process
|
23
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
24
|
+
if File.exists?(old_pid) && server.pid != old_pid
|
25
|
+
puts "We've got an old pid and server pid is not the old pid"
|
26
|
+
begin
|
27
|
+
Process.kill("QUIT", File.read(old_pid).to_i)
|
28
|
+
puts "killing master process (good thing tm)"
|
29
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
30
|
+
puts "unicorn master already killed"
|
31
|
+
# someone else did our job for us
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
after_fork do |server, worker|
|
37
|
+
port = 5000 + worker.nr
|
38
|
+
child_pid = server.config[:pid].sub('.pid', ".#{port}.pid")
|
39
|
+
system("echo #{Process.pid} > #{child_pid}")
|
40
|
+
defined?(ActiveRecord::Base) and
|
41
|
+
ActiveRecord::Base.establish_connection
|
42
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
set -e
|
3
|
+
|
4
|
+
# Feel free to change any of the following variables for your app:
|
5
|
+
TIMEOUT=${TIMEOUT-60}
|
6
|
+
APP_ROOT=<%= current_path %>
|
7
|
+
PID_DIR=$APP_ROOT/tmp/pids
|
8
|
+
PID=$PID_DIR/unicorn.pid
|
9
|
+
CMD="cd $APP_ROOT; bundle exec unicorn -D -c <%= "#{shared_path}/config/unicorn.rb" %> -E <%= fetch(:rails_env) %>"
|
10
|
+
AS_USER=deploy
|
11
|
+
set -u
|
12
|
+
|
13
|
+
OLD_PIN="$PID.oldbin"
|
14
|
+
|
15
|
+
sig () {
|
16
|
+
test -s "$PID" && kill -$1 `cat $PID`
|
17
|
+
}
|
18
|
+
|
19
|
+
oldsig () {
|
20
|
+
test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`
|
21
|
+
}
|
22
|
+
|
23
|
+
workersig () {
|
24
|
+
workerpid="$APP_ROOT/tmp/pids/unicorn.$2.pid"
|
25
|
+
|
26
|
+
test -s "$workerpid" && kill -$1 `cat $workerpid`
|
27
|
+
}
|
28
|
+
|
29
|
+
run () {
|
30
|
+
if [ "$(id -un)" = "$AS_USER" ]; then
|
31
|
+
eval $1
|
32
|
+
else
|
33
|
+
su -c "$1" - $AS_USER
|
34
|
+
fi
|
35
|
+
}
|
36
|
+
|
37
|
+
case "$1" in
|
38
|
+
start)
|
39
|
+
sig 0 && echo >&2 "Already running" && exit 0
|
40
|
+
run "$CMD"
|
41
|
+
;;
|
42
|
+
stop)
|
43
|
+
sig QUIT && exit 0
|
44
|
+
echo >&2 "Not running"
|
45
|
+
;;
|
46
|
+
force-stop)
|
47
|
+
sig TERM && exit 0
|
48
|
+
echo >&2 "Not running"
|
49
|
+
;;
|
50
|
+
kill_worker)
|
51
|
+
workersig QUIT $2 && exit 0
|
52
|
+
echo >&2 "Worker not running"
|
53
|
+
;;
|
54
|
+
restart|reload)
|
55
|
+
sig USR2 && echo reloaded OK && exit 0
|
56
|
+
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
57
|
+
run "$CMD"
|
58
|
+
;;
|
59
|
+
upgrade)
|
60
|
+
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
|
61
|
+
then
|
62
|
+
n=$TIMEOUT
|
63
|
+
while test -s $OLD_PIN && test $n -ge 0
|
64
|
+
do
|
65
|
+
printf '.' && sleep 1 && n=$(( $n - 1 ))
|
66
|
+
done
|
67
|
+
echo
|
68
|
+
|
69
|
+
if test $n -lt 0 && test -s $OLD_PIN
|
70
|
+
then
|
71
|
+
echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds"
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
exit 0
|
75
|
+
fi
|
76
|
+
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
77
|
+
run "$CMD"
|
78
|
+
;;
|
79
|
+
reopen-logs)
|
80
|
+
sig USR1
|
81
|
+
;;
|
82
|
+
*)
|
83
|
+
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
|
84
|
+
exit 1
|
85
|
+
;;
|
86
|
+
esac
|
@@ -0,0 +1,14 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc "checks whether the currently checkout out revision matches the
|
3
|
+
remote one we're trying to deploy from"
|
4
|
+
task :check_revision do
|
5
|
+
branch = fetch(:branch)
|
6
|
+
unless `git rev-parse HEAD` == `git rev-parse origin/#{branch}`
|
7
|
+
puts "WARNING: HEAD is not the same as origin/#{branch}"
|
8
|
+
puts "Run `git push` to sync changes or make sure you've"
|
9
|
+
puts "checked out the branch: #{branch} as you can only deploy"
|
10
|
+
puts "if you've got the target branch checked out"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc "compiles assets locally then rsyncs"
|
3
|
+
task :compile_assets_locally do
|
4
|
+
run_locally do
|
5
|
+
execute "RAILS_ENV=#{fetch(:rails_env)} bundle exec rake assets:precompile"
|
6
|
+
end
|
7
|
+
on roles(:app) do |role|
|
8
|
+
run_locally do
|
9
|
+
execute"rsync -av ./public/assets/ #{role.user}@#{role.hostname}:#{release_path}/public/assets/;"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
run_locally do
|
13
|
+
execute "rm -rf ./public/assets"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
namespace :logs do
|
2
|
+
task :tail, :file do |t, args|
|
3
|
+
if args[:file]
|
4
|
+
on roles(:app) do
|
5
|
+
execute "tail -f #{shared_path}/log/#{args[:file]}.log"
|
6
|
+
end
|
7
|
+
else
|
8
|
+
puts "please specify a logfile e.g: 'rake logs:tail[logfile]"
|
9
|
+
puts "will tail 'shared_path/log/logfile.log'"
|
10
|
+
puts "remember if you use zsh you'll need to format it as:"
|
11
|
+
puts "rake 'logs:tail[logfile]' (single quotes)"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc 'Restart unicorn application'
|
3
|
+
%w(start stop force-stop kill_worker restart upgrage reopen-logs).each do |command|
|
4
|
+
task command.to_sym do
|
5
|
+
on roles(:app), in: :sequence, wait: 5 do
|
6
|
+
sudo "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
task :setup_config do
|
3
|
+
on roles(:app) do
|
4
|
+
# make the config dir
|
5
|
+
execute :mkdir, "-p #{shared_path}/config"
|
6
|
+
full_app_name = fetch(:full_app_name)
|
7
|
+
|
8
|
+
# config files to be uploaded to shared/config, see the
|
9
|
+
# definition of smart_template for details of operation.
|
10
|
+
# Essentially looks for #{filename}.erb in deploy/#{full_app_name}/
|
11
|
+
# and if it isn't there, falls back to deploy/#{shared}. Generally
|
12
|
+
# everything should be in deploy/shared with params which differ
|
13
|
+
# set in the stage files
|
14
|
+
config_files = fetch(:config_files)
|
15
|
+
config_files.each do |file|
|
16
|
+
smart_template file
|
17
|
+
end
|
18
|
+
|
19
|
+
# which of the above files should be marked as executable
|
20
|
+
executable_files = fetch(:executable_config_files)
|
21
|
+
executable_files.each do |file|
|
22
|
+
execute :chmod, "+x #{shared_path}/config/#{file}"
|
23
|
+
end
|
24
|
+
|
25
|
+
# symlink stuff which should be... symlinked
|
26
|
+
symlinks = fetch(:symlinks)
|
27
|
+
|
28
|
+
symlinks.each do |symlink|
|
29
|
+
sudo "ln -nfs #{shared_path}/config/#{symlink[:source]} #{sub_strings(symlink[:link])}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
File without changes
|
data/lib/generators/initial/templates/{database_cleaner.rb → rspec_base/database_cleaner.rb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/teleporter.rb
CHANGED
data/lib/teleporter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teleporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ponomarev Nikolay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,14 +66,32 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- lib/generators/admin/start.rb
|
69
|
+
- lib/generators/initial/capistrano.rb
|
69
70
|
- lib/generators/initial/gemfile.rb
|
70
71
|
- lib/generators/initial/rspec_base.rb
|
71
72
|
- lib/generators/initial/start.rb
|
72
|
-
- lib/generators/initial/templates/
|
73
|
-
- lib/generators/initial/templates/
|
74
|
-
- lib/generators/initial/templates/
|
75
|
-
- lib/generators/initial/templates/
|
76
|
-
- lib/generators/initial/templates/
|
73
|
+
- lib/generators/initial/templates/capistrano/lib/substitute_strings.rb
|
74
|
+
- lib/generators/initial/templates/capistrano/lib/template.rb
|
75
|
+
- lib/generators/initial/templates/capistrano/shared/application.yml.erb
|
76
|
+
- lib/generators/initial/templates/capistrano/shared/database.example.yml.erb
|
77
|
+
- lib/generators/initial/templates/capistrano/shared/log_rotation.erb
|
78
|
+
- lib/generators/initial/templates/capistrano/shared/monit.erb
|
79
|
+
- lib/generators/initial/templates/capistrano/shared/monit_sidekiq.erb
|
80
|
+
- lib/generators/initial/templates/capistrano/shared/nginx.conf.erb
|
81
|
+
- lib/generators/initial/templates/capistrano/shared/sidekiq.yml.erb
|
82
|
+
- lib/generators/initial/templates/capistrano/shared/sidekiq_init.sh.erb
|
83
|
+
- lib/generators/initial/templates/capistrano/shared/unicorn.rb.erb
|
84
|
+
- lib/generators/initial/templates/capistrano/shared/unicorn_init.sh.erb
|
85
|
+
- lib/generators/initial/templates/capistrano/tasks/check_revision.cap
|
86
|
+
- lib/generators/initial/templates/capistrano/tasks/compile_assets_locally.cap
|
87
|
+
- lib/generators/initial/templates/capistrano/tasks/logs.cap
|
88
|
+
- lib/generators/initial/templates/capistrano/tasks/restart.cap
|
89
|
+
- lib/generators/initial/templates/capistrano/tasks/setup_config.cap
|
90
|
+
- lib/generators/initial/templates/rspec_base/capybara.rb
|
91
|
+
- lib/generators/initial/templates/rspec_base/database_cleaner.rb
|
92
|
+
- lib/generators/initial/templates/rspec_base/devise.rb
|
93
|
+
- lib/generators/initial/templates/rspec_base/factory_girl.rb
|
94
|
+
- lib/generators/initial/templates/rspec_base/spec_helpers.rb
|
77
95
|
- lib/generators/initial/templates/welcome/index.haml
|
78
96
|
- lib/generators/initial/templates/welcome/welcome_controller.rb
|
79
97
|
- lib/generators/initial/welcome.rb
|