Skip to content

Commit f0eea56

Browse files
capistrano の設定を調整
1 parent 0130c7b commit f0eea56

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

Capfile

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ require 'capistrano/rails'
3838
require 'capistrano/rbenv'
3939
require 'capistrano/bundler'
4040
require 'capistrano/puma'
41+
require 'whenever/capistrano'
4142
install_plugin Capistrano::Puma
4243

4344
# Load custom tasks from `lib/capistrano/tasks` if you have any defined

config/deploy.rb

+13-11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
'config/credentials.yml.enc'
4141
)
4242

43+
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
44+
4345
namespace :puma do
4446
desc 'Create Directories for Puma Pids and Socket'
4547
task :make_dirs do
@@ -63,6 +65,17 @@
6365
end
6466
end
6567

68+
desc 'Upload files'
69+
task :upload do
70+
on roles(:app) do |host|
71+
if test "[ ! -d #{shared_path}/config ]"
72+
execute "mkdir -p #{shared_path}/config"
73+
end
74+
upload!('config/database.yml', "#{shared_path}/config/database.yml")
75+
upload!('config/credentials.yml.enc', "#{shared_path}/config/credentials.yml.enc")
76+
end
77+
end
78+
6679
desc 'Initial Deploy'
6780
task :initial do
6881
on roles(:app) do
@@ -78,17 +91,6 @@
7891
end
7992
end
8093

81-
desc 'Upload files'
82-
task :upload do
83-
on roles(:app) do |host|
84-
if test "[ ! -d #{shared_path}/config ]"
85-
execute "mkdir -p #{shared_path}/config"
86-
end
87-
upload!('config/database.yml', "#{shared_path}/config/database.yml")
88-
upload!('config/credentials.yml.enc', "#{shared_path}/config/credentials.yml.enc")
89-
end
90-
end
91-
9294
before :starting, :check_revision
9395
after :finishing, :compile_assets
9496
after :finishing, :cleanup

config/deploy/staging.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@
6161
# }
6262

6363
server '133.223.5.233', user: 'deploy', roles: %w(app db web), primary: true
64-
set :stage, :staging
64+
set :stage, :staging
6565
set :rails_env, :staging
6666
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

0 commit comments

Comments
 (0)