Rails应用程序在本地运行,但在Elastic Beanstalk上崩溃

时间:2016-07-13 14:29:35

标签: ruby-on-rails amazon-web-services nginx passenger elastic-beanstalk

我的RoR应用程序在本地测试得很好。在使用rails server以及passenger start进行测试时,所有测试都会通过,并且应用会根据需要在本地运行。

不幸的是,当应用程序部署到AWS EB并委派了一个或多个AWS EC2实例时,实例的运行状况会立即恶化为“降级”。并且自动缩放/负载均衡器功能(如果已激活)尝试使用相同的结果启动更多实例。

访问Beanstalk环境的URL只会导致空白页面(空源代码)。我不知道该怎么做..我已经从下面的错误日志转储中找到了几行我认为可能很有见地但我无法从中获得解决方案:

2016/07/13 01:17:42 [error] 2880#0: *4 "/var/app/current/public/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"
2016/07/13 01:17:42 [error] 2880#0: *4 testing "/var/app/current/public" existence failed (2: No such file or directory) while logging request, client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"

...

/opt/elasticbeanstalk/support/conf/nginx_config_healthd.erb:49:in `get_binding': undefined local variable or method `location_config_filename' for #<PhusionPassenger::Standalone::StartCommand:0x0055afae2de2c8> (NameError)

非常感谢任何帮助!

