diff --git a/.platform/nginx/conf.d/elasticbeanstalk/locs.conf b/.platform/nginx/conf.d/elasticbeanstalk/locs.conf index 8e0ac43..6ea3986 100644 --- a/.platform/nginx/conf.d/elasticbeanstalk/locs.conf +++ b/.platform/nginx/conf.d/elasticbeanstalk/locs.conf @@ -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; diff --git a/config/environments/production.rb b/config/environments/production.rb index e61e03a..f99b4ac 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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. diff --git a/config/storage.yml b/config/storage.yml index a35d4f4..5b93542 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -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) %> \ No newline at end of file +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 \ No newline at end of file