質問編集履歴
4
コードの追加です。
title
CHANGED
File without changes
|
body
CHANGED
@@ -47,6 +47,103 @@
|
|
47
47
|
bucket: バケット名
|
48
48
|
```
|
49
49
|
|
50
|
+
```
|
51
|
+
Rails.application.configure do
|
52
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
53
|
+
|
54
|
+
# Code is not reloaded between requests.
|
55
|
+
config.cache_classes = true
|
56
|
+
|
57
|
+
# Eager load code on boot. This eager loads most of Rails and
|
58
|
+
# your application in memory, allowing both threaded web servers
|
59
|
+
# and those relying on copy on write to perform better.
|
60
|
+
# Rake tasks automatically ignore this option for performance.
|
61
|
+
config.eager_load = true
|
62
|
+
|
63
|
+
# Full error reports are disabled and caching is turned on.
|
64
|
+
config.consider_all_requests_local = false
|
65
|
+
config.action_controller.perform_caching = true
|
66
|
+
|
67
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
68
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
69
|
+
# config.require_master_key = true
|
70
|
+
|
71
|
+
# Disable serving static files from the `/public` folder by default since
|
72
|
+
# Apache or NGINX already handles this.
|
73
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
74
|
+
|
75
|
+
# Compress JavaScripts and CSS.
|
76
|
+
config.assets.js_compressor = :uglifier
|
77
|
+
# config.assets.css_compressor = :sass
|
78
|
+
|
79
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
80
|
+
config.assets.compile = false
|
81
|
+
|
82
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
83
|
+
|
84
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
85
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
86
|
+
|
87
|
+
# Specifies the header that your server uses for sending files.
|
88
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
89
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
90
|
+
|
91
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
92
|
+
config.active_storage.service = :amazon
|
93
|
+
|
94
|
+
# Mount Action Cable outside main process or domain
|
95
|
+
# config.action_cable.mount_path = nil
|
96
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
97
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ]
|
98
|
+
|
99
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
100
|
+
# config.force_ssl = true
|
101
|
+
|
102
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
103
|
+
# when problems arise.
|
104
|
+
config.log_level = :debug
|
105
|
+
|
106
|
+
# Prepend all log lines with the following tags.
|
107
|
+
config.log_tags = [ :request_id ]
|
108
|
+
|
109
|
+
# Use a different cache store in production.
|
110
|
+
# config.cache_store = :mem_cache_store
|
111
|
+
|
112
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
113
|
+
# config.active_job.queue_adapter = :resque
|
114
|
+
# config.active_job.queue_name_prefix = "potepanec_#{Rails.env}"
|
115
|
+
|
116
|
+
config.action_mailer.perform_caching = false
|
117
|
+
|
118
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
119
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
120
|
+
# config.action_mailer.raise_delivery_errors = false
|
121
|
+
|
122
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
123
|
+
# the I18n.default_locale when a translation cannot be found).
|
124
|
+
config.i18n.fallbacks = true
|
125
|
+
|
126
|
+
# Send deprecation notices to registered listeners.
|
127
|
+
config.active_support.deprecation = :notify
|
128
|
+
|
129
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
130
|
+
config.log_formatter = ::Logger::Formatter.new
|
131
|
+
|
132
|
+
# Use a different logger for distributed setups.
|
133
|
+
# require 'syslog/logger'
|
134
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
135
|
+
|
136
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
137
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
138
|
+
logger.formatter = config.log_formatter
|
139
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Do not dump schema after migrations.
|
143
|
+
config.active_record.dump_schema_after_migration = false
|
144
|
+
end
|
145
|
+
```
|
146
|
+
|
50
147
|
### 試したこと
|
51
148
|
storage.ymlにアクセス、シークレットキーを環境変数を置いた箇所を直接キーを入力。
|
52
149
|
結果は変わらなかったためキーが変数にうまく渡せていないのではなく、キー自体が間違っているのではないかと考えています。
|
3
誤字修正です。
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,8 +20,8 @@
|
|
20
20
|
$ brew install awscli
|
21
21
|
|
22
22
|
$ aws configure
|
23
|
-
AWS Access Key ID [None]:
|
23
|
+
AWS Access Key ID [None]: 該当のキー入力
|
24
|
-
AWS Secret Access Key [None]:
|
24
|
+
AWS Secret Access Key [None]: 該当のキー入力
|
25
25
|
Default region name [None]: ap-northeast-1
|
26
26
|
Default output format [None]: json
|
27
27
|
|
2
誤字修正です。
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
$ aws s3api put-bucket-acl --bucket バケット名 --acl public-read
|
30
30
|
$ aws s3 ls
|
31
31
|
|
32
|
-
$ heroku config:set AWS_ACCESS_KEY_ID=
|
32
|
+
$ heroku config:set AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY=
|
33
33
|
|
34
34
|
$ git commit -a -m "Configure Active Storage to use S3"
|
35
35
|
$ git push heroku testbranch:master
|
1
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,10 +16,37 @@
|
|
16
16
|
|
17
17
|
### 該当のソースコード
|
18
18
|
|
19
|
-
```
|
19
|
+
```terminal
|
20
|
+
$ brew install awscli
|
21
|
+
|
22
|
+
$ aws configure
|
23
|
+
AWS Access Key ID [None]:
|
24
|
+
AWS Secret Access Key [None]:
|
25
|
+
Default region name [None]: ap-northeast-1
|
26
|
+
Default output format [None]: json
|
27
|
+
|
28
|
+
$ aws s3 mb s3://バケット名
|
29
|
+
$ aws s3api put-bucket-acl --bucket バケット名 --acl public-read
|
20
|
-
|
30
|
+
$ aws s3 ls
|
31
|
+
|
32
|
+
$ heroku config:set AWS_ACCESS_KEY_ID=(potepanecユーザーのAccess key ID) AWS_SECRET_ACCESS_KEY=(potepanecユーザーのSecret access key)
|
33
|
+
|
34
|
+
$ git commit -a -m "Configure Active Storage to use S3"
|
35
|
+
$ git push heroku testbranch:master
|
36
|
+
|
37
|
+
$ heroku run bin/rails db:migrate
|
38
|
+
$ heroku run bin/rails runner 'Spree::Store.create!(name: "Sample Store", code: "sample-store", url: "example.com", mail_from_address: "store@example.com")' #この箇所でエラーが発生
|
21
39
|
```
|
22
40
|
|
41
|
+
```yml
|
42
|
+
amazon:
|
43
|
+
service: S3
|
44
|
+
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
|
45
|
+
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
|
46
|
+
region: ap-northeast-1
|
47
|
+
bucket: バケット名
|
48
|
+
```
|
49
|
+
|
23
50
|
### 試したこと
|
24
51
|
storage.ymlにアクセス、シークレットキーを環境変数を置いた箇所を直接キーを入力。
|
25
52
|
結果は変わらなかったためキーが変数にうまく渡せていないのではなく、キー自体が間違っているのではないかと考えています。
|