broken image only on producton (Rails 7.0.4)

I am stuck for 3 days now :frowning:
If anyone could help, that would be awesome!

I set up storage.yml to AWS S3 on both development.rb and production.rb.

Now, upload on both development and production works.
The difference is, I can see the image as intended on development (0.0.0.0:8000) but broken image on production after deploying to Fly.io.

here is the log file I have:

2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] MiniMagick::Error (You must have ImageMagick or GraphicsMagick installed):                
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8]
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] mini_magick (4.12.0) lib/mini_magick/configuration.rb:147:in `cli'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] mini_magick (4.12.0) lib/mini_magick.rb:38:in `imagemagick7?'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] mini_magick (4.12.0) lib/mini_magick/tool.rb:135:in `executable'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] mini_magick (4.12.0) lib/mini_magick/tool.rb:110:in `command'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] mini_magick (4.12.0) lib/mini_magick/tool.rb:92:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/mini_magick.rb:56:in `save_image'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/processor.rb:23:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/pipeline.rb:50:in `call_processor'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/pipeline.rb:28:in `block in call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/pipeline.rb:64:in `create_tempfile'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/pipeline.rb:27:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/builder.rb:14:in `block in call!'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/builder.rb:21:in `instrument'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/builder.rb:13:in `call!'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] image_processing (1.12.2) lib/image_processing/chainable.rb:60:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/transformers/image_processing_transformer.rb:25:in `process'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/transformers/transformer.rb:22:in `transform'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variation.rb:56:in `block in transform'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/notifications.rb:208:in `instrument'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variation.rb:55:in `transform'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variant_with_record.rb:35:in `block in transform_blob'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/downloader.rb:15:in `block in open'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/downloader.rb:24:in `open_tempfile'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/downloader.rb:12:in `open'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) lib/active_storage/service.rb:90:in `open'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/blob.rb:301:in `open'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variant_with_record.rb:34:in `transform_blob'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variant_with_record.rb:19:in `process'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/models/active_storage/variant_with_record.rb:14:in `processed'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activestorage (7.0.4) app/controllers/active_storage/representations/base_controller.rb:14:in `set_representation'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:400:in `block in make_lambda'
2023-01-22T12:28:06Z app[44070a03] syd [info]n `call'
[78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
[7
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:200:in `block in halting'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:595:in `block in invoke_before'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:595:in `each'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:595:in `invoke_before'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:116:in `block in run_callbacks'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actiontext (7.0.4) lib/action_text/rendering.rb:20:in `with_renderer'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actiontext (7.0.4) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:127:in `instance_exec'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:138:in `run_callbacks'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/abstract_controller/callbacks.rb:233:in `process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/notifications.rb:206:in `block in instrument'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/notifications.rb:206:in `instrument'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activerecord (7.0.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/abstract_controller/base.rb:151:in `process'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionview (7.0.4) lib/action_view/rendering.rb:39:in `process'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal.rb:188:in `dispatch'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_controller/metal.rb:251:in `dispatch'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:32:in `serve'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/journey/router.rb:32:in `each'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/journey/router.rb:32:in `serve'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:852:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/etag.rb:27:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/head.rb:12:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][7
2023-01-22T12:28:06Z app[44070a03] syd [info]ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/cookies.rb:696:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/callbacks.rb:99:in `run_callbacks'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] railties (7.0.4) lib/rails/rack/logger.rb:40:in `call_app'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] railties (7.0.4) lib/rails/rack/logger.rb:25:in `block in call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/tagged_logging.rb:37:in `tagged'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `tagged'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] railties (7.0.4) lib/rails/rack/logger.rb:25:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/method_override.rb:24:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/runtime.rb:22:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/static.rb:23:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] rack (2.2.4) lib/rack/sendfile.rb:110:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] actionpack (7.0.4) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] railties (7.0.4) lib/rails/engine.rb:530:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/configuration.rb:252:in `call'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/request.rb:77:in `block in handle_request'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/request.rb:76:in `handle_request'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/server.rb:441:in `process_client'
2023-01-22T12:28:06Z app[44070a03] syd [info][78ac86e9-1ed8-407b-96da-9048c679eee8] puma (5.6.4) lib/puma/thread_pool.rb:147:in `block in spawn_thread'

