ricktbaker / beanstalk-nginx-php-fpm

How to replace apache with nginx and php-fpm on AWS beanstalk
MIT License
74 stars 27 forks source link

No such file or directory #1

Open yohancayres opened 7 years ago

yohancayres commented 7 years ago

I'm trying to send the code to the elastic beanstalk. But I'm getting the following error:

[Instance: i-070f6ba774e338d74] Command failed on instance. Return code: 1 Output: No such file or directory - /opt/elasticbeanstalk/hooks/appdeploy/post/98_setupvars.sh. For more detail, check /var/log/eb-activity.log using console or EB CLI.

This code worked perfectly until last week, and today started to give this problem and I can not deploy a new version to the server.

part of eb-activity.log

[2017-10-21T20:42:25.439Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployEnactHook/99_reload_app_server.sh] : Starting activity...
[2017-10-21T20:42:25.496Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployEnactHook/99_reload_app_server.sh] : Completed activity. Result:
  Equivalent Upstart operations: start httpd, stop httpd, restart httpd, status httpd
  Gracefully restarting httpd
  Stopping httpd
  stop: Unknown instance: 
  Starting httpd
  httpd start/running, process 4814
  [OK]
[2017-10-21T20:42:25.496Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployEnactHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2017-10-21T20:42:25.496Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook] : Starting activity...
[2017-10-21T20:42:25.497Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook/01_monitor_httpd_pid.sh] : Starting activity...
[2017-10-21T20:42:25.635Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook/01_monitor_httpd_pid.sh] : Completed activity. Result:
  + chmod 0755 /var/run/httpd
  + /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy nginx
[2017-10-21T20:42:25.635Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook/98_setupvars.sh] : Starting activity...
[2017-10-21T20:42:25.638Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook/98_setupvars.sh] : Activity has unexpected exception, because: No such file or directory - /opt/elasticbeanstalk/hooks/appdeploy/post/98_setupvars.sh (Errno::ENOENT)
    at /opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/open3.rb:193:in `spawn'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/open3.rb:193:in `popen_run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/open3.rb:188:in `popen2e'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/executor-1.2/lib/executor/exec.rb:101:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/executor-1.2/lib/executor/exec.rb:72:in `sh'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/executor-1.2/lib/executor.rb:15:in `sh'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/executable.rb:78:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/hook-directory-executor.rb:31:in `block (2 levels) in run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:123:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/hook-directory-executor.rb:29:in `block in run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/hook-directory-executor.rb:27:in `each'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/hook-directory-executor.rb:27:in `run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:213:in `block (3 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:123:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:208:in `block (2 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:206:in `each'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:206:in `each_with_index'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:206:in `block in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:123:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:203:in `exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command.rb:150:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command-processor.rb:77:in `block (3 levels) in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:195:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:123:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/activity.rb:122:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command-processor.rb:74:in `block (2 levels) in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command-processor.rb:144:in `execute_command'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command-processor.rb:70:in `block in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/healthd_reporter.rb:56:in `log'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/lib/elasticbeanstalk/command-processor.rb:69:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/bin/command-processor:45:in `<top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `load'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `<main>'

[2017-10-21T20:42:25.638Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1/AppDeployPostHook] : Activity internal failure.
[2017-10-21T20:42:25.638Z] INFO  [4388]  - [Application update 2.0.5-8@52/AppDeployStage1] : Activity internal failure.
[2017-10-21T20:42:25.638Z] INFO  [4388]  - [Application update 2.0.5-8@52] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed
[2017-10-21T20:42:54.455Z] INFO  [4886]  - [CMD-TailLogs] : Starting activity...
[2017-10-21T20:42:54.455Z] INFO  [4886]  - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2017-10-21T20:42:54.455Z] INFO  [4886]  - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2017-10-21T20:42:54.456Z] INFO  [4886]  - [CMD-TailLogs/TailLogs] : Starting activity...
ricktbaker commented 7 years ago

Hmm, does the .ebextensions/appdeploy/post/98_setupvars.sh still exist in your repo? This particular line in 01_setup.config should be copying it over:

020_appdeploy: command: cp -rf .ebextensions/appdeploy/* /opt/elasticbeanstalk/hooks/appdeploy/

yohancayres commented 7 years ago

I checked all of this, and the files are present.

I realized that the problem only occurs when I try to run "eb deploy", or when I zip the file on the computer in my home.

PS C:\inetpub\loja-dev> eb deploy
Creating application version archive "app-ea77-171027_152020".
Uploading: [####----------------------------------------------] 8% c:\python27\lib\site-packages\dateutil\parser.py:605: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpre
ting them as being unequal
  elif res.tzname and res.tzname in time.tzname:
Uploading: [##################################################] 100% Done...
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
INFO: Environment health has transitioned from Ok to Info. Application update in progress on 2 instances. 0 out of 2 instances completed (running for 5 seconds).
ERROR: [Instance: i-06110c42e67a57154,i-0f1253e140beaeacd] Command failed on instance. Return code: 1 Output: No such file or directory - /opt/elasticbeanstalk/hooks/appdeploy/post/98_setupvars.sh. For more detail, c
heck /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 2].
ERROR: Unsuccessful command execution on instance id(s) 'i-06110c42e67a57154,i-0f1253e140beaeacd'. Aborting the operation.
ERROR: Failed to deploy application.

ERROR: Failed to deploy application.
ricktbaker commented 7 years ago

Hmm, interesting. I'm not sure on the eb deploy, that should be including the .ebextensions folder by default. I'll have to test with that.

When you create the zip file on your home computer are you making sure that it is including the hidden folders?

zip -r deployment.zip .

konradkalemba commented 6 years ago

I ran into the same problem (but with 97_custom_logging.sh file) while running eb deploy command on a Windows machine (same as OP). I managed to get over the issue as I ran the exact command on Ubuntu (Windows Subsystem for Linux) and the deploy ended 100% successfully. I don't know what causes the problem on Windows system, but I think it may give some perspective.

SantiagoSC commented 5 years ago

Same issue here. For me, moving the hooks folder files to files section in 01_setup.config solved the problem. It seems like the only official way to provide hooks scripts is via files section in .config

Patskimoto commented 5 years ago

Same issue here. For me, moving the hooks folder files to files section in 01_setup.config solved the problem. It seems like the only official way to provide hooks scripts is via files section in .config

I am experiencing this error as well, however, there are quite a few files in the hooks folders and ideally don't want to move them all but if that's the only solution for this error I may have to.