0

After installing/configuring whenever-elasticbeanstalk gem, I'm seeing the following error in /var/log/cfn-init.log on my EC2 instance after running git aws.push from my local repo. Iam using aws elastic benastalk with rails 4.

2014-10-21 08:08:37,602 [DEBUG] Running test for command cron_01_set_leader
2014-10-21 08:08:37,744 [DEBUG] Test command output: 
2014-10-21 08:08:37,745 [DEBUG] Test for command cron_01_set_leader passed
2014-10-21 08:08:38,085 [ERROR] Command cron_01_set_leader (su -c "/usr/local/bin/bundle exec create_cron_leader --no-update" $EB_CONFIG_APP_USER) failed
2014-10-21 08:08:38,086 [DEBUG] Command cron_01_set_leader output: bash: /usr/local/bin/bundle: No such file or directory

Traceback (most recent call last):

I have added the whenever-elasticbeanstalk Below is my cron.config file content.. Any idea ...what am i doing wrong?

    files:
  # Reload the on deployment
  /opt/elasticbeanstalk/hooks/appdeploy/post/10_reload_cron.sh:
    mode: "00700"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      . /opt/elasticbeanstalk/containerfiles/envvars
      cd $EB_CONFIG_APP_CURRENT
      su -c "/usr/local/bin/bundle exec setup_cron" $EB_CONFIG_APP_USER
  # Add Bundle to the PATH
  "/etc/profile.d/bundle.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      export PATH=$PATH:/usr/local/bin
    encoding: plain
container_commands:
  cron_01_set_leader:
    test: test ! -f /opt/elasticbeanstalk/containerfiles/.cron-setup-complete
    leader_only: true
    cwd: /var/app/ondeck
    command: su -c "/usr/local/bin/bundle exec create_cron_leader --no-update" $EB_CONFIG_APP_USER
  cron_02_write_cron_setup_complete_file:
    cwd: /opt/elasticbeanstalk/containerfiles
    command: touch .cron-setup-complete
Sumit Rai
  • 637
  • 1
  • 6
  • 11

1 Answers1

1

Which solution stack are you using? Can you give the exact name, something like "64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.1 (Puma)".

I think you will need to replace "/usr/local/bin/bundle" with the actual version of bundle that is used for the solution stack.

Can you just try using "bundle" instaed of "/usr/local/bin/bundle"?

Rohit Banga
  • 18,458
  • 31
  • 113
  • 191
  • ++ this Additionally, bundle hasn't been added to the local env variables, hence the full path to bundle. That being said, we need more information. – jufemaiz Oct 23 '14 at 06:19
  • I am using 64bit Amazon Linux 2014.03 v1.0.4 running Ruby 2.0 (Passenger Standalone).. I did used "bundle" but it didnt work! – Sumit Rai Oct 24 '14 at 06:49
  • Is it possible for you to test using the latest one "64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.0 (Passenger Standalone)" along with just "bundle" ... not '/usr/local/bin/bundle'? – Rohit Banga Oct 24 '14 at 06:52
  • Any chance you could do as above request? v1.0.4 doesn't seem to be available - with "2.0 (Passenger Standalone) on 64bit Amazon Linux 2014.03" being the closest I can see. – jufemaiz Oct 29 '14 at 00:08
  • Right, having checked with the above it appears that this older instance type for AWS EB does not follow the convention of later AWS EB instances. You will need to change any reference to "/usr/local/bin/bundle" to "/usr/bin/bundle". These exist in two primary locations: # ./.ebextensions/cron.config # ./config/schedule.rb – jufemaiz Oct 29 '14 at 02:32
  • Actually, it appears that there was even more significant changes made after this instance. Can you advise *why* this instance is being used? You may find better luck using the older gem (v1.1.3) and going through the creation of the cron.config file again. – jufemaiz Oct 29 '14 at 03:05
  • The latest one (64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.1 (Puma) right now) has the support for just specifying "bundle" in container_commands instead of the full path. So that should work for you. – Rohit Banga Oct 29 '14 at 03:20
  • I havent tried yet with 64bit Amazon Linux 2014.03 v1.0.9 running Ruby 2.1 (Puma) yet...but i wil give a try... Before that i will check with Older gem(v1.1.3) – Sumit Rai Oct 29 '14 at 10:11
  • I am having the same issue. Switched `/usr/local/bin/bundle` to just `bundle` and ran into an error that bundle couldn't be found. Changed `bundle` to the actual path of `/opt/rubies/ruby-2.1.2/bin/bundle` and got an error that setup_cron couldn't be found. – YWCA Hello Nov 03 '14 at 21:17