Screenshot 2023-01-22 at 11.34.54 pm

PRODUCTION.RB

require "active_support/core_ext/integer/time"

Rails.application.configure do

  config.cache_classes = true
  config.eager_load = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true


  config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
  #config.public_file_server.enabled = ENV.fetch("RAILS_SERVE_STATIC_FILES") { true }
  #config.public_file_server.enabled = true
  #config.serve_static_assets = true

  config.assets.compile = true

  # 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 = :amazon

  # Mount Action Cable outside main process or domain.
  # config.action_cable.mount_path = nil
  # config.action_cable.url = "wss://example.com/cable"
  # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Include generic and useful information about system operation, but avoid logging too much
  # information to avoid inadvertent exposure of personally identifiable information (PII).
  config.log_level = :info

  # Prepend all log lines with the following tags.
  config.log_tags = [ :request_id ]

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # Use a real queuing backend for Active Job (and separate queues per environment).
  # config.active_job.queue_adapter     = :resque
  # config.active_job.queue_name_prefix = "fallencrumbs_production"

  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  config.action_mailer.raise_delivery_errors = false

  host = 'onewordfeedback.com' # Don't use this literally; use your local host instead.
  # Use this on the cloud IDE.
  config.action_mailer.default_url_options = { host: 'onewordfeedback.com', protocol: 'https' }

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Don't log any deprecations.
  config.active_support.report_deprecations = false

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Use a different logger for distributed setups.
  # require "syslog/logger"
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false
end

DEVELOPMENT.RB

require "active_support/core_ext/integer/time"

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded any time
  # it changes. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports.
  config.consider_all_requests_local = true

  # Enable server timing
  config.server_timing = true

  # Enable/disable caching. By default caching is disabled.
  # Run rails dev:cache to toggle caching.
  if Rails.root.join("tmp/caching-dev.txt").exist?
    config.action_controller.perform_caching = true
    config.action_controller.enable_fragment_cache_logging = true

    config.cache_store = :memory_store
    config.public_file_server.headers = {
      "Cache-Control" => "public, max-age=#{2.days.to_i}"
    }
  else
    config.action_controller.perform_caching = false

    config.cache_store = :null_store
  end

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

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  host = 'localhost:8000' # Don't use this literally; use your local host instead.
  # Use this on the cloud IDE.
  config.action_mailer.default_url_options = { host: 'localhost', port: 8000 }
  # Use this if developing on localhost.
  # config.action_mailer.default_url_options = { host: host, protocol: 'http' }

  config.action_mailer.perform_caching = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise exceptions for disallowed deprecations.
  config.active_support.disallowed_deprecation = :raise

  # Tell Active Support which deprecation messages to disallow.
  config.active_support.disallowed_deprecation_warnings = []

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Highlight code that triggered database queries in logs.
  config.active_record.verbose_query_logs = true

  # Suppress logger output for asset requests.
  config.assets.quiet = true

  # Raises error for missing translations.
  # config.i18n.raise_on_missing_translations = true

  # Annotate rendered view with file names.
  # config.action_view.annotate_rendered_view_with_filenames = true

  # Uncomment if you wish to allow Action Cable access from any origin.
  # config.action_cable.disable_request_forgery_protection = true
end

It’s a long time since I’ve used Rails but that error at the top of the log looks pretty clear…

It looks like you have ImageMagick/GraphicMagick installed locally but it’s not on your fly deploy. I recall having problems installing that years ago when I last used Rails so maybe it is still tricky these days. Did you have to install it manually locally? If so, you might need some extra commands in your Dockerfile so that it’s also available on fly.

I don’t believe MiniMagick automatically installs ImageMagick or GraphicMagick for you.

The other possibility is that you have further configuration somewhere that means MiniMagick is only trying to run in production but not on dev. Do you have anything set up to alter (e.g. scale or crop) the images you are uploading?

Thank you for your reply.

I will try using the dockerfile to install it.
I had to install manually.

For image altering, I only have the following set up.

  class Application < Rails::Application
    config.load_defaults 7.0
    **config.active_storage.variant_processor = :mini_magick**
  end

