質問編集履歴
7
やったことの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
capistranoを使って、デプロイを行いたいです。
|
4
4
|
|
5
|
+
AWSのRDSを使っています。
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
|
6
10
|
|
7
11
|
### 困っていること
|
@@ -62,10 +66,28 @@
|
|
62
66
|
|
63
67
|
|
64
68
|
|
69
|
+
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
/var/runにpostgresqlというファイルはなくて、他も探しましたがなかったです。
|
78
|
+
|
79
|
+
↑これが原因でしょうか?
|
80
|
+
|
81
|
+
|
82
|
+
|
65
83
|
他に確認すべきことや、すべきことがありましたら、ご教示お願いします。
|
66
84
|
|
67
85
|
|
68
86
|
|
87
|
+
### ファイル
|
88
|
+
|
89
|
+
|
90
|
+
|
69
91
|
```gemfile
|
70
92
|
|
71
93
|
ource 'https://rubygems.org'
|
6
gemfile 修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,8 +68,108 @@
|
|
68
68
|
|
69
69
|
```gemfile
|
70
70
|
|
71
|
+
ource 'https://rubygems.org'
|
72
|
+
|
73
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
ruby '2.7.1'
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
82
|
+
|
83
|
+
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
|
84
|
+
|
85
|
+
# Use postgresql as the database for Active Record
|
86
|
+
|
87
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
88
|
+
|
89
|
+
# Use Puma as the app server
|
90
|
+
|
91
|
+
gem 'puma', '~> 4.1'
|
92
|
+
|
93
|
+
# Use SCSS for stylesheets
|
94
|
+
|
95
|
+
gem 'sass-rails', '>= 6'
|
96
|
+
|
97
|
+
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
98
|
+
|
99
|
+
gem 'webpacker', '~> 4.0'
|
100
|
+
|
101
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
102
|
+
|
103
|
+
gem 'turbolinks', '~> 5'
|
104
|
+
|
105
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
106
|
+
|
107
|
+
gem 'jbuilder', '~> 2.7'
|
108
|
+
|
109
|
+
# Use Redis adapter to run Action Cable in production
|
110
|
+
|
111
|
+
# gem 'redis', '~> 4.0'
|
112
|
+
|
113
|
+
# Use Active Model has_secure_password
|
114
|
+
|
115
|
+
# gem 'bcrypt', '~> 3.1.7'
|
116
|
+
|
117
|
+
gem 'active_decorator'
|
118
|
+
|
119
|
+
gem 'better_errors'
|
120
|
+
|
121
|
+
gem 'binding_of_caller'
|
122
|
+
|
123
|
+
gem 'devise'
|
124
|
+
|
125
|
+
gem 'aws-sdk-s3', require: false
|
126
|
+
|
127
|
+
gem 'bootstrap', '~> 4.1.1'
|
128
|
+
|
129
|
+
gem 'jquery-rails'
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
# Use Active Storage variant
|
134
|
+
|
135
|
+
# gem 'image_processing', '~> 1.2'
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
# Reduces boot times through caching; required in config/boot.rb
|
140
|
+
|
141
|
+
gem 'bootsnap', '>= 1.4.2', require: false
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
group :development, :test do
|
146
|
+
|
147
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
148
|
+
|
149
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
150
|
+
|
151
|
+
gem 'rubocop-rails'
|
152
|
+
|
153
|
+
gem 'dotenv-rails'
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
|
71
159
|
group :development do
|
72
160
|
|
161
|
+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
162
|
+
|
163
|
+
gem 'listen', '~> 3.2'
|
164
|
+
|
165
|
+
gem 'web-console', '>= 3.3.0'
|
166
|
+
|
167
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
168
|
+
|
169
|
+
gem 'spring'
|
170
|
+
|
171
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
172
|
+
|
73
173
|
gem "capistrano", "~> 3.10", require: false
|
74
174
|
|
75
175
|
gem "capistrano-rails", "~> 1.6", require: false
|
@@ -82,18 +182,30 @@
|
|
82
182
|
|
83
183
|
end
|
84
184
|
|
185
|
+
|
186
|
+
|
85
|
-
group :
|
187
|
+
group :test do
|
86
|
-
|
188
|
+
|
87
|
-
# Ca
|
189
|
+
# Adds support for Capybara system testing and selenium driver
|
88
|
-
|
190
|
+
|
89
|
-
gem '
|
191
|
+
gem 'capybara', '>= 2.15'
|
192
|
+
|
90
|
-
|
193
|
+
gem 'selenium-webdriver'
|
194
|
+
|
195
|
+
# Easy installation and use of web drivers to run system tests with browsers
|
196
|
+
|
91
|
-
gem '
|
197
|
+
gem 'webdrivers'
|
92
|
-
|
93
|
-
gem 'dotenv-rails'
|
94
198
|
|
95
199
|
end
|
96
200
|
|
201
|
+
|
202
|
+
|
203
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
204
|
+
|
205
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
206
|
+
|
207
|
+
|
208
|
+
|
97
209
|
```
|
98
210
|
|
99
211
|
|
5
gemfileの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,6 +82,18 @@
|
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
|
+
group :development, :test do
|
86
|
+
|
87
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
88
|
+
|
89
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
90
|
+
|
91
|
+
gem 'rubocop-rails'
|
92
|
+
|
93
|
+
gem 'dotenv-rails'
|
94
|
+
|
95
|
+
end
|
96
|
+
|
85
97
|
```
|
86
98
|
|
87
99
|
|
4
EC2でpostgrSQLが動いてなかった
test
CHANGED
File without changes
|
test
CHANGED
@@ -159,3 +159,33 @@
|
|
159
159
|
host: <%= ENV['アプリ名_DATABASE_HOSTNAME'] %>
|
160
160
|
|
161
161
|
```
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
EC2でpostgrSQLが動いていないようです
|
166
|
+
|
167
|
+
```
|
168
|
+
|
169
|
+
%psql -l
|
170
|
+
|
171
|
+
psql: サーバに接続できませんでした: No such file or directory
|
172
|
+
|
173
|
+
ローカルにサーバが稼動していますか?
|
174
|
+
|
175
|
+
Unixドメインソケット"/var/run/postgresql/.s.PGSQL.5432"で通信を受け付けていますか?
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
%psql -h エンドポイント -U postgres
|
180
|
+
|
181
|
+
psql (11.5、サーバ 12.4)
|
182
|
+
|
183
|
+
警告: psql のメジャーバージョンは 11 ですが、サーバのメジャーバージョンは 12 です。
|
184
|
+
|
185
|
+
psql の機能の中で、動作しないものがあるかもしれません。
|
186
|
+
|
187
|
+
SSL 接続 (プロトコル: TLSv1.2、暗号化方式: ECDHE-RSA-AES256-GCM-SHA384、ビット長: 256、圧縮: オフ)
|
188
|
+
|
189
|
+
"help" でヘルプを表示します。
|
190
|
+
|
191
|
+
```
|
3
database.ymlの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -139,3 +139,23 @@
|
|
139
139
|
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "node_modules"
|
140
140
|
|
141
141
|
```
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
database.yml
|
146
|
+
|
147
|
+
```
|
148
|
+
|
149
|
+
production:
|
150
|
+
|
151
|
+
<<: *default
|
152
|
+
|
153
|
+
database: アプリ名_production
|
154
|
+
|
155
|
+
username: postgres
|
156
|
+
|
157
|
+
password: <%= ENV['アプリ名_DATABASE_PASSWORD'] %>
|
158
|
+
|
159
|
+
host: <%= ENV['アプリ名_DATABASE_HOSTNAME'] %>
|
160
|
+
|
161
|
+
```
|
2
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
EC2 capistranoでのデプロイ時にpostgrSQL
|
1
|
+
EC2 capistranoでのデプロイ時に(connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?)s
|
test
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
###やりたいこと
|
2
|
+
|
3
|
+
capistranoを使って、デプロイを行いたいです。
|
4
|
+
|
5
|
+
|
6
|
+
|
1
7
|
### 困っていること
|
2
8
|
|
3
9
|
ローカルで
|
1
capistranoの設定記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,11 +16,11 @@
|
|
16
16
|
|
17
17
|
```
|
18
18
|
|
19
|
-
01 PG::ConnectionBad: could not connect to server: No such file or direct
|
19
|
+
01 PG::ConnectionBad: could not connect to server: No such file or directory
|
20
20
|
|
21
|
-
01
|
21
|
+
01 Is the server running locally and accepting
|
22
22
|
|
23
|
-
01
|
23
|
+
01 connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
|
24
24
|
|
25
25
|
```
|
26
26
|
|
@@ -57,3 +57,79 @@
|
|
57
57
|
|
58
58
|
|
59
59
|
他に確認すべきことや、すべきことがありましたら、ご教示お願いします。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```gemfile
|
64
|
+
|
65
|
+
group :development do
|
66
|
+
|
67
|
+
gem "capistrano", "~> 3.10", require: false
|
68
|
+
|
69
|
+
gem "capistrano-rails", "~> 1.6", require: false
|
70
|
+
|
71
|
+
gem 'capistrano-rbenv', '~> 2.2'
|
72
|
+
|
73
|
+
gem 'capistrano-rbenv-vars', '~> 0.1'
|
74
|
+
|
75
|
+
gem 'capistrano3-puma', '< 5'
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```capfile
|
84
|
+
|
85
|
+
require 'capistrano/rbenv'
|
86
|
+
|
87
|
+
require 'capistrano/bundler'
|
88
|
+
|
89
|
+
require 'capistrano/rails/assets'
|
90
|
+
|
91
|
+
require 'capistrano/rails/migrations'
|
92
|
+
|
93
|
+
require 'capistrano/puma'
|
94
|
+
|
95
|
+
install_plugin Capistrano::Puma
|
96
|
+
|
97
|
+
install_plugin Capistrano::Puma::Nginx
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
config/deploy.rb
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
lock "~> 3.14.1"
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
set :application, "アプリ名"
|
114
|
+
|
115
|
+
set :repo_url, "GitHubのリポジトリURL"
|
116
|
+
|
117
|
+
set :rbenv_ruby, File.read('.ruby-version').strip
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
set :branch, "main"
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
set :nginx_config_name, "#{fetch(:application)}.conf"
|
126
|
+
|
127
|
+
set :nginx_sites_enabled_path, "/etc/nginx/conf.d"
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
append :linked_files, "config/master.key"
|
132
|
+
|
133
|
+
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "node_modules"
|
134
|
+
|
135
|
+
```
|