dignoe / whenever-elasticbeanstalk

Allows you to run cron jobs easily on one or all AWS Elastic Beanstalk instances.
MIT License
48 stars 35 forks source link

create_cron_leader - Set instance_id to /var/app/support/instance_id - When file doesn't exist #15

Closed sushmasatish closed 8 years ago

sushmasatish commented 10 years ago

I have a single elastic-beanstalk instance which I created just 2 days back: 29-Jul-2014 which didn't have /var/app/support directory. And Hence I got errors:

whenever-elasticbeanstalk-1.1.3/bin/create_cron_leader: 36:in initialize': No such file or directory - /var/app/support/instance_id (Errno::ENOENT) from /usr/local/share/ruby/gems/2.0/gems/whenever-elasticbeanstalk-1.1.3/bin/create_cron_leader:36:inopen'

As per code in the else block, the code assumes that a support directory exists, Can a fix be added to check whether support directory exists or not, if not, then create the directory and then do File.open?

jufemaiz commented 10 years ago

Hi @sushmasatish - this issue is known and has been resolved at https://github.com/jufemaiz/whenever-beanstalk

I've still got to get authority over at rubygems for access :)

jufemaiz commented 10 years ago

In the interim you can use the following in your Gemfile:

gem 'whenever-elasticbeanstalk', :git => 'https://github.com/dignoe/whenever-elasticbeanstalk.git', :ref => '6a3b58a'

Can you confirm if this solves your issue.

jufemaiz commented 10 years ago

Gem v1.1.4 released.

https://rubygems.org/gems/whenever-elasticbeanstalk

sushmasatish commented 10 years ago

Tried with v1.1.4, But getting

AWS::EC2::Errors::UnauthorizedOperation: You are not authorized to perform this operation.

in create_cron_leader file - line 49: env_name = ec2.instances[instance_id].tags["elasticbeanstalk:environment-name"]

Have got both AWS_ACCESS_KEY_ID and AWS_SECRET_KEY set in configuration.

jufemaiz commented 10 years ago

Hi @sushmasatish, I shifted off the AWS access / secret key method to use EC2 Instance IAM Role Permissions for security's sake ( https://github.com/dignoe/whenever-elasticbeanstalk#ec2-instance-iam-role-permissions )

Can you try again with that noted? Cheers!

jufemaiz commented 10 years ago

I'll close this issue if there's no response in 10 days.