gkop / elastic-beanstalk-ruby

Better practices for running Ruby on Elastic Beanstalk using Amazon's AMI
MIT License
89 stars 26 forks source link

Changes for build native extensions and avoid error with mkdir. #9

Closed gregorytkach closed 10 years ago

gregorytkach commented 10 years ago

Please test it for your environment. It's works for me (1.0.6, Ruby 2.0, Puma), but stil need test on other env's.

gkop commented 10 years ago

Thanks for the note. Unfortunately I don't have the means to easily test this as I am not running any beanstalk apps these days. However none of your changes seem obviously environment-dependent so I am optimistic about having merged them. We'll find out pretty soon if I am wrong!

dankohn commented 10 years ago

Hi, I can confirm that mkdir -p works and is a good change. I was going to issue a pull request. I also just got working modified regexes that are idempotent (they don't create bundle exec bundle exec rake if the script doesn't complete the first time it runs:

 # Run rake with bundle exec to be sure you get the right version
 #   `(?<!bundle exec )` negative lookbehind replacement idempotent
  add_bundle_exec:
    test: test ! -f /opt/elasticbeanstalk/containerfiles/.post-provisioning-complete
    cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
    command: perl -pi -e 's/(?<!bundle exec )(rake)/bundle exec $1/' 11_asset_compilation.sh 12_db_migration.sh
  # Bundle with --deployment as recommended by bundler docs
  #   cf. http://gembundler.com/v1.2/rationale.html under Deploying Your Application
  #   `(?!...) negative lookahead makes the regex idempotent
  add_deployment_flag:
    test: test ! -f /opt/elasticbeanstalk/containerfiles/.post-provisioning-complete
    cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
    command: perl -pi -e 's/(bundle install)(?! --deployment)/$1 --deployment/' 10_bundle_install.sh
gkop commented 10 years ago

@dankohn that's rad! I'd be happy to merge should you make a PR.

gkop commented 9 years ago

Thanks @hotakasaito for fixing Dan's issue in #11 .