質問編集履歴
4
コードの追加です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,6 +96,200 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
+
```
|
100
|
+
|
101
|
+
Rails.application.configure do
|
102
|
+
|
103
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
# Code is not reloaded between requests.
|
108
|
+
|
109
|
+
config.cache_classes = true
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
# Eager load code on boot. This eager loads most of Rails and
|
114
|
+
|
115
|
+
# your application in memory, allowing both threaded web servers
|
116
|
+
|
117
|
+
# and those relying on copy on write to perform better.
|
118
|
+
|
119
|
+
# Rake tasks automatically ignore this option for performance.
|
120
|
+
|
121
|
+
config.eager_load = true
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# Full error reports are disabled and caching is turned on.
|
126
|
+
|
127
|
+
config.consider_all_requests_local = false
|
128
|
+
|
129
|
+
config.action_controller.perform_caching = true
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
134
|
+
|
135
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
136
|
+
|
137
|
+
# config.require_master_key = true
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# Disable serving static files from the `/public` folder by default since
|
142
|
+
|
143
|
+
# Apache or NGINX already handles this.
|
144
|
+
|
145
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
# Compress JavaScripts and CSS.
|
150
|
+
|
151
|
+
config.assets.js_compressor = :uglifier
|
152
|
+
|
153
|
+
# config.assets.css_compressor = :sass
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
158
|
+
|
159
|
+
config.assets.compile = false
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
168
|
+
|
169
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
# Specifies the header that your server uses for sending files.
|
174
|
+
|
175
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
176
|
+
|
177
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
182
|
+
|
183
|
+
config.active_storage.service = :amazon
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
# Mount Action Cable outside main process or domain
|
188
|
+
|
189
|
+
# config.action_cable.mount_path = nil
|
190
|
+
|
191
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
192
|
+
|
193
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ]
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
198
|
+
|
199
|
+
# config.force_ssl = true
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
204
|
+
|
205
|
+
# when problems arise.
|
206
|
+
|
207
|
+
config.log_level = :debug
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
# Prepend all log lines with the following tags.
|
212
|
+
|
213
|
+
config.log_tags = [ :request_id ]
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
# Use a different cache store in production.
|
218
|
+
|
219
|
+
# config.cache_store = :mem_cache_store
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
224
|
+
|
225
|
+
# config.active_job.queue_adapter = :resque
|
226
|
+
|
227
|
+
# config.active_job.queue_name_prefix = "potepanec_#{Rails.env}"
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
config.action_mailer.perform_caching = false
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
236
|
+
|
237
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
238
|
+
|
239
|
+
# config.action_mailer.raise_delivery_errors = false
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
244
|
+
|
245
|
+
# the I18n.default_locale when a translation cannot be found).
|
246
|
+
|
247
|
+
config.i18n.fallbacks = true
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
# Send deprecation notices to registered listeners.
|
252
|
+
|
253
|
+
config.active_support.deprecation = :notify
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
258
|
+
|
259
|
+
config.log_formatter = ::Logger::Formatter.new
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
# Use a different logger for distributed setups.
|
264
|
+
|
265
|
+
# require 'syslog/logger'
|
266
|
+
|
267
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
272
|
+
|
273
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
274
|
+
|
275
|
+
logger.formatter = config.log_formatter
|
276
|
+
|
277
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
# Do not dump schema after migrations.
|
284
|
+
|
285
|
+
config.active_record.dump_schema_after_migration = false
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
```
|
290
|
+
|
291
|
+
|
292
|
+
|
99
293
|
### 試したこと
|
100
294
|
|
101
295
|
storage.ymlにアクセス、シークレットキーを環境変数を置いた箇所を直接キーを入力。
|
3
誤字修正です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,9 +42,9 @@
|
|
42
42
|
|
43
43
|
$ aws configure
|
44
44
|
|
45
|
-
AWS Access Key ID [None]:
|
45
|
+
AWS Access Key ID [None]: 該当のキー入力
|
46
46
|
|
47
|
-
AWS Secret Access Key [None]:
|
47
|
+
AWS Secret Access Key [None]: 該当のキー入力
|
48
48
|
|
49
49
|
Default region name [None]: ap-northeast-1
|
50
50
|
|
2
誤字修正です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
|
62
62
|
|
63
|
-
$ heroku config:set AWS_ACCESS_KEY_ID=
|
63
|
+
$ heroku config:set AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY=
|
64
64
|
|
65
65
|
|
66
66
|
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,9 +34,63 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
-
```
|
37
|
+
```terminal
|
38
38
|
|
39
|
+
$ brew install awscli
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
$ aws configure
|
44
|
+
|
45
|
+
AWS Access Key ID [None]:
|
46
|
+
|
47
|
+
AWS Secret Access Key [None]:
|
48
|
+
|
49
|
+
Default region name [None]: ap-northeast-1
|
50
|
+
|
51
|
+
Default output format [None]: json
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
$ aws s3 mb s3://バケット名
|
56
|
+
|
57
|
+
$ aws s3api put-bucket-acl --bucket バケット名 --acl public-read
|
58
|
+
|
59
|
+
$ aws s3 ls
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
$ heroku config:set AWS_ACCESS_KEY_ID=(potepanecユーザーのAccess key ID) AWS_SECRET_ACCESS_KEY=(potepanecユーザーのSecret access key)
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
$ git commit -a -m "Configure Active Storage to use S3"
|
68
|
+
|
69
|
+
$ git push heroku testbranch:master
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
$ heroku run bin/rails db:migrate
|
74
|
+
|
75
|
+
$ heroku run bin/rails runner 'Spree::Store.create!(name: "Sample Store", code: "sample-store", url: "example.com", mail_from_address: "store@example.com")' #この箇所でエラーが発生
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
|
39
|
-
|
81
|
+
```yml
|
82
|
+
|
83
|
+
amazon:
|
84
|
+
|
85
|
+
service: S3
|
86
|
+
|
87
|
+
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
|
88
|
+
|
89
|
+
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
|
90
|
+
|
91
|
+
region: ap-northeast-1
|
92
|
+
|
93
|
+
bucket: バケット名
|
40
94
|
|
41
95
|
```
|
42
96
|
|