I am running ruby "3.1.1", rails (7.0.3.1), fog-aws (3.14.0), fog-core (2.3.0) and I start puma using systemd. Requests come in through AWS ALB 443 -> 80.
Since implementing the fog-aws Gem my puma_access.log just keeps writing: [31723] ! Unable to start worker [31723] /var/www/iot/shared/bundle/ruby/3.1.0/gems/fog-core-2.3.0/lib/fog/core/cache.rb:94:in `expand_path' [31723] Early termination of worker
and any requests just 504 Gateway time-out. Running puma outside of systemctl seems to work ok.
/var/www/iot/shared/bundle/ruby/3.1.0/gems/fog-core-2.3.0/lib/fog/core/cache.rb:94 is:
SANDBOX = ENV["HOME"] ? File.expand_path("~/.fog-cache") : File.expand_path(".fog-cache")
Although I am not sure why that is relevant, ENV["HOME"] = "/home/ec2-user"
Please help!
I managed to resolve the issue by setting env["HOME"] in my systemd process, but unsure why this helped.