6
  • I am trying to deploy Java spring boot application in AWS elastic Bean stalk
  • I uploading application code and also jar file in zip format and changed server port for both Code and AWS
  • the application got deployed but showing server health status as degraded
  • Can you let me know how to make API as public
  • can you guys let me know where I have done mistake with your suggestion
  • the application code is available in github and its link: https://github.com/aarivalagan/student-Application/blob/master/StudentCousr.zip
  • I have attached application server screenshot below:
  • providing deployment log file and application.properties file below:


    /var/log/nginx/error.log

    2019/04/01 15:05:39 [error] 3712#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 159.192.220.120, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "18.221.113.190:80"


    /var/log/eb-activity.log

    inflating: /var/app/staging/StudentCousr/target/classes/student/service/StudentServiceImpl.class  
    inflating: /var/app/staging/StudentCousr/target/classes/student/SpringBootApp.class  
     creating: /var/app/staging/StudentCousr/target/generated-sources/
     creating: /var/app/staging/StudentCousr/target/generated-sources/annotations/
     creating: /var/app/staging/StudentCousr/target/maven-archiver/
    inflating: /var/app/staging/StudentCousr/target/maven-archiver/pom.properties  
     creating: /var/app/staging/StudentCousr/target/maven-status/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/
    inflating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst  
    inflating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst  
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/testCompile/
     creating: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/
    

    extracting: /var/app/staging/StudentCousr/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
    inflating: /var/app/staging/StudentCousr/target/StudentCousr-0.0.1-SNAPSHOT.jar
    inflating: /var/app/staging/StudentCousr/target/StudentCousr-0.0.1-SNAPSHOT.jar.original
    creating: /var/app/staging/StudentCousr/target/test-classes/ Executing: HOME=/tmp /opt/elasticbeanstalk/lib/ruby/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/foreman export supervisord --procfile /var/app/staging/Procfile --root /var/app/current --app application --log /var/log/ --user webapp --template /opt/elasticbeanstalk/private/config/foreman/supervisord --env /var/elasticbeanstalk/staging/elasticbeanstalk.env /var/elasticbeanstalk/staging/supervisor [foreman export] writing: application.conf Executing: /opt/elasticbeanstalk/bin/log-conf -n supervisor -l'/var/log/supervisord.log' -t bundlelogs

    Executing: /opt/elasticbeanstalk/bin/log-conf -n containerlistener -l'/var/log/eb-container-listener.log' -t bundlelogs

    [2019-04-01T15:04:11.783Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0/ConfigDeployPreHook/01_configure_xray.sh] : Starting activity... [2019-04-01T15:04:11.889Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0/ConfigDeployPreHook/01_configure_xray.sh] : Completed activity. [2019-04-01T15:04:11.889Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0/ConfigDeployPreHook/03_configure_proxy.sh] : Starting activity... [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0/ConfigDeployPreHook/03_configure_proxy.sh] : Completed activity. Result: Executing: /opt/elasticbeanstalk/bin/log-conf -n nginx -l'/var/log/nginx/*'

    Executing: /usr/sbin/nginx -t -c /var/elasticbeanstalk/staging/nginx/nginx.conf nginx: the configuration file /var/elasticbeanstalk/staging/nginx/nginx.conf syntax is ok nginx: configuration file /var/elasticbeanstalk/staging/nginx/nginx.conf test is successful [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0/ConfigDeployPreHook] : Completed activity. Result: Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/pre. [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage0] : Completed activity. Result: Configuration update - Command CMD-ConfigDeploy stage 0 completed [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1] : Starting activity... [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook] : Starting activity... [2019-04-01T15:04:12.058Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/01_stop_before_promote.sh] : Starting activity... [2019-04-01T15:04:23.684Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/01_stop_before_promote.sh] : Completed activity. Result: Executing: /usr/local/bin/supervisorctl -c /etc/supervisor/supervisord.conf stop application:*

    Process termination taking longer than 10 seconds. Executing: /usr/local/bin/supervisorctl -c /etc/supervisor/supervisord.conf stop all listener:supervisor_listener: stopped Executing: /sbin/status supervisord supervisord start/running, process 3235 Executing: /sbin/stop supervisord supervisord stop/waiting [2019-04-01T15:04:23.684Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/01stop_xray.sh] : Starting activity... [2019-04-01T15:04:23.796Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/01stop_xray.sh] : Completed activity. Result: Executing: if ( initctl status xray | grep start ); then initctl stop xray; fi

    [2019-04-01T15:04:23.796Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/02start_xray.sh] : Starting activity... [2019-04-01T15:04:23.900Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/02start_xray.sh] : Completed activity. [2019-04-01T15:04:23.901Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/03_stop_proxy.sh] : Starting activity... [2019-04-01T15:04:24.114Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/03_stop_proxy.sh] : Completed activity. Result: Executing: service nginx stop Stopping nginx: [ OK ] [2019-04-01T15:04:24.114Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/07_start_application.sh] : Starting activity... [2019-04-01T15:04:24.220Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/07_start_application.sh] : Completed activity. Result: Executing: /sbin/start supervisord supervisord start/running, process 3663 [2019-04-01T15:04:24.220Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/09_start_proxy.sh] : Starting activity... [2019-04-01T15:04:26.803Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/09_start_proxy.sh] : Completed activity. Result: Executing: service nginx stop

    Executing: service nginx start Starting nginx: [ OK ] Executing: /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy nginx

    Executing: /opt/elasticbeanstalk/bin/healthd-configure --appstat-log-path /var/log/nginx/healthd/application.log --appstat-unit sec --appstat-timestamp-on 'completion'

    Executing: /opt/elasticbeanstalk/bin/healthd-restart

    [2019-04-01T15:04:26.803Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/11_stop_after_promote.sh] : Starting activity... [2019-04-01T15:04:27.069Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook/11_stop_after_promote.sh] : Completed activity. [2019-04-01T15:04:27.069Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployEnactHook] : Completed activity. Result: Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/enact. [2019-04-01T15:04:27.069Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployPostHook] : Starting activity... [2019-04-01T15:04:27.069Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1/ConfigDeployPostHook] : Completed activity. Result: Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/post. [2019-04-01T15:04:27.069Z] INFO [3515] - [Configuration update stu1-source@2/ConfigDeployStage1] : Completed activity. Result: Application restart - Command CMD-ConfigDeploy stage 1 completed [2019-04-01T15:04:27.070Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter] : Starting activity... [2019-04-01T15:04:27.070Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter/ConfigLogRotation] : Starting activity... [2019-04-01T15:04:27.070Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity... [2019-04-01T15:04:27.293Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result: Disabled forced hourly log rotation. [2019-04-01T15:04:27.293Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter/ConfigLogRotation] : Completed activity. Result: Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config. [2019-04-01T15:04:27.293Z] INFO [3515] - [Configuration update stu1-source@2/AddonsAfter] : Completed activity. [2019-04-01T15:04:27.294Z] INFO [3515] - [Configuration update stu1-source@2] : Completed activity. Result: Configuration update - Command CMD-ConfigDeploy succeeded [2019-04-01T15:10:10.274Z] INFO [3966] - [CMD-TailLogs] : Starting activity... [2019-04-01T15:10:10.274Z] INFO [3966] - [CMD-TailLogs/AddonsBefore] : Starting activity... [2019-04-01T15:10:10.274Z] INFO [3966] - [CMD-TailLogs/AddonsBefore] : Completed activity. [2019-04-01T15:10:10.274Z] INFO [3966] - [CMD-TailLogs/TailLogs] : Starting activity... [2019-04-01T15:10:10.274Z] INFO [3966] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...


    /var/log/nginx/access.log

    159.192.220.120 - - [01/Apr/2019:15:05:39 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"


    /var/log/eb-commandprocessor.log

    [2019-04-01T15:00:27.850Z] DEBUG [3081] : Setting environment variables.. [2019-04-01T15:00:27.850Z] INFO [3081] : Running AddonsBefore for command CMD-Startup... [2019-04-01T15:00:27.970Z] DEBUG [3081] : Running stages of Command CMD-Startup from stage 0 to stage 1... [2019-04-01T15:00:27.970Z] INFO [3081] : Running stage 0 of command CMD-Startup... [2019-04-01T15:00:27.970Z] INFO [3081] : Running leader election... [2019-04-01T15:00:28.309Z] INFO [3081] : Instance is Leader. [2019-04-01T15:00:28.309Z] DEBUG [3081] : Loaded 7 actions for stage 0. [2019-04-01T15:00:28.309Z] INFO [3081] : Running 1 of 7 actions: HealthdLogRotation... [2019-04-01T15:00:28.314Z] INFO [3081] : Running 2 of 7 actions: HealthdHTTPDLogging... [2019-04-01T15:00:28.315Z] INFO [3081] : Running 3 of 7 actions: HealthdNginxLogging... [2019-04-01T15:00:28.315Z] INFO [3081] : Running 4 of 7 actions: EbExtensionPreBuild... [2019-04-01T15:00:28.677Z] INFO [3081] : Running 5 of 7 actions: AppDeployPreHook... [2019-04-01T15:00:29.409Z] INFO [3081] : Running 6 of 7 actions: EbExtensionPostBuild... [2019-04-01T15:00:29.770Z] INFO [3081] : Running 7 of 7 actions: InfraCleanEbExtension... [2019-04-01T15:00:29.771Z] INFO [3081] : Running stage 1 of command CMD-Startup... [2019-04-01T15:00:29.771Z] DEBUG [3081] : Loaded 3 actions for stage 1. [2019-04-01T15:00:29.771Z] INFO [3081] : Running 1 of 3 actions: AppDeployEnactHook... [2019-04-01T15:00:35.750Z] INFO [3081] : Running 2 of 3 actions: AppDeployPostHook... [2019-04-01T15:00:35.750Z] INFO [3081] : Running 3 of 3 actions: PostInitHook... [2019-04-01T15:00:35.751Z] INFO [3081] : Running AddonsAfter for command CMD-Startup... [2019-04-01T15:00:35.976Z] INFO [3081] : Command CMD-Startup succeeded! [2019-04-01T15:00:35.976Z] INFO [3081] : Command processor returning results: {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]} [2019-04-01T15:04:10.644Z] DEBUG [3515] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties [2019-04-01T15:04:10.645Z] DEBUG [3515] : Checking if the command processor should execute... [2019-04-01T15:04:10.647Z] DEBUG [3515] : Checking whether the command is applicable to instance (i-0b7312e43f679ea2a).. [2019-04-01T15:04:10.647Z] INFO [3515] : Command is applicable to this instance (i-0b7312e43f679ea2a).. [2019-04-01T15:04:10.647Z] DEBUG [3515] : Checking if the received command stage is valid.. [2019-04-01T15:04:10.647Z] INFO [3515] : No stage_num in command. Valid stage.. [2019-04-01T15:04:10.647Z] INFO [3515] : Received command CMD-ConfigDeploy: {"instance_ids"=>["i-0b7312e43f679ea2a"], "command_name"=>"CMD-ConfigDeploy", "api_version"=>"1.0", "resource_name"=>"AWSEBAutoScalingGroup", "request_id"=>"50924321-548f-11e9-a78d-21f933fd79ba"} [2019-04-01T15:04:10.647Z] INFO [3515] : Command processor should execute command. [2019-04-01T15:04:10.647Z] DEBUG [3515] : Storing current stage.. [2019-04-01T15:04:10.647Z] DEBUG [3515] : Stage_num does not exist. Not saving null stage. Returning.. [2019-04-01T15:04:10.647Z] DEBUG [3515] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties [2019-04-01T15:04:10.647Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands.. [2019-04-01T15:04:10.648Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands.. [2019-04-01T15:04:10.648Z] INFO [3515] : Found enabled addons: ["logstreaming", "logpublish"]. [2019-04-01T15:04:10.650Z] INFO [3515] : Updating Command definition of addon logstreaming. [2019-04-01T15:04:10.650Z] INFO [3515] : Updating Command definition of addon logpublish. [2019-04-01T15:04:10.650Z] DEBUG [3515] : Refreshing metadata... [2019-04-01T15:04:11.046Z] DEBUG [3515] : Refreshed environment metadata. [2019-04-01T15:04:11.046Z] INFO [3515] : Recreated directory /opt/elasticbeanstalk/deploy/configuration/. [2019-04-01T15:04:11.046Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_AppSourceUrlFileContent||url.. [2019-04-01T15:04:11.047Z] INFO [3515] : Created appsource url file at /opt/elasticbeanstalk/deploy/configuration/appsourceurl. [2019-04-01T15:04:11.047Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent.. [2019-04-01T15:04:11.048Z] INFO [3515] : Created container config file at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration. [2019-04-01T15:04:11.048Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands.. [2019-04-01T15:04:11.048Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands.. [2019-04-01T15:04:11.049Z] INFO [3515] : Found enabled addons: ["logstreaming", "logpublish"]. [2019-04-01T15:04:11.050Z] INFO [3515] : Updating Command definition of addon logstreaming. [2019-04-01T15:04:11.050Z] INFO [3515] : Updating Command definition of addon logpublish. [2019-04-01T15:04:11.050Z] DEBUG [3515] : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files.. [2019-04-01T15:04:11.051Z] DEBUG [3515] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key.. [2019-04-01T15:04:11.147Z] INFO [3515] : Finding latest manifest from bucket 'elasticbeanstalk-us-east-2-921693171538' with prefix 'resources/environments/e-pzxcd3yivb/runtime/versions/manifest'. [2019-04-01T15:04:11.220Z] INFO [3515] : Found manifest with key 'resources/environments/e-pzxcd3yivb/_runtime/versions/manifest_1554131015858'. [2019-04-01T15:04:11.233Z] INFO [3515] : Updated manifest cache: deployment ID 2 and serial 2. [2019-04-01T15:04:11.233Z] DEBUG [3515] : Loaded definition of Command CMD-ConfigDeploy. [2019-04-01T15:04:11.233Z] INFO [3515] : Executing Configuration update [2019-04-01T15:04:11.234Z] INFO [3515] : Executing command: CMD-ConfigDeploy... [2019-04-01T15:04:11.234Z] INFO [3515] : Executing command CMD-ConfigDeploy activities... [2019-04-01T15:04:11.234Z] DEBUG [3515] : Setting environment variables.. [2019-04-01T15:04:11.234Z] INFO [3515] : Running AddonsBefore for command CMD-ConfigDeploy... [2019-04-01T15:04:11.357Z] DEBUG [3515] : Running stages of Command CMD-ConfigDeploy from stage 0 to stage 1... [2019-04-01T15:04:11.357Z] INFO [3515] : Running stage 0 of command CMD-ConfigDeploy... [2019-04-01T15:04:11.357Z] DEBUG [3515] : Loaded 1 actions for stage 0. [2019-04-01T15:04:11.357Z] INFO [3515] : Running 1 of 1 actions: ConfigDeployPreHook... [2019-04-01T15:04:12.058Z] INFO [3515] : Running stage 1 of command CMD-ConfigDeploy... [2019-04-01T15:04:12.058Z] DEBUG [3515] : Loaded 2 actions for stage 1. [2019-04-01T15:04:12.058Z] INFO [3515] : Running 1 of 2 actions: ConfigDeployEnactHook... [2019-04-01T15:04:27.069Z] INFO [3515] : Running 2 of 2 actions: ConfigDeployPostHook... [2019-04-01T15:04:27.069Z] INFO [3515] : Running AddonsAfter for command CMD-ConfigDeploy... [2019-04-01T15:04:27.293Z] INFO [3515] : Command CMD-ConfigDeploy succeeded! [2019-04-01T15:04:27.294Z] INFO [3515] : Command processor returning results: {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[{"msg":"Process termination taking longer than 10 seconds.","severity":"WARN","timestamp":1554131062}]}]} [2019-04-01T15:10:10.268Z] DEBUG [3966] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties [2019-04-01T15:10:10.269Z] DEBUG [3966] : Checking if the command processor should execute... [2019-04-01T15:10:10.271Z] DEBUG [3966] : Checking whether the command is applicable to instance (i-0b7312e43f679ea2a).. [2019-04-01T15:10:10.271Z] INFO [3966] : Command is applicable to this instance (i-0b7312e43f679ea2a).. [2019-04-01T15:10:10.271Z] DEBUG [3966] : Checking if the received command stage is valid.. [2019-04-01T15:10:10.271Z] INFO [3966] : No stage_num in command. Valid stage.. [2019-04-01T15:10:10.271Z] INFO [3966] : Received command CMD-TailLogs: {"execution_data"=>"*", "instance_ids"=>["i-0b7312e43f679ea2a"], "data"=>"3d28ab37-5490-11e9-a78d-21f933fd79ba", "command_name"=>"CMD-TailLogs", "api_version"=>"1.0", "resource_name"=>"AWSEBAutoScalingGroup", "request_id"=>"3d28ab37-5490-11e9-a78d-21f933fd79ba"} [2019-04-01T15:10:10.271Z] INFO [3966] : Command processor should execute command. [2019-04-01T15:10:10.271Z] DEBUG [3966] : Storing current stage.. [2019-04-01T15:10:10.271Z] DEBUG [3966] : Stage_num does not exist. Not saving null stage. Returning.. [2019-04-01T15:10:10.271Z] DEBUG [3966] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties [2019-04-01T15:10:10.271Z] DEBUG [3966] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands.. [2019-04-01T15:10:10.272Z] DEBUG [3966] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands.. [2019-04-01T15:10:10.272Z] INFO [3966] : Found enabled addons: ["logstreaming", "logpublish"]. [2019-04-01T15:10:10.274Z] INFO [3966] : Updating Command definition of addon logstreaming. [2019-04-01T15:10:10.274Z] INFO [3966] : Updating Command definition of addon logpublish. [2019-04-01T15:10:10.274Z] DEBUG [3966] : Loaded definition of Command CMD-TailLogs. [2019-04-01T15:10:10.274Z] INFO [3966] : Executing CMD-TailLogs [2019-04-01T15:10:10.274Z] INFO [3966] : Executing command: CMD-TailLogs... [2019-04-01T15:10:10.274Z] INFO [3966] : Executing command CMD-TailLogs activities... [2019-04-01T15:10:10.274Z] DEBUG [3966] : Setting environment variables.. [2019-04-01T15:10:10.274Z] INFO [3966] : Running AddonsBefore for command CMD-TailLogs... [2019-04-01T15:10:10.274Z] DEBUG [3966] : Running stages of Command CMD-TailLogs from stage 0 to stage 0... [2019-04-01T15:10:10.274Z] INFO [3966] : Running stage 0 of command CMD-TailLogs... [2019-04-01T15:10:10.274Z] DEBUG [3966] : Loaded 1 actions for stage 0. [2019-04-01T15:10:10.274Z] INFO [3966] : Running 1 of 1 actions: TailLogs...

application.properties file

SERVER_PORT = 5000

enter image description here enter image description here

  • See this page for the official documentation: https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/ – Janac Meena Oct 10 '19 at 18:28

3 Answers3

4

by default, elb uses port 5000 and it's exposed as env variable named PORT, and you need to use it for your application.

SERVER_PORT is an elb param not for spring boot.

put server.port=${PORT} in your application.properties.

or you can define your own port by setting:

server.port=8001

and then do

eb setenv SERVER_PORT=8001

using AWS CLI

stacker
  • 4,317
  • 2
  • 10
  • 24
  • Thanks for your reply....I tried with your method but still facing the same issue...If possible can you able deploy my code in AWS –  Jun 14 '19 at 19:28
4

if your jar file was packaged as executable, edit pom file like this.

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
<!--                <configuration>-->
<!--                    <executable>true</executable>-->
<!--                </configuration>-->
            </plugin>
mylnz
  • 354
  • 1
  • 5
0

NGINX is not able to connect to your application and health check URL is not getting the required response, due to which your environment status is not changing to GREEN.

/var/log/nginx/access.log

159.192.220.120 - - [01/Apr/2019:15:05:39 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"

Check for more logs in

/var/logs/web-1.error.log

you will see something like corrupt/invalid application.jar.

If navigate to /var/app/current directory on your instance you will see two files there

  1. Procfile
  2. application.jar

If you dig more into application.jar using

unzip -lv application.jar

you will find your complete code base there, which shouldn't be. As a result, elastic beanstalk is treating your resultant jar file as a corrupt file. I would recommend you to generate jar file on your local system using mvn, and upload target/StudenCours*.jar file rather than a complete zip bundle to the elastic beanstalk, Also please don't forget to add your main classpath in your manifest file.

matesio
  • 1,584
  • 17
  • 31
  • @matesio...thanks for your reply...can you kindly let me know whether maven installation is mandatory for code deployment –  Jun 21 '19 at 21:30
  • @tamilcool You just need to generate a .jar file on your local system, you can do it with an IDE too (eclipse, IntelliJ Idea) – matesio Jun 22 '19 at 06:33
  • @matesio...thanks for your reply...I downloaded apache-maven-3.6.1 zip file and added to path variable. but when typing command mvn -v, its showing command not found in terminal...can you kindly provide your suggestions –  Jun 23 '19 at 05:31
  • and also tried with steps for generating jar file using maven without pom.xml changes from the stack overflow link https://stackoverflow.com/questions/1082580/how-to-build-jars-from-intellij-properly ..... at the last step its showing failed/unable to access .jar file.....can you kindly let me know which could be preferred for the .jar file generation –  Jun 23 '19 at 05:33
  • @tamilcool You can follow this https://www.mkyong.com/maven/how-to-create-a-jar-file-with-maven/ – matesio Jun 23 '19 at 06:42
  • @matesio...thanks for your reply...I tried with your link for the .jar file generation, the jar file is created but still the server health showing as degraded on deploying on AWS elastic beanstalk...the jar file have uploaded in github and its link is provided as below https://github.com/aarivalagan/aws-maven-jar... can you kindly provide your suggestion for the issue –  Jun 24 '19 at 05:48
  • @tamilcool MANIFEST.MF has the wrong main class reference 'com.StudentCousr' which should be "student.SpringBootApp". Ultimately issue is with your app packaging. – matesio Jun 24 '19 at 09:06
  • thanks for your reply... I tried with the given name for main class reference in MANIFEST.MF but still the server health status showing as degraded...if possible can you provide your suggestions for the same –  Jul 05 '19 at 04:35