The current Beanstalk solution stack for Ruby + Puma uses the configuration file at /opt/elasticbeanstalk/support/conf/pumaconf.rb
and ignores the config/puma.rb
inside the Rails application directory.
I could override the file above with a custom one via .ebextensions
but am hesitant because I'd like to avoid breakage in case the path to the PID or - more importantly - unix socket files changes in upcoming solution stack versions.
What is the best practice for customizing the Puma configuration on Beanstalk?
We use Ruby+Passenger, but it sounds similar enough to your situation. We need to customize the nginx configuration file stored at
/opt/elasticbeanstalk/support/conf/nginx_config.erb
, so we do it via.ebextensions
andsed
.Here's an example to get you started:
.ebextensions/01-edit-nginx.config
This will make a backup copy of the configuration file (without overwriting it if it already exists, thanks to the
-n
flag) and then insert the line "text_to_be_inserted" after the line "string_to_insert_text_after". You can pipe multiplesed
commands together to insert multiple lines.