1

I am trying to add whenever gem to run with ElasticBeanstalk and am getting this error in eb-activity.log which is halting my deployment.

Test for Command cron_01_set_leader 
Activity execution failed, because: [Errno 2] No such file or directory: 
'/var/app/ondeck' (ElasticBeanstalk::ExternalInvocationError)

I am a bit lost on why I can't cwd into '/var/app/ondeck' or why the folder var/app/ondeck does not exist yet.

When I ssh into my EC2 instance I can confirm that there is no ondeck folder ls /var/app/ is only showing current. My guess on that though was EB removes ondeck folder once it has been uploaded to current.

This is my cron.config setup

#.ebextensions/cron.config
 files:
  /opt/elasticbeanstalk/hooks/appdeploy/post/10_reload_cron.sh:
    mode: "00700"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      . /opt/elasticbeanstalk/support/envvars
      cd $EB_CONFIG_APP_CURRENT
      bundle exec setup_cron
container_commands:
  cron_01_set_leader:
    test: test ! -f /opt/elasticbeanstalk/support/.cron-setup-complete
    cwd: /var/app/ondeck
    command: bundle exec create_cron_leader --no-update
    leader_only: true
  cron_02_write_cron_setup_complete_file:
    cwd: /opt/elasticbeanstalk/support
    command: touch .cron-setup-complete

Could this be a permissions issue and how could I further debug this problem ?

David Gross
  • 1,863
  • 10
  • 14

1 Answers1

2

The default directory for container commands is always the staging directory for the application, so you don't need to set the working directory with the cwd: directive. My Node.js applications have a staging directory which is /tmp/deployment/application for example.

This should do the trick:

container_commands:
  cron_01_set_leader:
    test: test ! -f /opt/elasticbeanstalk/support/.cron-setup-complete
    command: bundle exec create_cron_leader --no-update
    leader_only: true
  cron_02_write_cron_setup_complete_file:
    cwd: /opt/elasticbeanstalk/support
    command: touch .cron-setup-complete
nfilmer
  • 66
  • 3