diff --git a/Dockerfile b/Dockerfile index bf7e37b37..2c4df38e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ ENV PORT=3214 ENV RACK_ENV=production ENV RAILS_ENV=production ENV NODE_ENV=production -ENV RAILS_SERVE_STATIC_FILES=true ENV APP_VERSION=${APP_VERSION} ENV GIT_SHA=${GIT_SHA} diff --git a/Gemfile b/Gemfile index e4f12a819..3b717fe78 100644 --- a/Gemfile +++ b/Gemfile @@ -131,3 +131,4 @@ gem "sidekiq-failures", "~> 1.0" gem "activejob-status", "~> 1.0" gem "brakeman", "~> 6.1" +gem "thruster", "~> 0.1.3" diff --git a/Gemfile.lock b/Gemfile.lock index 4710d03a4..9edf2dfa2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -518,6 +518,9 @@ GEM unicode-display_width (>= 1.1.1, < 3) text (1.3.1) thor (1.3.1) + thruster (0.1.3) + thruster (0.1.3-x86_64-darwin) + thruster (0.1.3-x86_64-linux) tilt (2.0.10) timeout (0.4.1) translation (1.40) @@ -617,6 +620,7 @@ DEPENDENCIES stopwords-filter2 string-similarity (~> 2.1) sys-filesystem (~> 1.4) + thruster (~> 0.1.3) translation (~> 1.40) tzinfo-data view_component (~> 3.12) diff --git a/Procfile b/Procfile index 9ae88ecde..652ee6286 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -rails: bundle exec rails server -p $PORT +rails: HTTP_PORT=$PORT bundle exec thrust rails server worker: bundle exec sidekiq diff --git a/Procfile.dev b/Procfile.dev index 363212da1..ae92768e9 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,4 +1,4 @@ -rails: bin/rails server -p $PORT +rails: HTTP_PORT=$PORT thrust bin/rails server worker: bundle exec sidekiq js: yarn build --watch css: yarn build:css --watch diff --git a/config/application.rb b/config/application.rb index 1932159fd..0ea644e23 100644 --- a/config/application.rb +++ b/config/application.rb @@ -56,6 +56,9 @@ class Application < Rails::Application # Treat pundit failures as standard "forbidden" config.action_dispatch.rescue_responses["Pundit::NotAuthorizedError"] = :forbidden + # Enable X-Sendfile with Thruster in all environments + config.action_dispatch.x_sendfile_header = "X-Sendfile" + config.action_mailer.smtp_settings = { address: ENV.fetch("SMTP_SERVER", nil), user_name: ENV.fetch("SMTP_USERNAME", nil), diff --git a/config/environments/production.rb b/config/environments/production.rb index b62257d61..8b0cc5b1e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,9 +20,9 @@ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + # Disable serving static files from the `/public` folder since + # Thruster handles this. + config.public_file_server.enabled = false # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass @@ -33,10 +33,6 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.asset_host = "http://assets.example.com" - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache - # 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