Skip to content

Commit

Permalink
s3 production
Browse files Browse the repository at this point in the history
  • Loading branch information
praneeth-bala committed Nov 26, 2024
1 parent 0717db3 commit 1b426f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .platform/nginx/conf.d/elasticbeanstalk/locs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ location /static/ {
# add_header Cache-Control "public";
}

# Serve rails static
location /rails/ {
proxy_pass http://unix:/var/run/puma/my_app.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# All other routes go to the frontend index.html for SPA routing
location / {
root /var/app/current/frontend/build;
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
config.active_storage.service = :amazon

# Assume all access to the app is happening through a SSL-terminating reverse proxy.
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
Expand Down
12 changes: 6 additions & 6 deletions config/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ local:
# primary: local
# mirrors: [ amazon, google, microsoft ]

# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: <%= Rails.application.credentials.dig(:aws, :region) %>
# bucket: <%= Rails.application.credentials.dig(:aws, :bucket) %>
amazon:
service: S3
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
secret_access_key: <%= ENV['AWS_ACCESS_KEY'] %>
region: us-west-2
bucket: rails-to-riches

0 comments on commit 1b426f7

Please sign in to comment.