質問編集履歴
2
タイトル修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
capistrano
|
1
|
+
capistrano,「Insecure operation」でbundle installできない
|
test
CHANGED
File without changes
|
1
内容説明の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,311 +1,313 @@
|
|
1
|
+
###前提・実現したいこと
|
2
|
+
|
3
|
+
現在Ruby(Ruby On Rails)でアプリケーションを開発しています。
|
4
|
+
|
5
|
+
ローカルからリモートサーバーにcapistranoでrailsアプリケーションをデプロイしたいのですが、capistranoの「bundler」のタスクを実行する際に、下記のログの通り、`SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
6
|
+
|
7
|
+
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)`でbundle installができない状態です。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
###エラーログなど
|
12
|
+
|
13
|
+
```cmd
|
14
|
+
|
15
|
+
.長いため省略しています
|
16
|
+
|
17
|
+
INFO [5c9a0279] Running sudo rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet as deploy_user@153.126.179.98
|
18
|
+
|
19
|
+
DEBUG [8c7ee5b1] Command: cd /var/www/myapp/releases/20160821142536 && ( export RBENV_ROOT="/usr/local/rbenv" RBENV_VERSION="2.3.1" ; /usr/local/rbenv/bin/rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet )
|
20
|
+
|
21
|
+
DEBUG [8c7ee5b1] /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
22
|
+
|
23
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `block in which'
|
24
|
+
|
25
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `each'
|
26
|
+
|
27
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `find'
|
28
|
+
|
29
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `which'
|
30
|
+
|
31
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:377:in `git_present?'
|
32
|
+
|
33
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/git/git_proxy.rb:54:in `initialize'
|
34
|
+
|
35
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `new'
|
36
|
+
|
37
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `git_version'
|
38
|
+
|
39
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:22:in `report'
|
40
|
+
|
41
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:74:in `request_issue_report_for'
|
42
|
+
|
43
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:40:in `log_error'
|
44
|
+
|
45
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:100:in `rescue in with_friendly_errors'
|
46
|
+
|
47
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
|
48
|
+
|
49
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
|
50
|
+
|
51
|
+
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `load'
|
52
|
+
|
53
|
+
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
|
54
|
+
|
55
|
+
(Backtrace restricted to imported tasks)
|
56
|
+
|
57
|
+
cap aborted!
|
58
|
+
|
59
|
+
SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
60
|
+
|
61
|
+
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
62
|
+
|
63
|
+
↑↓ //上のエラーのパスと同じ (from/~の内容)
|
64
|
+
|
65
|
+
bundle stderr: Nothing written
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
Tasks: TOP => deploy:updated => bundler:install
|
70
|
+
|
71
|
+
(See full trace by running task with --trace)
|
72
|
+
|
73
|
+
The deploy has failed with an error: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
74
|
+
|
75
|
+
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
76
|
+
|
77
|
+
↑↓ //上のエラーのパスと同じ (from/~の内容)
|
78
|
+
|
79
|
+
bundle stderr: Nothing written
|
80
|
+
|
81
|
+
Admin-Mac:myapp admin$
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
###deploy.rb
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
|
91
|
+
set :application, 'myapp'
|
92
|
+
|
93
|
+
set :repo_url, 'git@bitbucket.org:myapp/myapp.git'
|
94
|
+
|
95
|
+
set :puma_threads, [4, 5]
|
96
|
+
|
97
|
+
set :puma_workers, 1
|
98
|
+
|
99
|
+
set :rbenv_ruby, '2.3.1'
|
100
|
+
|
101
|
+
set :rbenv_path, '/usr/local/rbenv'
|
102
|
+
|
103
|
+
set :pty, true
|
104
|
+
|
105
|
+
set :use_sudo, false
|
106
|
+
|
107
|
+
set :stage, :production
|
108
|
+
|
109
|
+
set :deploy_via, :remote_cache
|
110
|
+
|
111
|
+
set :deploy_to, '/var/www/myapp'
|
112
|
+
|
113
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
114
|
+
|
115
|
+
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
|
116
|
+
|
117
|
+
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
|
118
|
+
|
119
|
+
set :puma_access_log, "#{release_path}/log/puma.error.log"
|
120
|
+
|
121
|
+
set :puma_error_log, "#{release_path}/log/puma.access.log"
|
122
|
+
|
123
|
+
set :puma_preload_app, true
|
124
|
+
|
125
|
+
set :puma_worker_timeout, nil
|
126
|
+
|
127
|
+
set :puma_init_active_record, true # Change to false when not using ActiveRecord
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
## Defaults:
|
132
|
+
|
133
|
+
set :scm, :git
|
134
|
+
|
135
|
+
set :branch, :master
|
136
|
+
|
137
|
+
set :format, :pretty
|
138
|
+
|
139
|
+
set :log_level, :debug
|
140
|
+
|
141
|
+
set :keep_releases, 6
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
## Linked Files & Directories (Default None):
|
146
|
+
|
147
|
+
set :linked_files, %w{config/database.yml config/secrets.yml}
|
148
|
+
|
149
|
+
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
namespace :deploy do
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
desc 'Initial Deploy'
|
158
|
+
|
159
|
+
task :initial do
|
160
|
+
|
161
|
+
on roles(:app) do
|
162
|
+
|
163
|
+
before 'deploy:restart', 'puma:start'
|
164
|
+
|
165
|
+
invoke 'deploy'
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
before :starting, :check_revision
|
174
|
+
|
175
|
+
after :finishing, :compile_assets
|
176
|
+
|
177
|
+
after :finishing, :cleanup
|
178
|
+
|
179
|
+
after :finishing, :restart
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
###試してみたこと
|
188
|
+
|
189
|
+
```cmd
|
190
|
+
|
191
|
+
[deploy_user@ik1-325-22 ~]$ rbenv version
|
192
|
+
|
193
|
+
2.3.1 (set by /usr/local/rbenv/version)
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
[deploy_user@ik1-325-22 ~]$ bundle version
|
198
|
+
|
199
|
+
/usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
200
|
+
|
201
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `block in which'
|
202
|
+
|
203
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `each'
|
204
|
+
|
205
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `find'
|
206
|
+
|
207
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `which'
|
208
|
+
|
209
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:377:in `git_present?'
|
210
|
+
|
211
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/git/git_proxy.rb:54:in `initialize'
|
212
|
+
|
213
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `new'
|
214
|
+
|
215
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `git_version'
|
216
|
+
|
217
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:22:in `report'
|
218
|
+
|
219
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:74:in `request_issue_report_for'
|
220
|
+
|
221
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:40:in `log_error'
|
222
|
+
|
223
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:100:in `rescue in with_friendly_errors'
|
224
|
+
|
225
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
|
226
|
+
|
227
|
+
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
|
228
|
+
|
229
|
+
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `load'
|
230
|
+
|
231
|
+
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
```
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
```cmd
|
240
|
+
|
241
|
+
[deploy_user@ik1-325-22 ~]$ sudo bundle version
|
242
|
+
|
243
|
+
Bundler version 1.12.5
|
244
|
+
|
245
|
+
```
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
以上の内容からsudoをつければいけるのかと思い、`deploy.rb`に`set :rbenv_prefix, "sudo rbenv exec”`を追記して実行しましたが、下記のエラー内容...
|
250
|
+
|
251
|
+
```cmd
|
252
|
+
|
253
|
+
.
|
254
|
+
|
255
|
+
.冒頭のログとほぼ同じため省略しています。
|
256
|
+
|
257
|
+
.
|
258
|
+
|
259
|
+
INFO [5c9a0279] Running sudo rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet as deploy_user@IP_address
|
260
|
+
|
261
|
+
DEBUG [5c9a0279] Command: cd /var/www/myapp/releases/20160821145425 && ( export RBENV_ROOT="/usr/local/rbenv" RBENV_VERSION="2.3.1" ; sudo rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet )
|
262
|
+
|
263
|
+
DEBUG [5c9a0279] An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
264
|
+
|
265
|
+
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
266
|
+
|
267
|
+
(Backtrace restricted to imported tasks)
|
268
|
+
|
269
|
+
cap aborted!
|
270
|
+
|
271
|
+
SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 5
|
272
|
+
|
273
|
+
bundle stdout: An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
274
|
+
|
275
|
+
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
276
|
+
|
277
|
+
bundle stderr: Nothing written
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
Tasks: TOP => deploy:updated => bundler:install
|
282
|
+
|
283
|
+
(See full trace by running task with --trace)
|
284
|
+
|
285
|
+
The deploy has failed with an error: Exception while executing as deploy_user@IP_address: bundle exit status: 5
|
286
|
+
|
287
|
+
bundle stdout: An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
288
|
+
|
289
|
+
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
290
|
+
|
291
|
+
bundle stderr: Nothing written
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
```
|
296
|
+
|
1
297
|
###環境
|
2
298
|
|
3
299
|
サーバーOS: CentOS6.8
|
4
300
|
|
5
301
|
Ruby: 2.3.1
|
6
302
|
|
303
|
+
Ruby On Rails: 5.0.0
|
304
|
+
|
305
|
+
1つのサーバーにnginx+puma+Railsアプリケーション
|
306
|
+
|
7
307
|
リストrbenvを下記のサイトを参考にAnsibleにてシステムワイドにインストールをして実行しています。
|
8
308
|
|
9
309
|
[http://ria10.hatenablog.com/entry/2015/04/14/132129](http://ria10.hatenablog.com/entry/2015/04/14/132129)
|
10
310
|
|
11
311
|
|
12
312
|
|
13
|
-
---
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
ローカルからリモートサーバーにcapistranoでrailsアプリケーションをデプロイしたいのですが、下記のログの通り、`SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
18
|
-
|
19
|
-
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)`でbundle installができない状態です。
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
###ログ
|
24
|
-
|
25
|
-
```cmd
|
26
|
-
|
27
|
-
.長いため省略しています
|
28
|
-
|
29
|
-
INFO [5c9a0279] Running sudo rbenv exec bundle install --path /var/www/company/shared/bundle --without development test --deployment --quiet as deploy_user@153.126.179.98
|
30
|
-
|
31
|
-
DEBUG [8c7ee5b1] Command: cd /var/www/myapp/releases/20160821142536 && ( export RBENV_ROOT="/usr/local/rbenv" RBENV_VERSION="2.3.1" ; /usr/local/rbenv/bin/rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet )
|
32
|
-
|
33
|
-
DEBUG [8c7ee5b1] /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
34
|
-
|
35
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `block in which'
|
36
|
-
|
37
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `each'
|
38
|
-
|
39
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `find'
|
40
|
-
|
41
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `which'
|
42
|
-
|
43
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:377:in `git_present?'
|
44
|
-
|
45
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/git/git_proxy.rb:54:in `initialize'
|
46
|
-
|
47
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `new'
|
48
|
-
|
49
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `git_version'
|
50
|
-
|
51
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:22:in `report'
|
52
|
-
|
53
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:74:in `request_issue_report_for'
|
54
|
-
|
55
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:40:in `log_error'
|
56
|
-
|
57
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:100:in `rescue in with_friendly_errors'
|
58
|
-
|
59
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
|
60
|
-
|
61
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
|
62
|
-
|
63
|
-
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `load'
|
64
|
-
|
65
|
-
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
|
66
|
-
|
67
|
-
(Backtrace restricted to imported tasks)
|
68
|
-
|
69
|
-
cap aborted!
|
70
|
-
|
71
|
-
SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
72
|
-
|
73
|
-
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
74
|
-
|
75
|
-
//上のエラーのパスと同じ (from/~の内容)
|
76
|
-
|
77
|
-
bundle stderr: Nothing written
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
Tasks: TOP => deploy:updated => bundler:install
|
82
|
-
|
83
|
-
(See full trace by running task with --trace)
|
84
|
-
|
85
|
-
The deploy has failed with an error: Exception while executing as deploy_user@IP_address: bundle exit status: 1
|
86
|
-
|
87
|
-
bundle stdout: /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
88
|
-
|
89
|
-
//上のエラーのパスと同じ (from/~の内容)
|
90
|
-
|
91
|
-
bundle stderr: Nothing written
|
92
|
-
|
93
|
-
Admin-Mac:myapp admin$
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
```
|
98
|
-
|
99
|
-
###deploy.rb
|
100
|
-
|
101
|
-
```ruby
|
102
|
-
|
103
|
-
set :application, 'myapp'
|
104
|
-
|
105
|
-
set :repo_url, 'git@bitbucket.org:myapp/myapp.git'
|
106
|
-
|
107
|
-
set :puma_threads, [4, 5]
|
108
|
-
|
109
|
-
set :puma_workers, 1
|
110
|
-
|
111
|
-
set :rbenv_ruby, '2.3.1'
|
112
|
-
|
113
|
-
set :rbenv_path, '/usr/local/rbenv'
|
114
|
-
|
115
|
-
set :pty, true
|
116
|
-
|
117
|
-
set :use_sudo, false
|
118
|
-
|
119
|
-
set :stage, :production
|
120
|
-
|
121
|
-
set :deploy_via, :remote_cache
|
122
|
-
|
123
|
-
set :deploy_to, '/var/www/myapp'
|
124
|
-
|
125
|
-
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
126
|
-
|
127
|
-
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
|
128
|
-
|
129
|
-
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
|
130
|
-
|
131
|
-
set :puma_access_log, "#{release_path}/log/puma.error.log"
|
132
|
-
|
133
|
-
set :puma_error_log, "#{release_path}/log/puma.access.log"
|
134
|
-
|
135
|
-
set :puma_preload_app, true
|
136
|
-
|
137
|
-
set :puma_worker_timeout, nil
|
138
|
-
|
139
|
-
set :puma_init_active_record, true # Change to false when not using ActiveRecord
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
## Defaults:
|
144
|
-
|
145
|
-
set :scm, :git
|
146
|
-
|
147
|
-
set :branch, :master
|
148
|
-
|
149
|
-
set :format, :pretty
|
150
|
-
|
151
|
-
set :log_level, :debug
|
152
|
-
|
153
|
-
set :keep_releases, 6
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
## Linked Files & Directories (Default None):
|
158
|
-
|
159
|
-
set :linked_files, %w{config/database.yml config/secrets.yml}
|
160
|
-
|
161
|
-
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
namespace :deploy do
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
desc 'Initial Deploy'
|
170
|
-
|
171
|
-
task :initial do
|
172
|
-
|
173
|
-
on roles(:app) do
|
174
|
-
|
175
|
-
before 'deploy:restart', 'puma:start'
|
176
|
-
|
177
|
-
invoke 'deploy'
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
before :starting, :check_revision
|
186
|
-
|
187
|
-
after :finishing, :compile_assets
|
188
|
-
|
189
|
-
after :finishing, :cleanup
|
190
|
-
|
191
|
-
after :finishing, :restart
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
```
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
###試してみたこと
|
200
|
-
|
201
|
-
```cmd
|
202
|
-
|
203
|
-
[deploy_user@ik1-325-22 ~]$ rbenv version
|
204
|
-
|
205
|
-
2.3.1 (set by /usr/local/rbenv/version)
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
[deploy_user@ik1-325-22 ~]$ bundle version
|
210
|
-
|
211
|
-
/usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `expand_path': Insecure operation - expand_path (SecurityError)
|
212
|
-
|
213
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:310:in `block in which'
|
214
|
-
|
215
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `each'
|
216
|
-
|
217
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `find'
|
218
|
-
|
219
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:308:in `which'
|
220
|
-
|
221
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:377:in `git_present?'
|
222
|
-
|
223
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/git/git_proxy.rb:54:in `initialize'
|
224
|
-
|
225
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `new'
|
226
|
-
|
227
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:78:in `git_version'
|
228
|
-
|
229
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/env.rb:22:in `report'
|
230
|
-
|
231
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:74:in `request_issue_report_for'
|
232
|
-
|
233
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:40:in `log_error'
|
234
|
-
|
235
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:100:in `rescue in with_friendly_errors'
|
236
|
-
|
237
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
|
238
|
-
|
239
|
-
from /usr/local/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
|
240
|
-
|
241
|
-
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `load'
|
242
|
-
|
243
|
-
from /usr/local/rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
```
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
```cmd
|
252
|
-
|
253
|
-
[deploy_user@ik1-325-22 ~]$ sudo bundle version
|
254
|
-
|
255
|
-
Bundler version 1.12.5
|
256
|
-
|
257
|
-
```
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
以上の内容からsudoをつければいけるのかと思い、`deploy.rb`に`set :rbenv_prefix, "sudo rbenv exec”`を追記して実行しましたが、下記のエラー内容...
|
262
|
-
|
263
|
-
```cmd
|
264
|
-
|
265
|
-
.
|
266
|
-
|
267
|
-
.冒頭のログとほぼ同じため省略しています。
|
268
|
-
|
269
|
-
.
|
270
|
-
|
271
|
-
INFO [5c9a0279] Running sudo rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet as deploy_user@IP_address
|
272
|
-
|
273
|
-
DEBUG [5c9a0279] Command: cd /var/www/myapp/releases/20160821145425 && ( export RBENV_ROOT="/usr/local/rbenv" RBENV_VERSION="2.3.1" ; sudo rbenv exec bundle install --path /var/www/myapp/shared/bundle --without development test --deployment --quiet )
|
274
|
-
|
275
|
-
DEBUG [5c9a0279] An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
276
|
-
|
277
|
-
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
278
|
-
|
279
|
-
(Backtrace restricted to imported tasks)
|
280
|
-
|
281
|
-
cap aborted!
|
282
|
-
|
283
|
-
SSHKit::Runner::ExecuteError: Exception while executing as deploy_user@IP_address: bundle exit status: 5
|
284
|
-
|
285
|
-
bundle stdout: An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
286
|
-
|
287
|
-
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
288
|
-
|
289
|
-
bundle stderr: Nothing written
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
Tasks: TOP => deploy:updated => bundler:install
|
294
|
-
|
295
|
-
(See full trace by running task with --trace)
|
296
|
-
|
297
|
-
The deploy has failed with an error: Exception while executing as deploy_user@IP_address: bundle exit status: 5
|
298
|
-
|
299
|
-
bundle stdout: An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
|
300
|
-
|
301
|
-
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
|
302
|
-
|
303
|
-
bundle stderr: Nothing written
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
```
|
308
|
-
|
309
|
-
|
310
|
-
|
311
313
|
かなりはまってしまい自分では解決できそうになかったので投稿させていただきました。どうかよろしくお願いします。
|