以下是来自Beanstalk的完整错误日志:

    /var/app/support/logs/production.log
    -------------------------------------
    D, [2016-07-13T01:19:43.479025 #16079] DEBUG -- :   [1m[35m (4.4ms)[0m  [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
    D, [2016-07-13T01:19:43.485867 #16079] DEBUG -- :   [1m[35m (5.5ms)[0m  [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
    D, [2016-07-13T01:19:43.491581 #16079] DEBUG -- :   [1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m  [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
    I, [2016-07-13T01:19:43.493839 #16079]  INFO -- : Migrating to CreateLaunchSubscribers (20160711012123)
    D, [2016-07-13T01:19:43.495026 #16079] DEBUG -- :   [1m[35m (0.0ms)[0m  [1m[36mbegin transaction[0m
    D, [2016-07-13T01:19:43.495994 #16079] DEBUG -- :   [1m[35m (0.2ms)[0m  [1m[35mCREATE TABLE "launch_subscribers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
    D, [2016-07-13T01:19:43.499129 #16079] DEBUG -- :   [1m[35mSQL (0.1ms)[0m  [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m  [["version", "20160711012123"]]
    D, [2016-07-13T01:19:43.509943 #16079] DEBUG -- :   [1m[35m (10.7ms)[0m  [1m[36mcommit transaction[0m
    D, [2016-07-13T01:19:43.511887 #16079] DEBUG -- :   [1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m  [1m[34mSELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m  [["key", :environment], ["LIMIT", 1]]
    D, [2016-07-13T01:19:43.518319 #16079] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[36mbegin transaction[0m
    D, [2016-07-13T01:19:43.519147 #16079] DEBUG -- :   [1m[35mSQL (0.1ms)[0m  [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m  [["key", "environment"], ["value", "production"], ["created_at", 2016-07-13 01:19:43 UTC], ["updated_at", 2016-07-13 01:19:43 UTC]]
    D, [2016-07-13T01:19:43.567003 #16079] DEBUG -- :   [1m[35m (47.7ms)[0m  [1m[36mcommit transaction[0m



    -------------------------------------
    /var/app/support/logs/passenger.log
    -------------------------------------
    [ 2016-07-13 01:17:39.2862 2860/7f0f1ef76780 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'webapp', 'cleanup_pidfiles' => 'L3RtcC9wYXNzZW5nZXItc3RhbmRhbG9uZS5veGQ4amEvdGVtcF9kaXJfdG91Y2hlci5waWQ=', 'default_group' => 'webapp', 'default_python' => 'python', 'default_ruby' => '/opt/rubies/ruby-2.3.1/bin/ruby', 'default_user' => 'webapp', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/tmp/passenger-standalone.oxd8ja/locations.ini', 'passenger_version' => '4.0.60', 'pool_idle_time' => '300', 'prestart_urls' => 'aHR0cDovLzAuMC4wLjA6ODAA', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'false', 'web_server_passenger_version' => '4.0.60', 'web_server_pid' => '2859', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '495', 'web_server_worker_uid' => '497' }
    [ 2016-07-13 01:17:40.3992 2863/7f3cb4136780 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.2859/generation-0/request
    [ 2016-07-13 01:17:40.8989 2871/7f99ca27c840 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.2859/generation-0/logging
    [ 2016-07-13 01:17:40.8991 2860/7f0f1ef76780 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
    2016/07/13 01:17:42 [error] 2880#0: *4 "/var/app/current/public/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"
    2016/07/13 01:17:42 [error] 2880#0: *4 testing "/var/app/current/public" existence failed (2: No such file or directory) while logging request, client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"



    -------------------------------------
    /var/log/eb-activity.log
    -------------------------------------
      memory. However your system only has 995 MB of total virtual memory (995 MB
      RAM, 0 MB swap). It is recommended that you temporarily add more swap space
      before proceeding. You can do it as follows:

        sudo dd if=/dev/zero of=/swap bs=1M count=1024
        sudo mkswap /swap
        sudo swapon /swap

      See also https://wiki.archlinux.org/index.php/Swap for more information about
      the swap file on Linux.

      If you cannot activate a swap file (e.g. because you're on OpenVZ, or if you
      don't have root privileges) then you should install Phusion Passenger through
      DEB/RPM packages. For more information, please refer to our installation
      documentation:

        https://www.phusionpassenger.com/library/install/standalone/

      Press Ctrl-C to abort this installer (recommended).
      Press Enter if you want to continue with installation anyway.
      Checking for required software...

       [1m* Checking for C compiler...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/bin/cc
       [1m* Checking for C++ compiler...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/bin/c++
       [1m* Checking for GNU make...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/bin/gmake
       [1m* Checking for Rake (associated with /opt/rubies/ruby-2.3.1/bin/ruby)...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /opt/rubies/ruby-2.3.1/bin/ruby /opt/rubies/ruby-2.3.1/bin/rake
       [1m* Checking for OpenSSL development headers...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/include/openssl/ssl.h
       [1m* Checking for Zlib development headers...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/include/zlib.h
       [1m* Checking for PCRE development headers...[0m[37m[40m
            Found: [1m[32myes[0m[37m[40m
            Location: /usr/include/pcre.h

      Installing...
      Downloading Nginx 1.8.1 source code...
      Extracting tarball...
      Compiling support libraries (step 1 of 2)...
      ......................................................................................................................................................................................................................................................................................................................................
      Compiling Nginx engine (step 2 of 2)...
      ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
      Compilation finished!

      --------------------------

       [passenger_native_support.so] trying to compile for the current user (root) and Ruby interpreter...
           (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
           Compilation successful. The logs are here:
           /tmp/passenger_native_support-1qzggon.log
       [passenger_native_support.so] successfully loaded.
      /opt/elasticbeanstalk/support/conf/nginx_config_healthd.erb:49:in `get_binding': undefined local variable or method `location_config_filename' for #<PhusionPassenger::Standalone::StartCommand:0x0055afae2de2c8> (NameError)
        from /opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/erb.rb:864:in `eval'
        from /opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/erb.rb:864:in `result'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:177:in `block in write_nginx_config_file'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:170:in `open'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:170:in `write_nginx_config_file'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb:41:in `start_engine_real'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:322:in `start_engine'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:63:in `run'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/src/ruby_supportlib/phusion_passenger/standalone/main.rb:51:in `run!'
        from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.0.29/bin/passenger:45:in `<top (required)>'
        from /opt/rubies/ruby-2.3.1/bin/passenger:23:in `load'
        from /opt/rubies/ruby-2.3.1/bin/passenger:23:in `<main>'
    [2016-07-13T01:21:12.939Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/AppDeployEnactHook] : Completed activity. Result:
      Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
    [2016-07-13T01:21:12.939Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/AppDeployPostHook] : Starting activity...
    [2016-07-13T01:21:12.939Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/AppDeployPostHook/01_create_pids.sh] : Starting activity...
    [2016-07-13T01:21:43.111Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/AppDeployPostHook/01_create_pids.sh] : Completed activity.
    [2016-07-13T01:21:43.111Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/AppDeployPostHook] : Completed activity. Result:
      Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/PostInitHook] : Starting activity...
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1/PostInitHook] : Completed activity. Result:
      Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/postinit.
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/StartupStage1] : Completed activity. Result:
      Application deployment - Command CMD-Startup stage 1 completed
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter] : Starting activity...
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter/ConfigLogRotation] : Starting activity...
    [2016-07-13T01:21:43.112Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
    [2016-07-13T01:21:43.233Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
      Disabled forced hourly log rotation.
    [2016-07-13T01:21:43.233Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
      Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
    [2016-07-13T01:21:43.233Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1/AddonsAfter] : Completed activity.
    [2016-07-13T01:21:43.233Z] INFO  [2975]  - [Application deployment app-7e88-160712_211417@1] : Completed activity. Result:
      Application deployment - Command CMD-Startup succeeded
    [2016-07-13T01:23:36.190Z] INFO  [19057] - [CMD-TailLogs] : Starting activity...
    [2016-07-13T01:23:36.190Z] INFO  [19057] - [CMD-TailLogs/AddonsBefore] : Starting activity...
    [2016-07-13T01:23:36.190Z] INFO  [19057] - [CMD-TailLogs/AddonsBefore] : Completed activity.
    [2016-07-13T01:23:36.190Z] INFO  [19057] - [CMD-TailLogs/TailLogs] : Starting activity...
    [2016-07-13T01:23:36.190Z] INFO  [19057] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...



    -------------------------------------
    /var/app/support/logs/access.log
    -------------------------------------
    127.0.0.1 - - [13/Jul/2016:01:17:42 +0000] "HEAD / HTTP/1.1" 404 0 "-" "-"



    -------------------------------------
    /var/log/eb-commandprocessor.log
    -------------------------------------
    [2016-07-13T01:17:01.594Z] DEBUG [2632]  : Refreshing metadata...
    [2016-07-13T01:17:01.597Z] DEBUG [2632]  : Using cached environment metadata.
    [2016-07-13T01:17:01.597Z] DEBUG [2632]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
    [2016-07-13T01:17:01.598Z] DEBUG [2632]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
    [2016-07-13T01:17:01.598Z] INFO  [2632]  : Found enabled addons: ["logpublish"].
    [2016-07-13T01:17:01.598Z] INFO  [2632]  : Updating Command definition of addon logpublish.
    [2016-07-13T01:17:01.599Z] DEBUG [2632]  : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
    [2016-07-13T01:17:01.601Z] DEBUG [2632]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
    [2016-07-13T01:17:02.199Z] INFO  [2632]  : Finding latest manifest from bucket 'elasticbeanstalk-us-west-2-615201702363' with prefix 'resources/environments/e-n35dn7ryje/_runtime/versions/manifest_'.
    [2016-07-13T01:17:02.732Z] INFO  [2632]  : Found manifest with key 'resources/environments/e-n35dn7ryje/_runtime/versions/manifest_1468372471196'.
    [2016-07-13T01:17:02.794Z] INFO  [2632]  : Updated manifest cache: deployment ID 1 and serial 1.
    [2016-07-13T01:17:02.794Z] DEBUG [2632]  : Loaded definition of Command CMD-PreInit.
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Executing Initialization
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Executing command: CMD-PreInit...
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Executing command CMD-PreInit activities...
    [2016-07-13T01:17:02.795Z] DEBUG [2632]  : Setting environment variables..
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Running AddonsBefore for command CMD-PreInit...
    [2016-07-13T01:17:02.795Z] DEBUG [2632]  : Running stages of Command CMD-PreInit from stage 0 to stage 0...
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Running stage 0 of command CMD-PreInit...
    [2016-07-13T01:17:02.795Z] DEBUG [2632]  : Loaded 3 actions for stage 0.
    [2016-07-13T01:17:02.795Z] INFO  [2632]  : Running 1 of 3 actions: InfraWriteConfig...
    [2016-07-13T01:17:02.797Z] INFO  [2632]  : Running 2 of 3 actions: DownloadSourceBundle...
    [2016-07-13T01:17:03.175Z] INFO  [2632]  : Running 3 of 3 actions: PreInitHook...
    [2016-07-13T01:17:41.091Z] INFO  [2632]  : Running AddonsAfter for command CMD-PreInit...
    [2016-07-13T01:17:41.091Z] INFO  [2632]  : Command CMD-PreInit succeeded!
    [2016-07-13T01:17:41.091Z] INFO  [2632]  : Command processor returning results: 
    {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
    [2016-07-13T01:17:57.387Z] DEBUG [2975]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
    [2016-07-13T01:17:57.387Z] DEBUG [2975]  : Checking if the command processor should execute...
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Checking whether the command is applicable to instance (i-07977d6c52f370f9d)..
    [2016-07-13T01:17:57.390Z] INFO  [2975]  : Command is applicable to this instance (i-07977d6c52f370f9d)..
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Checking if the received command stage is valid..
    [2016-07-13T01:17:57.390Z] INFO  [2975]  : No stage_num in command. Valid stage..
    [2016-07-13T01:17:57.390Z] INFO  [2975]  : Received command CMD-Startup: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-07977d6c52f370f9d"],"command_name":"CMD-Startup","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"2237ea1b-4897-11e6-8db9-ad2a7159939a","command_timeout":"600"}
    [2016-07-13T01:17:57.390Z] INFO  [2975]  : Command processor should execute command.
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Storing current stage..
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Stage_num does not exist. Not saving null stage. Returning..
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
    [2016-07-13T01:17:57.390Z] DEBUG [2975]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
    [2016-07-13T01:17:57.391Z] INFO  [2975]  : Found enabled addons: ["logpublish"].
    [2016-07-13T01:17:57.392Z] INFO  [2975]  : Updating Command definition of addon logpublish.
    [2016-07-13T01:17:57.392Z] DEBUG [2975]  : Refreshing metadata...
    [2016-07-13T01:17:57.640Z] DEBUG [2975]  : Refreshed environment metadata.
    [2016-07-13T01:17:57.640Z] DEBUG [2975]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
    [2016-07-13T01:17:57.641Z] DEBUG [2975]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
    [2016-07-13T01:17:57.641Z] INFO  [2975]  : Found enabled addons: ["logpublish"].
    [2016-07-13T01:17:57.642Z] INFO  [2975]  : Updating Command definition of addon logpublish.
    [2016-07-13T01:17:57.642Z] DEBUG [2975]  : Loaded definition of Command CMD-Startup.
    [2016-07-13T01:17:57.642Z] INFO  [2975]  : Executing Application deployment
    [2016-07-13T01:17:57.643Z] INFO  [2975]  : Executing command: CMD-Startup...
    [2016-07-13T01:17:57.643Z] INFO  [2975]  : Executing command CMD-Startup activities...
    [2016-07-13T01:17:57.643Z] DEBUG [2975]  : Setting environment variables..
    [2016-07-13T01:17:57.643Z] INFO  [2975]  : Running AddonsBefore for command CMD-Startup...
    [2016-07-13T01:17:57.643Z] DEBUG [2975]  : Running stages of Command CMD-Startup from stage 0 to stage 1...
    [2016-07-13T01:17:57.643Z] INFO  [2975]  : Running stage 0 of command CMD-Startup...
    [2016-07-13T01:17:57.643Z] INFO  [2975]  : Running leader election...
    [2016-07-13T01:17:57.887Z] INFO  [2975]  : Instance is Leader.
    [2016-07-13T01:17:57.887Z] DEBUG [2975]  : Loaded 7 actions for stage 0.
    [2016-07-13T01:17:57.887Z] INFO  [2975]  : Running 1 of 7 actions: HealthdLogRotation...
    [2016-07-13T01:17:57.892Z] INFO  [2975]  : Running 2 of 7 actions: HealthdHTTPDLogging...
    [2016-07-13T01:17:57.892Z] INFO  [2975]  : Running 3 of 7 actions: HealthdNginxLogging...
    [2016-07-13T01:17:57.892Z] INFO  [2975]  : Running 4 of 7 actions: EbExtensionPreBuild...
    [2016-07-13T01:17:58.164Z] INFO  [2975]  : Running 5 of 7 actions: AppDeployPreHook...
    [2016-07-13T01:19:43.583Z] INFO  [2975]  : Running 6 of 7 actions: EbExtensionPostBuild...
    [2016-07-13T01:19:43.856Z] INFO  [2975]  : Running 7 of 7 actions: InfraCleanEbExtension...
    [2016-07-13T01:19:43.860Z] INFO  [2975]  : Running stage 1 of command CMD-Startup...
    [2016-07-13T01:19:43.860Z] DEBUG [2975]  : Loaded 3 actions for stage 1.
    [2016-07-13T01:19:43.860Z] INFO  [2975]  : Running 1 of 3 actions: AppDeployEnactHook...
    [2016-07-13T01:21:12.939Z] INFO  [2975]  : Running 2 of 3 actions: AppDeployPostHook...
    [2016-07-13T01:21:43.111Z] INFO  [2975]  : Running 3 of 3 actions: PostInitHook...
    [2016-07-13T01:21:43.112Z] INFO  [2975]  : Running AddonsAfter for command CMD-Startup...
    [2016-07-13T01:21:43.233Z] INFO  [2975]  : Command CMD-Startup succeeded!
    [2016-07-13T01:21:43.233Z] INFO  [2975]  : Command processor returning results: 
    {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
    [2016-07-13T01:23:36.184Z] DEBUG [19057] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
    [2016-07-13T01:23:36.184Z] DEBUG [19057] : Checking if the command processor should execute...
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Checking whether the command is applicable to instance (i-07977d6c52f370f9d)..
    [2016-07-13T01:23:36.187Z] INFO  [19057] : Command is applicable to this instance (i-07977d6c52f370f9d)..
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Checking if the received command stage is valid..
    [2016-07-13T01:23:36.187Z] INFO  [19057] : No stage_num in command. Valid stage..
    [2016-07-13T01:23:36.187Z] INFO  [19057] : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAJVMOQJRPGLVNY52Q\",\"signature\":\"TTpp6MvoQzmJMyFtEvAHzKJt0I0=\",\"security_token\":\"FQoDYXdzEFMaDJS2KY9kvCnSjUKYdiKtA5HQ2JgqmYPHhSwQof5rs1Zh+a3kNYs3SWbtHBaFWWxqgI67bgJe3+zRr+yI3YoMsTVkqU6Bw+sOiZvXHHaGK7lTDiIDh2rMV8V+UVpFuF0MBt3EJA6oe34fpW6uuqmqwUOl1O644ZJ7InhFFR7dmjAcdO10YQCCX4YF9j6sNDsv6YJpnrlqye9\\\/mwNOvQjXgHGJP5T4gjvPTpCjdQhscYvN9tV8xzPD8BSl\\\/xXHVOlRmUzeow5oGeEhmuiX3JbNM7BDFGYpOIG\\\/hgv44RpkM4aid4\\\/bTjSiZ9yYh+O8YN7QmKZ1MpJGQsy3OiroUutjEzJnuKUWJam9Xsl4ND80OKi9HWxaFd2O\\\/gNWCxg4j3+1cCFGSrQfL5c4lveDcH8JLakxeIcT2rsRUj3PBgp4fLu+YK7X9ThhXzzDNs4KLtV1feWYw1PWJsZ0OudXRYmrAerCtd3ojU0jcD47VcB0vt83EN+5dUHY0s4FCwodDo0C6e3F6tCCy5DS8rLa9g3yTZMTRQFxWIPRSSnrUUNqu3pUS\\\/vffWXSds0J+t5oAwXp6uSg4A2FTG8rEg1qfiic4JO8BQ==\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNy0xM1QwMTo1MzozNC4yNTRaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItNjE1MjAxNzAyMzYzIl0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-07977d6c52f370f9d"],"data":"6a7bb5b4-4898-11e6-a3c3-37a522e81ab8","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"6a7bb5b4-4898-11e6-a3c3-37a522e81ab8","command_timeout":"600"}
    [2016-07-13T01:23:36.187Z] INFO  [19057] : Command processor should execute command.
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Storing current stage..
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Stage_num does not exist. Not saving null stage. Returning..
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
    [2016-07-13T01:23:36.187Z] DEBUG [19057] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
    [2016-07-13T01:23:36.188Z] DEBUG [19057] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
    [2016-07-13T01:23:36.188Z] INFO  [19057] : Found enabled addons: ["logpublish"].
    [2016-07-13T01:23:36.189Z] INFO  [19057] : Updating Command definition of addon logpublish.
    [2016-07-13T01:23:36.189Z] DEBUG [19057] : Loaded definition of Command CMD-TailLogs.
    [2016-07-13T01:23:36.189Z] INFO  [19057] : Executing CMD-TailLogs
    [2016-07-13T01:23:36.190Z] INFO  [19057] : Executing command: CMD-TailLogs...
    [2016-07-13T01:23:36.190Z] INFO  [19057] : Executing command CMD-TailLogs activities...
    [2016-07-13T01:23:36.190Z] DEBUG [19057] : Setting environment variables..
    [2016-07-13T01:23:36.190Z] INFO  [19057] : Running AddonsBefore for command CMD-TailLogs...
    [2016-07-13T01:23:36.190Z] DEBUG [19057] : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
    [2016-07-13T01:23:36.190Z] INFO  [19057] : Running stage 0 of command CMD-TailLogs...
    [2016-07-13T01:23:36.190Z] DEBUG [19057] : Loaded 1 actions for stage 0.
    [2016-07-13T01:23:36.190Z] INFO  [19057] : Running 1 of 1 actions: TailLogs...

1 个答案:

答案 0 :(得分:0)

所以我最终解决了我的问题。我的应用现在运行!这是我做的:

  • 修改了我的Beanstalk环境的配置以使用t2.small实例类型(具有2GB RAM的实例)
  • 将.Gem文件中包含的Phusion Passenger版本设置为旧版本(我将其设置为$sql = $mysqli->query($q); if($sql === false){ //there was an error die('SQL error: '$mysqli->error); } 虽然我认为我可以使用更新的版本...但我还没有测试过关于EB的更新版本)

以上项目是根据我的问题评论中的建议完成的。在遇到另一条错误消息后,我做了以下操作,表明在生产中找不到gem "passenger", '~> 4.0.59'

  • 使用Figaro gem(没有特定版本)在application.yml中设置secret_key_base变量
  • 添加了一个.ebignore文件,忽略了与我的.gitignore相同的所有文件,EXECPT for application.yml,因为EB需要这个来读取ENV["SECRET_KEY_BASE"]变量(我的.gitignore忽略了这个application.yml文件,因为你不希望存储在公共视图中的API密钥,哈希值等秘密)

感谢所有评论。我希望这些信息可以帮助其他人!