Ok I got it to working.
Adding the imagemagick to the dockerfile did the trick!

Thank you so much!

Hello.
I am in the same case as you.
I would like to add the image_magick image to my Dockerfile, can you please tell me the procedure?:bowing_man:

By the way, I tried to do it myself by referring here, but the image did not show up.


FROM debian:bullseye-slim

ENV DEBIAN_FRONTEND=noninteractive

ARG IM_VERSION=7.1.0-62
ARG LIB_HEIF_VERSION=1.15.1
ARG LIB_AOM_VERSION=3.6.0
ARG LIB_WEBP_VERSION=1.3.0
ARG LIBJXL_VERSION=0.8.1

RUN apt-get -y update && \
    apt-get -y upgrade && \
    apt-get install -y --no-install-recommends git make pkg-config autoconf curl cmake clang libomp-dev ca-certificates automake \
    # libaom
    yasm \
    # libheif
    libde265-0 libde265-dev libjpeg62-turbo libjpeg62-turbo-dev x265 libx265-dev libtool \
    # libwebp
    libsdl1.2-dev libgif-dev \
    # libjxl
    libbrotli-dev \
    # IM
    libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libgomp1 ghostscript libxml2-dev libxml2-utils libtiff-dev libfontconfig1-dev libfreetype6-dev fonts-dejavu liblcms2-2 liblcms2-dev \
    # Install manually to prevent deleting with -dev packages
    libxext6 libbrotli1 && \
    export CC=clang CXX=clang++ && \
    # Building libjxl
    git clone -b v${LIBJXL_VERSION} https://github.com/libjxl/libjxl.git --depth 1 --recursive --shallow-submodules && \
    cd libjxl && \
    mkdir build && \
    cd build && \
    cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. && \
    cmake --build . -- -j$(nproc) && \
    cmake --install . && \
    cd ../../ && \
    rm -rf libjxl && \
    ldconfig /usr/local/lib && \
    # Building libwebp
    git clone -b v${LIB_WEBP_VERSION} --depth 1 https://chromium.googlesource.com/webm/libwebp && \
    cd libwebp && \
    ./autogen.sh && ./configure --enable-shared --enable-libwebpdecoder --enable-libwebpdemux --enable-libwebpmux --enable-static=no && \
    make && make install && \
    ldconfig /usr/local/lib && \
    cd ../ && rm -rf libwebp && \
    # Building libaom
    git clone -b v${LIB_AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom && \
    mkdir build_aom && \
    cd build_aom && \
    cmake ../aom/ -DENABLE_TESTS=0 -DBUILD_SHARED_LIBS=1 && make && make install && \
    ldconfig /usr/local/lib && \
    cd .. && \
    rm -rf aom && \
    rm -rf build_aom && \
    # Building libheif
    curl -L https://github.com/strukturag/libheif/releases/download/v${LIB_HEIF_VERSION}/libheif-${LIB_HEIF_VERSION}.tar.gz -o libheif.tar.gz && \
    tar -xzvf libheif.tar.gz && cd libheif-${LIB_HEIF_VERSION}/ && ./autogen.sh && ./configure && make && make install && cd .. && \
    ldconfig /usr/local/lib && \
    rm -rf libheif-${LIB_HEIF_VERSION} && rm libheif.tar.gz && \
    # Building ImageMagick
    git clone -b ${IM_VERSION} --depth 1 https://github.com/ImageMagick/ImageMagick.git && \
    cd ImageMagick && \
    ./configure --without-magick-plus-plus --disable-docs --disable-static --with-tiff --with-jxl && \
    make && make install && \
    ldconfig /usr/local/lib && \
    apt-get remove --autoremove --purge -y make cmake clang clang-11 curl yasm git autoconf automake pkg-config libpng-dev libjpeg62-turbo-dev libde265-dev libx265-dev libxml2-dev libtiff-dev libfontconfig1-dev libfreetype6-dev liblcms2-dev libsdl1.2-dev libgif-dev libbrotli-dev && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /ImageMagick

WORKDIR /imgs

ENTRYPOINT ["convert"]