在Elastic Beanstalk上设置delay_job时如何获取修复“ require”错误

缅因州金里

我无法在Elastic Beanstalk上运行delay_jobs。我正在使用运行Ruby 2.1(Passenger Standalone)容器64位Amazon Linux 2014.03 v1.0.0

这是我的配置脚本(delayed_job.config)...

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh":
    mode: "000755"
    owner: root
    group: root
    encoding: plain
    content: |
      #!/usr/bin/env bash
      . /opt/elasticbeanstalk/support/envvars
      cd $EB_CONFIG_APP_CURRENT
      su -c "RAILS_ENV=production bin/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart" $EB_CONFIG_APP_USER

99_restart_delayed_job.sh脚本存在并运行...但是后来我偶然发现了此错误。

2014-10-02 15:28:32,332 [INFO] (17387 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Script succeeded.
2014-10-02 15:28:32,402 [INFO] (17448 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing directory: /opt/elasticbeanstalk/hooks/appdeploy/post/
2014-10-02 15:28:32,402 [INFO] (17448 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing script: /opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh
/usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /var/app/current/config/boot.rb:4:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /var/app/current/config/application.rb:1:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /var/app/current/config/environment.rb:2:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from bin/delayed_job:3:in `<main>'

2014-10-02 15:28:32,440 [ERROR] (17448 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh failed with returncode 1

我已经在SO上浏览了另一个线程,向我展示了如何设置。我的问题是我不知道是什么阻止了脚本无错误运行。

如果我通过SSH进入EC2实例,则可以运行此程序而不会出现错误...

RAILS_ENV=production bin/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart

虽然这要求我输入密码...

su -c "RAILS_ENV=production bin/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart" $EB_CONFIG_APP_USER

我可以通过这样做避免...

sudo su -c "RAILS_ENV=production bin/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart" $EB_CONFIG_APP_USER

请参阅:“在Amazon Elastic Beanstalk上部署Rails项目时如何自动重新启动delay_job?”

更新1:2014-10-15

在应用-l选项并传递目录更改后,出现此错误...

2014-10-15 06:17:28,673 [INFO] (4417 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing script: /opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh
2014-10-15 06:17:30,374 [INFO] (4417 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:393:in `kill': Operation not permitted (Errno::EPERM)
    from /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:393:in `stop'
    from /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:171:in `block (2 levels) in stop_all'

2014-10-15 06:17:30,374 [ERROR] (4417 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh failed with returncode 1

更新2:2014-10-15

原来,上面的错误是由root创建的现有pid引起的(调试时,我手动启动了delay_job),因此c2用户无法重新启动/杀死它,因此出错。

基督教女青年会你好

据我所知,问题是切换到$EB_CONFIG_APP_USERlinux用户时没有建立环境/路径变量我进行了三处更改:

  1. -l选项添加su命令中以模拟的完整登录$EB_CONFIG_APP_USER
  2. 作为该-l选项的副作用,必须将change directory命令带入该-c选项。
  3. 一项很好的措施,但不一定是必要的,包括bundle exec确保使用了正确的宝石。

这是我的工作content:范围:

#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
su -l -c "cd $EB_CONFIG_APP_CURRENT && RAILS_ENV=production bundle exec bin/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart" $EB_CONFIG_APP_USER

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何修复部署在 Elastic Beanstalk 上的 django-allauth 的“社交网络登录失败”错误

来自分类Dev

AWS Elastic Beanstalk错误-乘客

来自分类Dev

ExpressJS-Elastic Beanstalk 502错误网关

来自分类Dev

AWS Elastic BeanStalk“ eb init”错误

来自分类Dev

Rails 4 Elastic Beanstalk部署错误

来自分类Dev

错误:无法更新AWS Elastic Beanstalk环境

来自分类Dev

Elastic Beanstalk上的502错误的网关Nginx + PUMA + Rails 3.2

来自分类Dev

将NodeJS部署到Elastic Beanstalk时出现NPM错误

来自分类Dev

访问 Elastic Beanstalk 端点时出现 502 代理错误

来自分类Dev

在Ubuntu上设置Elastic Beanstalk

来自分类Dev

ImportError:无法在AWS Elastic Beanstalk上导入设置(在> sys.path上吗?设置文件中是否有导入错误?)

来自分类Dev

找不到Elastic Beanstalk 404部署Rails错误

来自分类Dev

带有node.js的Elastic Beanstalk启动错误

来自分类Dev

AWS Elastic Beanstalk Node.js npm安装错误

来自分类Dev

找不到Elastic Beanstalk 404部署Rails错误

来自分类Dev

带有node.js的Elastic Beanstalk启动错误

来自分类Dev

Rails 4.2 MySQL 5.6 Elastic Beanstalk YAML语法错误

来自分类Dev

Rails-AWS(Elastic Beanstalk)部署,错误命令“ git clone”

来自分类Dev

如何在 AWS Elastic Beanstalk 上设置编码?

来自分类Dev

Amazon Elastic MapReduce上的Spark Java错误NoClassDefFoundError

来自分类Dev

尝试安装Elastic ECK时出现错误413

来自分类Dev

如何使用Elastic Beanstalk设置实例类型?

来自分类Dev

如何为Elastic Beanstalk设置VPC

来自分类Dev

部署Flask应用程序时如何解决此Elastic Beanstalk错误:在系统上找不到Python 3.7.0

来自分类Dev

Django 500.html模板未用于Amazon Elastic Beanstalk上的内部服务器错误

来自分类Dev

用于NodeJS的Elastic Beanstalk上的SELF_SIGNED_CERT_IN_CHAIN错误

来自分类Dev

Elastic Beanstalk-实例上的命令失败。发生意外错误[ErrorCode:0000000001]

来自分类Dev

Spring AWS:在Elastic Beanstalk上部署War时访问被拒绝错误

来自分类Dev

如何在Elastic Beanstalk上添加PATH

Related 相关文章

  1. 1

    如何修复部署在 Elastic Beanstalk 上的 django-allauth 的“社交网络登录失败”错误

  2. 2

    AWS Elastic Beanstalk错误-乘客

  3. 3

    ExpressJS-Elastic Beanstalk 502错误网关

  4. 4

    AWS Elastic BeanStalk“ eb init”错误

  5. 5

    Rails 4 Elastic Beanstalk部署错误

  6. 6

    错误:无法更新AWS Elastic Beanstalk环境

  7. 7

    Elastic Beanstalk上的502错误的网关Nginx + PUMA + Rails 3.2

  8. 8

    将NodeJS部署到Elastic Beanstalk时出现NPM错误

  9. 9

    访问 Elastic Beanstalk 端点时出现 502 代理错误

  10. 10

    在Ubuntu上设置Elastic Beanstalk

  11. 11

    ImportError:无法在AWS Elastic Beanstalk上导入设置(在> sys.path上吗?设置文件中是否有导入错误?)

  12. 12

    找不到Elastic Beanstalk 404部署Rails错误

  13. 13

    带有node.js的Elastic Beanstalk启动错误

  14. 14

    AWS Elastic Beanstalk Node.js npm安装错误

  15. 15

    找不到Elastic Beanstalk 404部署Rails错误

  16. 16

    带有node.js的Elastic Beanstalk启动错误

  17. 17

    Rails 4.2 MySQL 5.6 Elastic Beanstalk YAML语法错误

  18. 18

    Rails-AWS(Elastic Beanstalk)部署,错误命令“ git clone”

  19. 19

    如何在 AWS Elastic Beanstalk 上设置编码?

  20. 20

    Amazon Elastic MapReduce上的Spark Java错误NoClassDefFoundError

  21. 21

    尝试安装Elastic ECK时出现错误413

  22. 22

    如何使用Elastic Beanstalk设置实例类型?

  23. 23

    如何为Elastic Beanstalk设置VPC

  24. 24

    部署Flask应用程序时如何解决此Elastic Beanstalk错误:在系统上找不到Python 3.7.0

  25. 25

    Django 500.html模板未用于Amazon Elastic Beanstalk上的内部服务器错误

  26. 26

    用于NodeJS的Elastic Beanstalk上的SELF_SIGNED_CERT_IN_CHAIN错误

  27. 27

    Elastic Beanstalk-实例上的命令失败。发生意外错误[ErrorCode:0000000001]

  28. 28

    Spring AWS:在Elastic Beanstalk上部署War时访问被拒绝错误

  29. 29

    如何在Elastic Beanstalk上添加PATH

热门标签

归档