【问题标题】:AWS Elastic Beanstalk Whenever failed no file or directory /var/app/ondeckAWS Elastic Beanstalk 每当失败时没有文件或目录 /var/app/ondeck
【发布时间】:2017-08-16 23:14:15
【问题描述】:

我正在尝试添加 gem 以与 ElasticBeanstalk 一起运行,并且在 eb-activity.log 中收到此错误,这正在停止我的部署。

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

对于为什么我不能 cwd 进入“/var/app/ondeck”或为什么文件夹 var/app/ondeck 尚不存在,我有点迷茫。

当我 ssh 进入我的 EC2 实例时,我可以确认没有 ondeck 文件夹 ls /var/app/ 仅显示 current。我对此的猜测是,一旦将 ondeck 文件夹上传到当前文件夹,EB 就会删除它。

这是我的 cron.config 设置

#.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

这可能是权限问题吗?我该如何进一步调试此问题?

【问题讨论】:

  • 我遇到了同样的问题,找不到任何解决方案。

标签: ruby-on-rails amazon-web-services cron amazon-elastic-beanstalk whenever


【解决方案1】:

容器命令的默认目录始终是应用程序的暂存目录,因此您无需使用 cwd: 指令设置工作目录。我的 Node.js 应用程序有一个暂存目录,例如 /tmp/deployment/application。

这应该可以解决问题:

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

【讨论】:

    猜你喜欢
    • 2022-06-11
    • 2021-06-13
    • 2013-04-26
    • 2013-03-31
    • 2020-03-04
    • 2020-12-17
    • 2018-02-10
    • 2014-10-27
    • 2015-12-15
    相关资源
    最近更新 更多