Dockerrun.aws.json: No such file or directory - amazon-web-services

many developers.
This is my first question and I can't solve this.
I'm using AWS For to deploy out webapp and projects.
and now I just want to deploy so tiny project.
(like just basic django project)
I already test this in local(with "python manage.py runserver").
and build & run dockerfile.
But Deploying is failed with AWS continually.
I write Dockerfile and I use it.
But AWS says to me
"cat: /var/app/current/Dockerrun.aws.json: No such file or directory"
and I don't understand what it says.
This is my code in DockerFile
FROM {{mydockerId}}/myproject:base
COPY . /srv/FestivalMusicList
# static directory setting
RUN cp -f /srv/FestivalMusicList/.config/nginx.conf /etc/nginx/nginx.conf &&\
cp -f /srv/FestivalMusicList/.config/nginx-app.conf /etc/nginx/sites-available/ &&\
rm -f /etc/nginx/site-enabled/* &&\
ln -sf /etc/nginx/sites-available/nginx-app.conf /etc/nginx/sites-enabled/
RUN cp /srv/FestivalMusicList/.config/supervisord.conf /etc/supervisor/conf.d/
RUN mkdir /var/log/celery
EXPOSE 80
This is error
[2019-04-05T15:05:33.308Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list/Command 04_setdata_genre] : Starting activity...
[2019-04-05T15:05:33.310Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list/Command 04_setdata_genre] : Completed activity.
[2019-04-05T15:05:33.310Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_festival_music_list] : Completed activity.
[2019-04-05T15:05:33.310Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2019-04-05T15:05:33.328Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/EbExtensionPostBuild] : Completed activity.
[2019-04-05T15:05:33.328Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/InfraCleanEbExtension] : Starting activity...
[2019-04-05T15:05:33.329Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0/InfraCleanEbExtension] : Completed activity. Result:
Cleaned ebextensions subdirectories from /tmp.
[2019-04-05T15:05:33.329Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage0] : Completed activity. Result:
Application deployment - Command CMD-Startup stage 0 completed
[2019-04-05T15:05:33.329Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage1] : Starting activity...
[2019-04-05T15:05:33.329Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage1/AppDeployEnactHook] : Starting activity...
[2019-04-05T15:05:33.331Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage1/AppDeployEnactHook/00run.sh] : Starting activity...
[2019-04-05T15:05:39.636Z] INFO [3747] - [Application deployment app-cdf1-190406_000132#1/StartupStage1/AppDeployEnactHook/00run.sh] : Activity execution failed, because: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
cat: /var/app/current/Dockerrun.aws.json: No such file or directory
01a93e5ed8e11b0c76133e5e446764a8ec95ddd1db144be5d3fceca9fd6c0813
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Fri Apr 5 15:05:39 UTC 2019:. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError)
caused by: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
cat: /var/app/current/Dockerrun.aws.json: No such file or directory
01a93e5ed8e11b0c76133e5e446764a8ec95ddd1db144be5d3fceca9fd6c0813
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Fri Apr 5 15:05:39 UTC 2019:. Check snapshot logs for details. (Executor::NonZeroExitStatus

Are you using Elastic Beanstalk? If so, you need the Dockerrun.aws.json at your root directory.
An example of its contents:
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "janedoe/image",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "1234"
}
],
"Volumes": [
{
"HostDirectory": "/var/app/mydb",
"ContainerDirectory": "/etc/mysql"
}
],
"Logging": "/var/log/nginx",
"Entrypoint": "/app/bin/myapp",
"Command": "--argument"
}
For more information: Official Doc's

Related

why can't amazon codebuild execute: docker-compose --file=docker-compose-prod.yml build?

I am new to AWS.
I am trying to deploy a multi-container docker application with with CI/CD using CodePipeline and AWS ECR. I am using following this example: https://aws.plainenglish.io/deploy-multi-container-docker-to-elastic-beanstalk-with-ci-cd-using-codepipeline-and-aws-ecr-d1d5be0aaa20
CodeBuild is executing this command:
docker-compose --file=docker-compose-prod.yml build from the buildspec.yml
build:
commands:
# Test Build (Dockerfile.dev)
#- echo Build started on `date`
#- echo Building Docker test image...
#- docker build -t $IMAGE_REPO_NAME:$TEST_IMAGE_TAG -f Dockerfile.dev .
#- docker run -e CI=true $IMAGE_REPO_NAME:$TEST_IMAGE_TAG npm run test
- echo Build started on `date`
- echo Building the Docker image...
- docker-compose --file=docker-compose-prod.yml build
the error message is:
[Container] 2022/11/12 18:09:44 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker-compose --file=docker-compose-prod.yml build. Reason: exit status 1
here is the docker-compose-prod.yml
version: '3'
services:
api:
build:
context: ./api
container_name: api
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/app-api
ports:
- "3000:3000"
ui:
build:
context: ./ui
container_name: ui
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/app-ui
ports:
- "4200:4200"
nginx:
build:
context: ./nginx
container_name: nginx
depends_on:
- ui
- api
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/app-nginx
ports:
- "80:80"
here is my private registies
why can't amazon execute this command?
also here is Dockerrun.aws.json:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "ui",
"image": "my_accnt_id.dkr.ecr.us-east-1.amazonaws.com/app-ui",
"hostname": "ui",
"essential": true,
"memory": 1024,
"portMappings": [
{
"hostPort": 4200,
"containerPort": 4200
}
]
},
{
"name": "api",
"image": "my_accnt_id.dkr.ecr.us-east-1.amazonaws.com/app-api",
"hostname": "api",
"essential": true,
"memory": 512,
"portMappings": [
{
"hostPort": 3000,
"containerPort": 3000
}
]
},
{
"name": "nginx",
"image": "my_accnt_id.dkr.ecr.us-east-1.amazonaws.com/app-nginx",
"hostname": "nginx",
"essential": true,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": ["ui", "api"],
"memory": 512
}
]
}
my my_accnt_id is where i actually have my account id.
CloudWatch error msg:
2022-11-12T17:37:27.435+00:00
Copy
[Container] 2022/11/12 17:37:25 Running command docker-compose --file=docker-compose-prod.yml push
[Container] 2022/11/12 17:37:25 Running command docker-compose --file=docker-compose-prod.yml push
2022-11-12T17:37:27.435+00:00
Copy
Pushing api (280757731345.dkr.ecr.us-east-1.amazonaws.com/app-api:latest)...
Pushing api (280757731345.dkr.ecr.us-east-1.amazonaws.com/app-api:latest)...
2022-11-12T17:37:27.435+00:00
Copy
The push refers to repository [280757731345.dkr.ecr.us-east-1.amazonaws.com/app-api]
The push refers to repository [280757731345.dkr.ecr.us-east-1.amazonaws.com/app-api]
2022-11-12T17:38:18.717+00:00
Copy
EOF
EOF
2022-11-12T17:38:18.717+00:00
Copy
2022-11-12T17:38:18.717+00:00
Copy
[Container] 2022/11/12 17:38:16 Command did not exit successfully docker-compose --file=docker-compose-prod.yml push exit status 1
[Container] 2022/11/12 17:38:16 Command did not exit successfully docker-compose --file=docker-compose-prod.yml push exit status 1
2022-11-12T17:38:18.717+00:00 [Container] 2022/11/12 17:38:16 Phase complete: POST_BUILD State: FAILED
2022-11-12T17:38:18.717+00:00
Copy
[Container] 2022/11/12 17:38:16 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker-compose --file=docker-compose-prod.yml push. Reason: exit status 1
[Container] 2022/11/12 17:38:16 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker-compose --file=docker-compose-prod.yml push. Reason: exit status 1
I don't know why its failing to push.

Unable to create Tomcat configuration file with `files` tag in .ebextensions

I'm learning how to use ebextensions to customize files on the EC2 instances created by Elastic Beanstalk.
So I downloaded the Tomcat java-tomcat-v3.zip sample application at this page and modified its .ebextensions/logging.config file.
Below is my logging.config:
files:
"/opt/elasticbeanstalk/tasks/bundlelogs.d/01-sample-app.conf":
content: |
/tmp/sample-app*
"/opt/elasticbeanstalk/tasks/taillogs.d/01-sample-app.conf":
content: |
/tmp/sample-app.log
"/usr/share/tomcat8/conf/Catalina/localhost/rewrite.config":
mode: "000644"
owner: root
group: tomcat
content: |
RewriteRule ^/API(.*) https://%{HTTP_HOST}$1 [NC,L]
"/tmp/test.txt":
mode: "000644"
owner: root
group: tomcat
content: |
hello there
The file /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config is not created after I deploy the zip file to my Elastic Beanstalk environment.
All the other 3 files are correctly created.
What's wrong with my configuration?
There are some messages about rewrite.config file in /var/log/eb-activit.log:
[2019-01-04T03:26:32.983Z] INFO [6912] - [Application update java-tomcat-v3-9#13/AppDeployStage1/AppDeployEnactHook/02clean.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir
+ EB_APP_DEPLOY_DIR=/var/lib/tomcat8/webapps/ROOT
++ /opt/elasticbeanstalk/bin/get-config container -k tomcat_version
+ TOMCAT_VERSION=8.5
+ '[' 8.5 == 8.5 ']'
+ TOMCAT_VERSION=8
+ TOMCAT_NAME=tomcat8
+ mkdir -p /var/lib/tomcat8/webapps/ROOT
++ readlink -f /var/lib/tomcat8/webapps/ROOT/..
+ EB_APP_DEPLOY_BASE_DIR=/var/lib/tomcat8/webapps
+ rm -rf /var/lib/tomcat8/webapps/ROOT
+ rm -rf /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config
+ rm -rf /usr/share/tomcat8/work/Catalina/localhost
+ mkdir -p /var/lib/tomcat8/webapps/ROOT
[2019-01-04T03:26:32.983Z] INFO [6912] - [Application update java-tomcat-v3-9#13/AppDeployStage1/AppDeployEnactHook/02start_xray.sh] : Starting activity...
I don't understand why elastic beanstalk executed rm -rf /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config command during deployment.
Is there any command that deletes /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config after the file is created?
The following is the full content of /var/log/eb-activity.log:
[2019-01-04T05:20:41.410Z] INFO [11976] - [Application update java-tomcat-v3-11#15] : Starting activity...
[2019-01-04T05:20:41.411Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore] : Starting activity...
[2019-01-04T05:20:41.411Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore/ConfigCWLAgent] : Starting activity...
[2019-01-04T05:20:41.411Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore/ConfigCWLAgent/10-config.sh] : Starting activity...
[2019-01-04T05:20:41.533Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore/ConfigCWLAgent/10-config.sh] : Completed activity. Result:
Log streaming option setting is not specified, ignore cloudwatch logs setup.
Disabled log streaming.
[2019-01-04T05:20:41.533Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore/ConfigCWLAgent] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logstreaming/hooks/config.
[2019-01-04T05:20:41.533Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsBefore] : Completed activity.
[2019-01-04T05:20:41.921Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0] : Starting activity...
[2019-01-04T05:20:41.921Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/DownloadSourceBundle] : Starting activity...
[2019-01-04T05:20:42.440Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/DownloadSourceBundle] : Completed activity. Result:
[2019-01-04T05:20:42.024Z] INFO [12019] : Application version will be saved to /opt/elasticbeanstalk/deploy/appsource.
[2019-01-04T05:20:42.024Z] INFO [12019] : Using manifest cache with deployment ID 15 and serial 15.
[2019-01-04T05:20:42.024Z] INFO [12019] : Attempting to download application source bundle to: '/opt/elasticbeanstalk/deploy/appsource/source_bundle'.
[2019-01-04T05:20:42.024Z] INFO [12019] : Using computed s3 key.
[2019-01-04T05:20:42.142Z] INFO [12019] : Downloading from bucket 'elasticbeanstalk-region-n-xxxxxxxxx' with key 'resources/environments/e-ipdsfn2umb/_runtime/_versions/BrianTest/java-tomcat-v3-11' and version '' to '/opt/elasticbeanstalk/deploy/appsource/source_bundle'.
[2019-01-04T05:20:42.226Z] INFO [12019] : Size: 6511344, ETag: "025d9af7b40ad70f45caed145adfce0f", Metadata: {"environmentid"=>"e-ipdsfn2umb", "requestid"=>"5d54090a-0fe0-11e9-9bda-6373967d51b5"}.
[2019-01-04T05:20:42.431Z] INFO [12019] : Downloaded size: 6511344.
[2019-01-04T05:20:42.431Z] INFO [12019] : Successfully downloaded to '/opt/elasticbeanstalk/deploy/appsource/source_bundle'.
[2019-01-04T05:20:42.441Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild] : Starting activity...
[2019-01-04T05:20:42.836Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Starting activity...
[2019-01-04T05:20:42.840Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_0_BrianTest] : Starting activity...
[2019-01-04T05:20:42.840Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_0_BrianTest] : Completed activity.
[2019-01-04T05:20:42.845Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_BrianTest] : Starting activity...
[2019-01-04T05:20:42.845Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_BrianTest] : Completed activity.
[2019-01-04T05:20:42.845Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Completed activity.
[2019-01-04T05:20:42.863Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPreBuild] : Completed activity.
[2019-01-04T05:20:42.863Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook] : Starting activity...
[2019-01-04T05:20:42.864Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/01_configure_xray.sh] : Starting activity...
[2019-01-04T05:20:43.030Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/01_configure_xray.sh] : Completed activity. Result:
D, [2019-01-04T05:20:42.968092 #12033] DEBUG -- : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
D, [2019-01-04T05:20:42.968243 #12033] DEBUG -- : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
Executing: /opt/elasticbeanstalk/bin/log-conf -n awsxray -l'/var/log/xray/xray.log' -t publishlogs
[2019-01-04T05:20:43.030Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/01clean.sh] : Starting activity...
[2019-01-04T05:20:43.127Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/01clean.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/tmp/deployment/application/ROOT
+ rm -rf /tmp/deployment/application/ROOT
+ mkdir -p /tmp/deployment/application/ROOT
[2019-01-04T05:20:43.128Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/02unzip.sh] : Starting activity...
[2019-01-04T05:20:43.384Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/02unzip.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/tmp/deployment/application/ROOT
++ /opt/elasticbeanstalk/bin/get-config container -k source_bundle
+ EB_SOURCE_BUNDLE=/opt/elasticbeanstalk/deploy/appsource/source_bundle
+ /usr/bin/unzip -o -d /tmp/deployment/application/ROOT /opt/elasticbeanstalk/deploy/appsource/source_bundle
Archive: /opt/elasticbeanstalk/deploy/appsource/source_bundle
creating: /tmp/deployment/application/ROOT/META-INF/
extracting: /tmp/deployment/application/ROOT/META-INF/MANIFEST.MF
creating: /tmp/deployment/application/ROOT/WEB-INF/
creating: /tmp/deployment/application/ROOT/WEB-INF/classes/
creating: /tmp/deployment/application/ROOT/WEB-INF/classes/org/
creating: /tmp/deployment/application/ROOT/WEB-INF/classes/org/example/
inflating: /tmp/deployment/application/ROOT/WEB-INF/classes/org/example/AWSXRayServletContext.class
inflating: /tmp/deployment/application/ROOT/WEB-INF/classes/org/example/AWSXRayServlet.class
inflating: /tmp/deployment/application/ROOT/WEB-INF/classes/org/example/ConditionalAWSXRayServletFilter.class
creating: /tmp/deployment/application/ROOT/WEB-INF/classes/META-INF/
extracting: /tmp/deployment/application/ROOT/WEB-INF/classes/META-INF/MANIFEST.MF
inflating: /tmp/deployment/application/ROOT/WEB-INF/classes/META-INF/NOTICE.txt
inflating: /tmp/deployment/application/ROOT/WEB-INF/classes/META-INF/LICENSE.txt
creating: /tmp/deployment/application/ROOT/WEB-INF/lib/
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-logging-1.1.3.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/ion-java-1.0.1.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/jackson-databind-2.6.6.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/jackson-core-2.6.6.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/httpclient-4.5.2.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/aws-java-sdk-s3-1.11.67.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-codec-1.9.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-validator-1.5.1.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/jmespath-java-1.0.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/jackson-dataformat-cbor-2.6.6.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-collections-3.2.2.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/joda-time-2.8.1.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/httpcore-4.4.4.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/jackson-annotations-2.6.0.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/aws-xray-recorder-sdk-aws-sdk-1.0.5-beta.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-beanutils-1.9.2.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/aws-java-sdk-core-1.11.67.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/aws-xray-recorder-sdk-core-1.0.5-beta.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/aws-java-sdk-kms-1.11.67.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/lib/commons-digester-1.8.1.jar
inflating: /tmp/deployment/application/ROOT/WEB-INF/web.xml
inflating: /tmp/deployment/application/ROOT/cron.yaml
inflating: /tmp/deployment/application/ROOT/index.jsp
inflating: /tmp/deployment/application/ROOT/scheduled.jsp
creating: /tmp/deployment/application/ROOT/src/
inflating: /tmp/deployment/application/ROOT/src/AWSXRayServlet.java
inflating: /tmp/deployment/application/ROOT/src/ConditionalAWSXRayServletFilter.java
inflating: /tmp/deployment/application/ROOT/src/AWSXRayServletContext.java
creating: /tmp/deployment/application/ROOT/.ebextensions/
inflating: /tmp/deployment/application/ROOT/.ebextensions/xray.config
inflating: /tmp/deployment/application/ROOT/.ebextensions/logging.config
++ wc -l
++ find /tmp/deployment/application/ROOT -maxdepth 1 -type f
+ FILE_COUNT=3
++ wc -l
++ ls /tmp/deployment/application/ROOT --almost-all
+ ITEM_COUNT=7
+ [[ 3 == 0 ]]
[2019-01-04T05:20:43.384Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/03_configure_proxy.sh] : Starting activity...
[2019-01-04T05:20:44.069Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/03_configure_proxy.sh] : Completed activity. Result:
Executing: /bin/chown root:apache /var/run/httpd
Executing: /bin/chmod 755 /var/run/httpd
Executing: /bin/chown apache:apache /var/log/httpd
Executing: /bin/chmod 755 /var/log/httpd
Executing: /opt/elasticbeanstalk/bin/log-conf -n httpd -l'/var/log/httpd/*'
Executing: /usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf
Syntax OK
[2019-01-04T05:20:44.069Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/03config_clean.sh] : Starting activity...
[2019-01-04T05:20:44.168Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/03config_clean.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k config_staging_dir
+ EB_CONFIG_STAGING_DIR=/tmp/deployment/config
+ rm -rf /tmp/deployment/config
+ mkdir -p /tmp/deployment/config
[2019-01-04T05:20:44.168Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/04config_generate.sh] : Starting activity...
[2019-01-04T05:20:44.483Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook/04config_generate.sh] : Completed activity. Result:
+ /opt/elasticbeanstalk/containerfiles/generate_config
[2019-01-04T05:20:44.483Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2019-01-04T05:20:44.483Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2019-01-04T05:20:44.880Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2019-01-04T05:20:44.880Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2019-01-04T05:20:44.895Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/EbExtensionPostBuild] : Completed activity.
[2019-01-04T05:20:44.895Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/InfraCleanEbextension] : Starting activity...
[2019-01-04T05:20:44.896Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0/InfraCleanEbextension] : Completed activity. Result:
Cleaned ebextensions subdirectories from /tmp/deployment/application/ROOT.
[2019-01-04T05:20:44.896Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage0] : Completed activity. Result:
Application update - Command CMD-AppDeploy stage 0 completed
[2019-01-04T05:20:44.897Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1] : Starting activity...
[2019-01-04T05:20:44.897Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook] : Starting activity...
[2019-01-04T05:20:44.897Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/01stop.sh] : Starting activity...
[2019-01-04T05:20:46.432Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/01stop.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k tomcat_version
+ TOMCAT_VERSION=8.5
+ '[' 8.5 == 8.5 ']'
+ TOMCAT_VERSION=8
+ TOMCAT_NAME=tomcat8
+ /etc/init.d/tomcat8 status
tomcat8 (pid 8226) is running...[ OK ]
+ /usr/bin/monit unmonitor tomcat
+ /etc/init.d/tomcat8 stop
Stopping tomcat8: [ OK ]
[2019-01-04T05:20:46.432Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/01stop_xray.sh] : Starting activity...
[2019-01-04T05:20:48.548Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/01stop_xray.sh] : Completed activity. Result:
Executing: if ( initctl status xray | grep start ); then initctl stop xray; fi
xray start/running, process 8071
xray stop/waiting
[2019-01-04T05:20:48.549Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/02clean.sh] : Starting activity...
[2019-01-04T05:20:48.742Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/02clean.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir
+ EB_APP_DEPLOY_DIR=/var/lib/tomcat8/webapps/ROOT
++ /opt/elasticbeanstalk/bin/get-config container -k tomcat_version
+ TOMCAT_VERSION=8.5
+ '[' 8.5 == 8.5 ']'
+ TOMCAT_VERSION=8
+ TOMCAT_NAME=tomcat8
+ mkdir -p /var/lib/tomcat8/webapps/ROOT
++ readlink -f /var/lib/tomcat8/webapps/ROOT/..
+ EB_APP_DEPLOY_BASE_DIR=/var/lib/tomcat8/webapps
+ rm -rf /var/lib/tomcat8/webapps/ROOT
+ rm -rf /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config
+ rm -rf /usr/share/tomcat8/work/Catalina/localhost
+ mkdir -p /var/lib/tomcat8/webapps/ROOT
[2019-01-04T05:20:48.742Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/02start_xray.sh] : Starting activity...
[2019-01-04T05:20:48.855Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/02start_xray.sh] : Completed activity. Result:
Executing: initctl start xray
xray start/running, process 12243
[2019-01-04T05:20:48.855Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/03_stop_proxy.sh] : Starting activity...
[2019-01-04T05:20:49.447Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/03_stop_proxy.sh] : Completed activity. Result:
Executing: service nginx stop
Executing: service httpd stop
Stopping httpd: [ OK ]
[2019-01-04T05:20:49.447Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/03deploy.sh] : Starting activity...
[2019-01-04T05:20:49.644Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/03deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/tmp/deployment/application/ROOT
++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir
+ EB_APP_DEPLOY_DIR=/var/lib/tomcat8/webapps/ROOT
++ wc -l
++ find /tmp/deployment/application/ROOT -maxdepth 1 -type f -not -path '*/\.*'
+ FILE_COUNT=3
++ grep -Pi '\.war$'
++ find /tmp/deployment/application/ROOT -maxdepth 1 -type f
++ echo ''
+ WAR_FILES=
+ WAR_FILE_COUNT=0
+ [[ 0 > 0 ]]
++ readlink -f /var/lib/tomcat8/webapps/ROOT/../
+ EB_APP_DEPLOY_BASE=/var/lib/tomcat8/webapps
+ rm -rf /var/lib/tomcat8/webapps/ROOT
+ [[ 3 == 0 ]]
+ cp -R /tmp/deployment/application/ROOT /var/lib/tomcat8/webapps/ROOT
+ chown -R tomcat:tomcat /var/lib/tomcat8/webapps
[2019-01-04T05:20:49.644Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/04config_deploy.sh] : Starting activity...
[2019-01-04T05:20:49.921Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/04config_deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k config_staging_dir
+ EB_CONFIG_STAGING_DIR=/tmp/deployment/config
++ /opt/elasticbeanstalk/bin/get-config container -k config_deploy_dir
+ EB_CONFIG_DEPLOY_DIR=/etc/sysconfig
++ /opt/elasticbeanstalk/bin/get-config container -k config_filename
+ EB_CONFIG_FILENAME=tomcat8
+ cp /tmp/deployment/config/tomcat8 /etc/sysconfig/tomcat8
[2019-01-04T05:20:49.922Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/05start.sh] : Starting activity...
[2019-01-04T05:20:50.082Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/05start.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k tomcat_version
+ TOMCAT_VERSION=8.5
+ '[' 8.5 == 8.5 ']'
+ TOMCAT_VERSION=8
+ TOMCAT_NAME=tomcat8
+ /etc/init.d/tomcat8 status
tomcat8 is stopped
[ OK ]
+ /etc/init.d/tomcat8 start
Starting tomcat8: [ OK ]
+ /usr/bin/monit monitor tomcat
[2019-01-04T05:20:50.082Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/09_start_proxy.sh] : Starting activity...
[2019-01-04T05:20:53.246Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook/09_start_proxy.sh] : Completed activity. Result:
Executing: service httpd stop
Stopping httpd: [FAILED]
Executing: service httpd start
Starting httpd: [ OK ]
Executing: /bin/chmod 755 /var/run/httpd
Executing: /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
Executing: /opt/elasticbeanstalk/bin/healthd-configure --appstat-log-path /var/log/httpd/healthd/application.log --appstat-unit usec --appstat-timestamp-on 'arrival'
Executing: /opt/elasticbeanstalk/bin/healthd-restart
[2019-01-04T05:20:53.246Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2019-01-04T05:20:53.246Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployPostHook] : Starting activity...
[2019-01-04T05:20:53.246Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployPostHook/03monitor_pids.sh] : Starting activity...
[2019-01-04T05:20:53.929Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployPostHook/03monitor_pids.sh] : Completed activity.
[2019-01-04T05:20:53.930Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1/AppDeployPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
[2019-01-04T05:20:53.930Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AppDeployStage1] : Completed activity. Result:
Application version switch - Command CMD-AppDeploy stage 1 completed
[2019-01-04T05:20:53.930Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter] : Starting activity...
[2019-01-04T05:20:53.930Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter/ConfigLogRotation] : Starting activity...
[2019-01-04T05:20:53.930Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2019-01-04T05:20:54.287Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
[2019-01-04T05:20:54.287Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2019-01-04T05:20:54.287Z] INFO [11976] - [Application update java-tomcat-v3-11#15/AddonsAfter] : Completed activity.
[2019-01-04T05:20:54.287Z] INFO [11976] - [Application update java-tomcat-v3-11#15] : Completed activity. Result:
Application update - Command CMD-AppDeploy succeeded
I've found that there's a command rm -rf /usr/share/$TOMCAT_NAME/conf/Catalina/localhost/* sitting inside /opt/elasticbeanstalk/hooks/appdeploy/enact/02clean.sh.
Probably this is the reason that I can't create a file under /usr/share/tomcat8/conf/Catalina/localhost/.
My ultimate goal is to use Tomcat rewrite valve. I think I have to look for another solution.
I created the /tmp/rewrite.config file with files.
Then, using postdeploy hook I created a script to copy it to the /etc/tomcat/Catalina/localhost/ folder
This is the path to the hook /src/main/platform/hooks/postdeploy/01_add_rewrite_config.sh

Deploying war file in Amazon Elastic Beanstalk

I have a war file of my application which works fine when executed from the command line in local. I´m uploading it to Amazon´s Elastic Beanstalk using Tomcat but when I try to access the URL I receive a 404 error.
The problem is something related to my war file or I have to change Amazon´s configuration?
Many thanks.
Logs:
-------------------------------------
/var/log/httpd/elasticbeanstalk-access_log
-------------------------------------
88.26.90.37 (88.26.90.37) - - [23/Jul/2017:18:55:23 +0000] "GET / HTTP/1.1" 404 1004 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Sun Jul 23 18:54:15 2017] [notice] Apache/2.2.32 (Unix) configured -- resuming normal operations
[Sun Jul 23 18:55:23 2017] [error] server is within MinSpareThreads of MaxClients, consider raising the MaxClients setting
-------------------------------------
/var/log/tomcat8/host-manager.2017-07-23.log
-------------------------------------
-------------------------------------
/var/log/httpd/access_log
-------------------------------------
88.26.90.37 - - [23/Jul/2017:18:55:23 +0000] "GET / HTTP/1.1" 404 1004 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
-------------------------------------
/var/log/tomcat8/tomcat8-initd.log
-------------------------------------
-------------------------------------
/var/log/tomcat8/localhost_access_log.txt
-------------------------------------
127.0.0.1 - - [23/Jul/2017:18:55:24 +0000] "GET / HTTP/1.1" 404 1004
-------------------------------------
/var/log/tomcat8/manager.2017-07-23.log
-------------------------------------
-------------------------------------
/var/log/eb-activity.log
-------------------------------------
+ EB_APP_DEPLOY_BASE_DIR=/var/lib/tomcat8/webapps
+ rm -rf /var/lib/tomcat8/webapps/ROOT
+ rm -rf '/usr/share/tomcat8/conf/Catalina/localhost/*'
+ rm -rf '/usr/share/tomcat8/work/Catalina/*'
+ mkdir -p /var/lib/tomcat8/webapps/ROOT
[2017-07-23T18:54:13.069Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/02start_xray.sh] : Starting activity...
[2017-07-23T18:54:13.290Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/02start_xray.sh] : Completed activity.
[2017-07-23T18:54:13.291Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/03_stop_proxy.sh] : Starting activity...
[2017-07-23T18:54:13.629Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/03_stop_proxy.sh] : Completed activity. Result:
Executing: service nginx stop
Executing: service httpd stop
Stopping httpd: [FAILED]
[2017-07-23T18:54:13.629Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/03deploy.sh] : Starting activity...
[2017-07-23T18:54:14.089Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/03deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/tmp/deployment/application/ROOT
++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir
+ EB_APP_DEPLOY_DIR=/var/lib/tomcat8/webapps/ROOT
++ wc -l
++ find /tmp/deployment/application/ROOT -maxdepth 1 -type f
+ FILE_COUNT=0
++ grep -Pi '\.war$'
++ find /tmp/deployment/application/ROOT -maxdepth 1 -type f
++ echo ''
+ WAR_FILES=
+ WAR_FILE_COUNT=0
+ [[ 0 > 0 ]]
++ readlink -f /var/lib/tomcat8/webapps/ROOT/../
+ EB_APP_DEPLOY_BASE=/var/lib/tomcat8/webapps
+ rm -rf /var/lib/tomcat8/webapps/ROOT
+ [[ 0 == 0 ]]
+ [[ 0 > 1 ]]
+ cp -R /tmp/deployment/application/ROOT /var/lib/tomcat8/webapps/ROOT
+ chown -R tomcat:tomcat /var/lib/tomcat8/webapps
[2017-07-23T18:54:14.089Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/04config_deploy.sh] : Starting activity...
[2017-07-23T18:54:14.652Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/04config_deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k config_staging_dir
+ EB_CONFIG_STAGING_DIR=/tmp/deployment/config
++ /opt/elasticbeanstalk/bin/get-config container -k config_deploy_dir
+ EB_CONFIG_DEPLOY_DIR=/etc/sysconfig
++ /opt/elasticbeanstalk/bin/get-config container -k config_filename
+ EB_CONFIG_FILENAME=tomcat8
+ cp /tmp/deployment/config/tomcat8 /etc/sysconfig/tomcat8
[2017-07-23T18:54:14.653Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/05start.sh] : Starting activity...
[2017-07-23T18:54:15.081Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/05start.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k tomcat_version
+ TOMCAT_VERSION=8
+ TOMCAT_NAME=tomcat8
+ /etc/init.d/tomcat8 status
tomcat8 is stopped
[ OK ]
+ /etc/init.d/tomcat8 start
Starting tomcat8: [ OK ]
+ /usr/bin/monit monitor tomcat
monit: generated unique Monit id ae33689ef3cf376bf23fa3b09041524e and stored to '/root/.monit.id'
[2017-07-23T18:54:15.082Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/09_start_proxy.sh] : Starting activity...
[2017-07-23T18:54:19.022Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook/09_start_proxy.sh] : Completed activity. Result:
Executing: service httpd stop
Stopping httpd: [FAILED]
Executing: service httpd start
Starting httpd: [ OK ]
Executing: /bin/chmod 755 /var/run/httpd
Executing: /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
Executing: /opt/elasticbeanstalk/bin/healthd-configure --appstat-log-path /var/log/httpd/healthd/application.log --appstat-unit usec --appstat-timestamp-on 'arrival'
Executing: /opt/elasticbeanstalk/bin/healthd-restart
[2017-07-23T18:54:19.022Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2017-07-23T18:54:19.022Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployPostHook] : Starting activity...
[2017-07-23T18:54:19.023Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployPostHook/03monitor_pids.sh] : Starting activity...
[2017-07-23T18:54:20.047Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployPostHook/03monitor_pids.sh] : Completed activity.
[2017-07-23T18:54:20.047Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/AppDeployPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
[2017-07-23T18:54:20.047Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/PostInitHook] : Starting activity...
[2017-07-23T18:54:20.048Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/PostInitHook/01processmgrstart.sh] : Starting activity...
[2017-07-23T18:54:20.097Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/PostInitHook/01processmgrstart.sh] : Completed activity. Result:
+ /usr/bin/monit
[2017-07-23T18:54:20.097Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1/PostInitHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/postinit.
[2017-07-23T18:54:20.097Z] INFO [2048] - [Application deployment OnFocus2307#1/StartupStage1] : Completed activity. Result:
Application deployment - Command CMD-Startup stage 1 completed
[2017-07-23T18:54:20.098Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter] : Starting activity...
[2017-07-23T18:54:20.098Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter/ConfigLogRotation] : Starting activity...
[2017-07-23T18:54:20.098Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2017-07-23T18:54:20.509Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
[2017-07-23T18:54:20.510Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2017-07-23T18:54:20.510Z] INFO [2048] - [Application deployment OnFocus2307#1/AddonsAfter] : Completed activity.
[2017-07-23T18:54:20.510Z] INFO [2048] - [Application deployment OnFocus2307#1] : Completed activity. Result:
Application deployment - Command CMD-Startup succeeded
[2017-07-23T18:55:36.363Z] INFO [2808] - [CMD-TailLogs] : Starting activity...
[2017-07-23T18:55:36.363Z] INFO [2808] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2017-07-23T18:55:36.364Z] INFO [2808] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2017-07-23T18:55:36.364Z] INFO [2808] - [CMD-TailLogs/TailLogs] : Starting activity...
[2017-07-23T18:55:36.364Z] INFO [2808] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
-------------------------------------
/var/log/tomcat8/catalina.2017-07-23.log
-------------------------------------
23-Jul-2017 18:54:17.868 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.44
23-Jul-2017 18:54:17.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jul 5 2017 19:02:51 UTC
23-Jul-2017 18:54:17.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.44.0
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.9.32-15.41.amzn1.x86_64
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_131-b11
23-Jul-2017 18:54:17.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
23-Jul-2017 18:54:17.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/share/tomcat8
23-Jul-2017 18:54:17.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/share/tomcat8
23-Jul-2017 18:54:17.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DJDBC_CONNECTION_STRING=
23-Jul-2017 18:54:17.890 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms256m
23-Jul-2017 18:54:17.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
23-Jul-2017 18:54:17.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=64m
23-Jul-2017 18:54:17.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/share/tomcat8
23-Jul-2017 18:54:17.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/share/tomcat8
23-Jul-2017 18:54:17.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
23-Jul-2017 18:54:17.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=
23-Jul-2017 18:54:17.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/var/cache/tomcat8/temp
23-Jul-2017 18:54:17.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/share/tomcat8/conf/logging.properties
23-Jul-2017 18:54:17.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
23-Jul-2017 18:54:17.897 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
23-Jul-2017 18:54:18.284 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
23-Jul-2017 18:54:18.352 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-Jul-2017 18:54:18.371 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
23-Jul-2017 18:54:18.374 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-Jul-2017 18:54:18.377 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2288 ms
23-Jul-2017 18:54:18.477 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
23-Jul-2017 18:54:18.479 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.44
23-Jul-2017 18:54:18.512 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/ROOT
23-Jul-2017 18:54:27.482 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
23-Jul-2017 18:54:27.680 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 9,162 ms
23-Jul-2017 18:54:27.691 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
23-Jul-2017 18:54:27.724 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
23-Jul-2017 18:54:27.747 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 9369 ms
-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
[2017-07-23T18:52:59.225Z] INFO [1780] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-07-23T18:52:59.227Z] INFO [1780] : Updating Command definition of addon logpublish.
[2017-07-23T18:52:59.227Z] INFO [1780] : Updating Command definition of addon logstreaming.
[2017-07-23T18:52:59.227Z] DEBUG [1780] : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
[2017-07-23T18:52:59.232Z] DEBUG [1780] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2017-07-23T18:52:59.515Z] INFO [1780] : Finding latest manifest from bucket 'elasticbeanstalk-us-west-2-253743328849' with prefix 'resources/environments/e-mrdyfipmbp/_runtime/versions/manifest_'.
[2017-07-23T18:52:59.801Z] INFO [1780] : Found manifest with key 'resources/environments/e-mrdyfipmbp/_runtime/versions/manifest_1500835914428'.
[2017-07-23T18:52:59.818Z] INFO [1780] : Updated manifest cache: deployment ID 1 and serial 1.
[2017-07-23T18:52:59.818Z] DEBUG [1780] : Loaded definition of Command CMD-PreInit.
[2017-07-23T18:52:59.818Z] INFO [1780] : Executing Initialization
[2017-07-23T18:52:59.819Z] INFO [1780] : Executing command: CMD-PreInit...
[2017-07-23T18:52:59.819Z] INFO [1780] : Executing command CMD-PreInit activities...
[2017-07-23T18:52:59.819Z] DEBUG [1780] : Setting environment variables..
[2017-07-23T18:52:59.819Z] INFO [1780] : Running AddonsBefore for command CMD-PreInit...
[2017-07-23T18:53:04.333Z] DEBUG [1780] : Running stages of Command CMD-PreInit from stage 0 to stage 0...
[2017-07-23T18:53:04.333Z] INFO [1780] : Running stage 0 of command CMD-PreInit...
[2017-07-23T18:53:04.333Z] DEBUG [1780] : Loaded 3 actions for stage 0.
[2017-07-23T18:53:04.333Z] INFO [1780] : Running 1 of 3 actions: InfraWriteConfig...
[2017-07-23T18:53:04.345Z] INFO [1780] : Running 2 of 3 actions: DownloadSourceBundle...
[2017-07-23T18:53:05.730Z] INFO [1780] : Running 3 of 3 actions: PreInitHook...
[2017-07-23T18:53:07.650Z] INFO [1780] : Running AddonsAfter for command CMD-PreInit...
[2017-07-23T18:53:07.650Z] INFO [1780] : Command CMD-PreInit succeeded!
[2017-07-23T18:53:07.651Z] INFO [1780] : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2017-07-23T18:54:05.518Z] DEBUG [2048] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-07-23T18:54:05.518Z] DEBUG [2048] : Checking if the command processor should execute...
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Checking whether the command is applicable to instance (i-04e322b065f1ab8d7)..
[2017-07-23T18:54:05.520Z] INFO [2048] : Command is applicable to this instance (i-04e322b065f1ab8d7)..
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Checking if the received command stage is valid..
[2017-07-23T18:54:05.520Z] INFO [2048] : No stage_num in command. Valid stage..
[2017-07-23T18:54:05.520Z] INFO [2048] : Received command CMD-Startup: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-04e322b065f1ab8d7"],"command_name":"CMD-Startup","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"fb2b25c7-6fd7-11e7-87da-0d1616730116"}
[2017-07-23T18:54:05.520Z] INFO [2048] : Command processor should execute command.
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Storing current stage..
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Stage_num does not exist. Not saving null stage. Returning..
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-07-23T18:54:05.520Z] DEBUG [2048] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-07-23T18:54:05.521Z] DEBUG [2048] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-07-23T18:54:05.522Z] INFO [2048] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-07-23T18:54:05.524Z] INFO [2048] : Updating Command definition of addon logpublish.
[2017-07-23T18:54:05.525Z] INFO [2048] : Updating Command definition of addon logstreaming.
[2017-07-23T18:54:05.525Z] DEBUG [2048] : Refreshing metadata...
[2017-07-23T18:54:05.954Z] DEBUG [2048] : Refreshed environment metadata.
[2017-07-23T18:54:05.954Z] DEBUG [2048] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-07-23T18:54:05.956Z] DEBUG [2048] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-07-23T18:54:05.957Z] INFO [2048] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-07-23T18:54:05.961Z] INFO [2048] : Updating Command definition of addon logpublish.
[2017-07-23T18:54:05.961Z] INFO [2048] : Updating Command definition of addon logstreaming.
[2017-07-23T18:54:05.962Z] DEBUG [2048] : Loaded definition of Command CMD-Startup.
[2017-07-23T18:54:05.963Z] INFO [2048] : Executing Application deployment
[2017-07-23T18:54:05.964Z] INFO [2048] : Executing command: CMD-Startup...
[2017-07-23T18:54:05.964Z] INFO [2048] : Executing command CMD-Startup activities...
[2017-07-23T18:54:05.964Z] DEBUG [2048] : Setting environment variables..
[2017-07-23T18:54:05.964Z] INFO [2048] : Running AddonsBefore for command CMD-Startup...
[2017-07-23T18:54:06.242Z] DEBUG [2048] : Running stages of Command CMD-Startup from stage 0 to stage 1...
[2017-07-23T18:54:06.242Z] INFO [2048] : Running stage 0 of command CMD-Startup...
[2017-07-23T18:54:06.242Z] INFO [2048] : Running leader election...
[2017-07-23T18:54:06.665Z] INFO [2048] : Instance is Leader.
[2017-07-23T18:54:06.666Z] DEBUG [2048] : Loaded 7 actions for stage 0.
[2017-07-23T18:54:06.666Z] INFO [2048] : Running 1 of 7 actions: HealthdLogRotation...
[2017-07-23T18:54:06.678Z] INFO [2048] : Running 2 of 7 actions: HealthdHTTPDLogging...
[2017-07-23T18:54:06.680Z] INFO [2048] : Running 3 of 7 actions: HealthdNginxLogging...
[2017-07-23T18:54:06.681Z] INFO [2048] : Running 4 of 7 actions: EbExtensionPreBuild...
[2017-07-23T18:54:07.163Z] INFO [2048] : Running 5 of 7 actions: AppDeployPreHook...
[2017-07-23T18:54:09.688Z] INFO [2048] : Running 6 of 7 actions: EbExtensionPostBuild...
[2017-07-23T18:54:10.176Z] INFO [2048] : Running 7 of 7 actions: InfraCleanEbExtension...
[2017-07-23T18:54:10.181Z] INFO [2048] : Running stage 1 of command CMD-Startup...
[2017-07-23T18:54:10.181Z] DEBUG [2048] : Loaded 3 actions for stage 1.
[2017-07-23T18:54:10.181Z] INFO [2048] : Running 1 of 3 actions: AppDeployEnactHook...
[2017-07-23T18:54:19.022Z] INFO [2048] : Running 2 of 3 actions: AppDeployPostHook...
[2017-07-23T18:54:20.047Z] INFO [2048] : Running 3 of 3 actions: PostInitHook...
[2017-07-23T18:54:20.097Z] INFO [2048] : Running AddonsAfter for command CMD-Startup...
[2017-07-23T18:54:20.510Z] INFO [2048] : Command CMD-Startup succeeded!
[2017-07-23T18:54:20.511Z] INFO [2048] : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2017-07-23T18:55:36.353Z] DEBUG [2808] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-07-23T18:55:36.354Z] DEBUG [2808] : Checking if the command processor should execute...
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Checking whether the command is applicable to instance (i-04e322b065f1ab8d7)..
[2017-07-23T18:55:36.356Z] INFO [2808] : Command is applicable to this instance (i-04e322b065f1ab8d7)..
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Checking if the received command stage is valid..
[2017-07-23T18:55:36.356Z] INFO [2808] : No stage_num in command. Valid stage..
[2017-07-23T18:55:36.356Z] INFO [2808] : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAJSUYLCIZFOIKPO2A\",\"signature\":\"RPf86lrs\\\/c0114+EODhe8jxRJhs=\",\"security_token\":\"FQoDYXdzENz\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/wEaDCSrox2Xx3QiuRUnziLcAxEo3H8dpDcz3tKFZriPXlqq595Xpcm6LsBYoPAwWWcm7bDE38KE8kwDhnSMHttNJl1yNd5kofzZ9J5pf9gRSQdXGHWXghfw8+Bt3IVKutzn7tni2NaXFMlZxSxOpkvVxRYUph9et1kFsDlX2ml2ONCPDGqGYFBatI1mMPbvdTVViz7YbMiGDx88kQQF9W9wghJ63FkxG0JGscE1ugXc840xjzTmSIT7bNPmlkaLI4iBLor9Whn4a1fiDuZq2EB8lDxKMd+hjWmMSbMYjPvdGusVbuvLu1KC8mvFMx29BVLoo+xvxMc2JzO03\\\/WVo50oWnM8nSG04UtfkNGapLnbVO1NWoMWD107qHSeyWqAi1HO83KmxW4E5gvtF5IGNd98yJkcSmwDv0BNJDZnP8DTZNP+AHrCW\\\/mC6ybEjNxkh\\\/La\\\/YpPmfWAcbOG61IKqIyZHrhGO65nvYRxsz5TJ9B5sbGvDmhlGEJ1thAP\\\/xcaTOAUn006DxGlO+aVrz6ie9uU6Mt4wNos4qdftSce5mszp4Gc3gYOpfzqq4lIpnB2GUY9ImVMclLI60VtaOMkzMNsNJTRtl1X1NuiUa7sefP8Rsod\\\/yeev3ueDLJsfhJozF\\\/w4MtijFfP547w1KfxKOeb08sF\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNy0wNy0yM1QxOToyNTozNC41ODNaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItMjUzNzQzMzI4ODQ5Il0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-04e322b065f1ab8d7"],"data":"822325d4-6fd8-11e7-8e3e-c7d19f2d4234","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"822325d4-6fd8-11e7-8e3e-c7d19f2d4234"}
[2017-07-23T18:55:36.356Z] INFO [2808] : Command processor should execute command.
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Storing current stage..
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Stage_num does not exist. Not saving null stage. Returning..
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-07-23T18:55:36.356Z] DEBUG [2808] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-07-23T18:55:36.358Z] DEBUG [2808] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-07-23T18:55:36.359Z] INFO [2808] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-07-23T18:55:36.362Z] INFO [2808] : Updating Command definition of addon logpublish.
[2017-07-23T18:55:36.362Z] INFO [2808] : Updating Command definition of addon logstreaming.
[2017-07-23T18:55:36.362Z] DEBUG [2808] : Loaded definition of Command CMD-TailLogs.
[2017-07-23T18:55:36.362Z] INFO [2808] : Executing CMD-TailLogs
[2017-07-23T18:55:36.363Z] INFO [2808] : Executing command: CMD-TailLogs...
[2017-07-23T18:55:36.363Z] INFO [2808] : Executing command CMD-TailLogs activities...
[2017-07-23T18:55:36.363Z] DEBUG [2808] : Setting environment variables..
[2017-07-23T18:55:36.363Z] INFO [2808] : Running AddonsBefore for command CMD-TailLogs...
[2017-07-23T18:55:36.364Z] DEBUG [2808] : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2017-07-23T18:55:36.364Z] INFO [2808] : Running stage 0 of command CMD-TailLogs...
[2017-07-23T18:55:36.364Z] DEBUG [2808] : Loaded 1 actions for stage 0.
[2017-07-23T18:55:36.364Z] INFO [2808] : Running 1 of 1 actions: TailLogs...
-------------------------------------
/var/log/httpd/elasticbeanstalk-error_log
-------------------------------------
-------------------------------------
/var/log/tomcat8/localhost.2017-07-23.log
-------------------------------------
23-Jul-2017 18:54:27.562 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JerseyWebApplicationInitializer#161183dc]
-------------------------------------
/var/log/tomcat8/catalina.out
-------------------------------------
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=64m; support was removed in 8.0
23-Jul-2017 18:54:17.868 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.44
23-Jul-2017 18:54:17.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jul 5 2017 19:02:51 UTC
23-Jul-2017 18:54:17.886 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.44.0
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.9.32-15.41.amzn1.x86_64
23-Jul-2017 18:54:17.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
Check your logs for the reason: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html
Perhaps you are missing a JDBC driver? ;D

Can't run node.js example project on AWS

I was trying run this example on the aws website for node.js http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/samples/nodejs-express-hiking-v1.zip
from here
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/nodejs-getstarted.html
(I tired the tutorial that had the same error)
502 Bad Gateway
nginx/1.10.1
Is what is shown.
I also tried changing the port to 5000 but that did not help either.
Here are the logs:
I think the second one is the problem but I have no idea what to do about it.
/var/log/nodejs/nodejs.log
Server running at http://127.0.0.1:8081/
/var/log/nginx/error.log
2017/02/20 04:10:25 [warn] 2488#0: duplicate MIME type "text/html" in /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf:42
/var/log/eb-activity.log
Did not find to find status of init job. Assuming stopped.
Did not find to find status of init job. Assuming stopped.
[2017-02-20T04:10:21.090Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/20clean.sh] : Starting activity...
[2017-02-20T04:10:21.285Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/20clean.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_base_dir
+ EB_APP_BASE_DIR=/var/app
+ rm -rf /var/app
[2017-02-20T04:10:21.286Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/30app_deploy.sh] : Starting activity...
[2017-02-20T04:10:22.003Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/30app_deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k app_base_dir
+ EB_APP_BASE_DIR=/var/app
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/tmp/deployment/application
++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir
+ EB_APP_DEPLOY_DIR=/var/app/current
++ /opt/elasticbeanstalk/bin/get-config container -k app_user
+ EB_APP_USER=nodejs
+ mkdir /var/app
+ mv /tmp/deployment/application /var/app/current
+ chown -R nodejs:nodejs /var/app/current
[2017-02-20T04:10:22.003Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/40config_deploy.sh] : Starting activity...
[2017-02-20T04:10:22.230Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/40config_deploy.sh] : Completed activity. Result:
++ /opt/elasticbeanstalk/bin/get-config container -k config_staging_dir
+ EB_CONFIG_STAGING_DIR=/tmp/deployment/config
++ ls /tmp/deployment/config
+ for i in '$(ls $EB_CONFIG_STAGING_DIR)'
++ sed -e 's/#/\//g'
++ echo '#etc#init#nginx.conf'
+ FILE_NAME=/etc/init/nginx.conf
+ /bin/cp /tmp/deployment/config/#etc#init#nginx.conf /etc/init/nginx.conf
+ for i in '$(ls $EB_CONFIG_STAGING_DIR)'
++ sed -e 's/#/\//g'
++ echo '#etc#init#nodejs.conf'
+ FILE_NAME=/etc/init/nodejs.conf
+ /bin/cp /tmp/deployment/config/#etc#init#nodejs.conf /etc/init/nodejs.conf
+ for i in '$(ls $EB_CONFIG_STAGING_DIR)'
++ sed -e 's/#/\//g'
++ echo '#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf'
+ FILE_NAME=/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
+ /bin/cp /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
+ for i in '$(ls $EB_CONFIG_STAGING_DIR)'
++ sed -e 's/#/\//g'
++ echo '#etc#nginx#nginx.conf'
+ FILE_NAME=/etc/nginx/nginx.conf
+ /bin/cp /tmp/deployment/config/#etc#nginx#nginx.conf /etc/nginx/nginx.conf
[2017-02-20T04:10:22.230Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/50start.sh] : Starting activity...
[2017-02-20T04:10:25.232Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/50start.sh] : Completed activity. Result:
+ /opt/elasticbeanstalk/containerfiles/ebnode.py --action start-all
nodejs start/running, process 2473
nginx start/running, process 2488
[2017-02-20T04:10:25.232Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/60monitor_pids.sh] : Starting activity...
[2017-02-20T04:10:25.794Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/60monitor_pids.sh] : Completed activity. Result:
+ '[' -d /etc/healthd ']'
++ /opt/elasticbeanstalk/bin/get-config optionsettings --namespace aws:elasticbeanstalk:container:nodejs --option-name ProxyServer
+ PROXY_SERVER=nginx
+ case "$PROXY_SERVER" in
+ /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy nginx
+ /opt/elasticbeanstalk/bin/healthd-track-pidfile --name application --location /var/run/nodejs.pid
[2017-02-20T04:10:25.794Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/70restart_healthd.sh] : Starting activity...
[2017-02-20T04:10:25.988Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook/70restart_healthd.sh] : Completed activity. Result:
+ '[' -d /etc/healthd ']'
++ /opt/elasticbeanstalk/bin/get-config optionsettings --namespace aws:elasticbeanstalk:container:nodejs --option-name ProxyServer
+ PROXY_SERVER=nginx
+ '[' -f /var/elasticbeanstalk/healthd/current_proxy_server ']'
+ CURRENT_PROXY_SERVER=nginx
+ '[' nginx '!=' nginx ']'
+ echo nginx
[2017-02-20T04:10:25.988Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2017-02-20T04:10:25.988Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployPostHook] : Starting activity...
[2017-02-20T04:10:25.988Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/AppDeployPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
[2017-02-20T04:10:25.989Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/PostInitHook] : Starting activity...
[2017-02-20T04:10:25.989Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1/PostInitHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/postinit.
[2017-02-20T04:10:25.989Z] INFO [2036] - [Application deployment Sample Application#1/StartupStage1] : Completed activity. Result:
Application deployment - Command CMD-Startup stage 1 completed
[2017-02-20T04:10:25.989Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter] : Starting activity...
[2017-02-20T04:10:25.990Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigLogRotation] : Starting activity...
[2017-02-20T04:10:25.990Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2017-02-20T04:10:26.163Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
[2017-02-20T04:10:26.164Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2017-02-20T04:10:26.164Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigCWLAgent] : Starting activity...
[2017-02-20T04:10:26.164Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigCWLAgent/10-config.sh] : Starting activity...
[2017-02-20T04:10:26.426Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigCWLAgent/10-config.sh] : Completed activity. Result:
Log streaming option setting is not specified, ignore cloudwatch logs setup.
Disabled log streaming.
[2017-02-20T04:10:26.427Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter/ConfigCWLAgent] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logstreaming/hooks/config.
[2017-02-20T04:10:26.427Z] INFO [2036] - [Application deployment Sample Application#1/AddonsAfter] : Completed activity.
[2017-02-20T04:10:26.427Z] INFO [2036] - [Application deployment Sample Application#1] : Completed activity. Result:
Application deployment - Command CMD-Startup succeeded
[2017-02-20T04:32:43.707Z] INFO [3166] - [CMD-TailLogs] : Starting activity...
[2017-02-20T04:32:43.708Z] INFO [3166] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2017-02-20T04:32:43.708Z] INFO [3166] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2017-02-20T04:32:43.708Z] INFO [3166] - [CMD-TailLogs/TailLogs] : Starting activity...
[2017-02-20T04:32:43.708Z] INFO [3166] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
-------------------------------------
/var/log/nginx/access.log
-------------------------------------
-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
[2017-02-20T04:09:21.232Z] INFO [1745] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-02-20T04:09:21.234Z] INFO [1745] : Updating Command definition of addon logpublish.
[2017-02-20T04:09:21.234Z] INFO [1745] : Updating Command definition of addon logstreaming.
[2017-02-20T04:09:21.234Z] DEBUG [1745] : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
[2017-02-20T04:09:21.237Z] DEBUG [1745] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2017-02-20T04:09:21.531Z] INFO [1745] : Finding latest manifest from bucket 'elasticbeanstalk-us-west-2-648812771825' with prefix 'resources/environments/e-evnmznnmnr/_runtime/versions/manifest_'.
[2017-02-20T04:09:21.827Z] INFO [1745] : Found manifest with key 'resources/environments/e-evnmznnmnr/_runtime/versions/manifest_1487563665867'.
[2017-02-20T04:09:21.839Z] INFO [1745] : Updated manifest cache: deployment ID 1 and serial 1.
[2017-02-20T04:09:21.840Z] DEBUG [1745] : Loaded definition of Command CMD-PreInit.
[2017-02-20T04:09:21.840Z] INFO [1745] : Executing Initialization
[2017-02-20T04:09:21.841Z] INFO [1745] : Executing command: CMD-PreInit...
[2017-02-20T04:09:21.841Z] INFO [1745] : Executing command CMD-PreInit activities...
[2017-02-20T04:09:21.841Z] DEBUG [1745] : Setting environment variables..
[2017-02-20T04:09:21.841Z] INFO [1745] : Running AddonsBefore for command CMD-PreInit...
[2017-02-20T04:09:21.841Z] DEBUG [1745] : Running stages of Command CMD-PreInit from stage 0 to stage 0...
[2017-02-20T04:09:21.841Z] INFO [1745] : Running stage 0 of command CMD-PreInit...
[2017-02-20T04:09:21.841Z] DEBUG [1745] : Loaded 3 actions for stage 0.
[2017-02-20T04:09:21.841Z] INFO [1745] : Running 1 of 3 actions: InfraWriteConfig...
[2017-02-20T04:09:21.846Z] INFO [1745] : Running 2 of 3 actions: DownloadSourceBundle...
[2017-02-20T04:09:22.518Z] INFO [1745] : Running 3 of 3 actions: PreInitHook...
[2017-02-20T04:09:28.779Z] INFO [1745] : Running AddonsAfter for command CMD-PreInit...
[2017-02-20T04:09:39.489Z] INFO [1745] : Command CMD-PreInit succeeded!
[2017-02-20T04:09:39.490Z] INFO [1745] : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2017-02-20T04:09:57.958Z] DEBUG [2036] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-02-20T04:09:57.959Z] DEBUG [2036] : Checking if the command processor should execute...
[2017-02-20T04:09:57.961Z] DEBUG [2036] : Checking whether the command is applicable to instance (i-06a18c392aa73327c)..
[2017-02-20T04:09:57.961Z] INFO [2036] : Command is applicable to this instance (i-06a18c392aa73327c)..
[2017-02-20T04:09:57.962Z] DEBUG [2036] : Checking if the received command stage is valid..
[2017-02-20T04:09:57.962Z] INFO [2036] : No stage_num in command. Valid stage..
[2017-02-20T04:09:57.962Z] INFO [2036] : Received command CMD-Startup: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-06a18c392aa73327c"],"command_name":"CMD-Startup","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"1e9fb2c8-f722-11e6-a999-2d00f4179ab5","command_timeout":"600"}
[2017-02-20T04:09:57.962Z] INFO [2036] : Command processor should execute command.
[2017-02-20T04:09:57.962Z] DEBUG [2036] : Storing current stage..
[2017-02-20T04:09:57.962Z] DEBUG [2036] : Stage_num does not exist. Not saving null stage. Returning..
[2017-02-20T04:09:57.962Z] DEBUG [2036] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-02-20T04:09:57.962Z] DEBUG [2036] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-02-20T04:09:57.963Z] DEBUG [2036] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-02-20T04:09:57.964Z] INFO [2036] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-02-20T04:09:57.966Z] INFO [2036] : Updating Command definition of addon logpublish.
[2017-02-20T04:09:57.966Z] INFO [2036] : Updating Command definition of addon logstreaming.
[2017-02-20T04:09:57.967Z] DEBUG [2036] : Refreshing metadata...
[2017-02-20T04:09:58.389Z] DEBUG [2036] : Refreshed environment metadata.
[2017-02-20T04:09:58.389Z] DEBUG [2036] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-02-20T04:09:58.390Z] DEBUG [2036] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-02-20T04:09:58.392Z] INFO [2036] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-02-20T04:09:58.394Z] INFO [2036] : Updating Command definition of addon logpublish.
[2017-02-20T04:09:58.394Z] INFO [2036] : Updating Command definition of addon logstreaming.
[2017-02-20T04:09:58.394Z] DEBUG [2036] : Loaded definition of Command CMD-Startup.
[2017-02-20T04:09:58.395Z] INFO [2036] : Executing Application deployment
[2017-02-20T04:09:58.397Z] INFO [2036] : Executing command: CMD-Startup...
[2017-02-20T04:09:58.397Z] INFO [2036] : Executing command CMD-Startup activities...
[2017-02-20T04:09:58.397Z] DEBUG [2036] : Setting environment variables..
[2017-02-20T04:09:58.397Z] INFO [2036] : Running AddonsBefore for command CMD-Startup...
[2017-02-20T04:09:58.397Z] DEBUG [2036] : Running stages of Command CMD-Startup from stage 0 to stage 1...
[2017-02-20T04:09:58.397Z] INFO [2036] : Running stage 0 of command CMD-Startup...
[2017-02-20T04:09:58.397Z] INFO [2036] : Running leader election...
[2017-02-20T04:09:58.818Z] INFO [2036] : Instance is Leader.
[2017-02-20T04:09:58.818Z] DEBUG [2036] : Loaded 7 actions for stage 0.
[2017-02-20T04:09:58.818Z] INFO [2036] : Running 1 of 7 actions: HealthdLogRotation...
[2017-02-20T04:09:58.830Z] INFO [2036] : Running 2 of 7 actions: HealthdHTTPDLogging...
[2017-02-20T04:09:58.831Z] INFO [2036] : Running 3 of 7 actions: HealthdNginxLogging...
[2017-02-20T04:09:58.832Z] INFO [2036] : Running 4 of 7 actions: EbExtensionPreBuild...
[2017-02-20T04:09:59.345Z] INFO [2036] : Running 5 of 7 actions: AppDeployPreHook...
[2017-02-20T04:10:15.101Z] INFO [2036] : Running 6 of 7 actions: EbExtensionPostBuild...
[2017-02-20T04:10:15.598Z] INFO [2036] : Running 7 of 7 actions: InfraCleanEbExtension...
[2017-02-20T04:10:15.602Z] INFO [2036] : Running stage 1 of command CMD-Startup...
[2017-02-20T04:10:15.602Z] DEBUG [2036] : Loaded 3 actions for stage 1.
[2017-02-20T04:10:15.602Z] INFO [2036] : Running 1 of 3 actions: AppDeployEnactHook...
[2017-02-20T04:10:25.988Z] INFO [2036] : Running 2 of 3 actions: AppDeployPostHook...
[2017-02-20T04:10:25.989Z] INFO [2036] : Running 3 of 3 actions: PostInitHook...
[2017-02-20T04:10:25.989Z] INFO [2036] : Running AddonsAfter for command CMD-Startup...
[2017-02-20T04:10:26.427Z] INFO [2036] : Command CMD-Startup succeeded!
[2017-02-20T04:10:26.428Z] INFO [2036] : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2017-02-20T04:32:43.697Z] DEBUG [3166] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-02-20T04:32:43.698Z] DEBUG [3166] : Checking if the command processor should execute...
[2017-02-20T04:32:43.701Z] DEBUG [3166] : Checking whether the command is applicable to instance (i-06a18c392aa73327c)..
[2017-02-20T04:32:43.701Z] INFO [3166] : Command is applicable to this instance (i-06a18c392aa73327c)..
[2017-02-20T04:32:43.701Z] DEBUG [3166] : Checking if the received command stage is valid..
[2017-02-20T04:32:43.702Z] INFO [3166] : No stage_num in command. Valid stage..
[2017-02-20T04:32:43.702Z] INFO [3166] : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAIYTXAC25BPPMVRGA\",\"signature\":\"jc+aHFw1y\\\/O+07rVpCPEOKb3iTs=\",\"security_token\":\"FQoDYXdzEIb\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/\\\/wEaDF\\\/k05drb1Y6NjfahyLIA5LxJEqXbliFnvfjnLiC9aIBKhPQkJCScp3L2\\\/TE\\\/nSgOw1VTAIgBG0rMbJ5F2+RPz\\\/cFwEyKd\\\/KuCAxbdcyGUGX+foJiahX2ZxFeaJQaNwBP63+YAzhOELoy\\\/CkPHSwQf8JbFdeytNUyc73Ce6fvpXavwcgbbkL+IHyg26ldGyBG42Evb9AHBMrSmPpuK2a\\\/KuHK\\\/q5ccZQC+qm67kBTriQi2VLALGuvrGZy\\\/tydSU2VsqGflvAoPZ3j\\\/+PVXVnmDGuZHYgvr+5ZbAbo1wlvCbgf+IxmR6VrURU40XVUUewgAEWVCwg04mKMlKj343eceVfI9dtEHYyjXKjKv\\\/xT3RUl0ksiYRtPV8RuDgr2BDPEMsImFXkGSCUMIyBWTwjYXARNcFfQZLZuMvEU2yC4P6nkHbWKw23DOPtxng0rES6Yzsm5G5Fvgb4+HUEl+Mu7YUJWt\\\/IQCDejXN9wUTIlo1JdGplZGjfXMCrhJQnQBXD\\\/qKksyufnY\\\/jyDC4GNCkHQEGmgFWntBeZVYhZftCrQDBy0F8PA7V\\\/D9iJvm9eJ1N29ZcdVM62m6NT4k+Hv5iFlDaSoeCSs9bGbay6I1ObbjKKSxvdtkHriigp6nFBQ==\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNy0wMi0yMFQwNTowMjo0Mi4yNloiLCJjb25kaXRpb25zIjpbWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXRpbWVfc3RhbXAiLCIiXSxbInN0YXJ0cy13aXRoIiwiJHgtYW16LW1ldGEtcHVibGlzaF9tZWNoYW5pc20iLCIiXSxbInN0YXJ0cy13aXRoIiwiJGtleSIsInJlc291cmNlc1wvZW52aXJvbm1lbnRzXC9sb2dzXC8iXSxbInN0YXJ0cy13aXRoIiwiJHgtYW16LW1ldGEtYmF0Y2hfaWQiLCIiXSxbInN0YXJ0cy13aXRoIiwiJHgtYW16LW1ldGEtZmlsZV9uYW1lIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1zZWN1cml0eS10b2tlbiIsIiJdLFsic3RhcnRzLXdpdGgiLCIkQ29udGVudC1UeXBlIiwiIl0sWyJlcSIsIiRidWNrZXQiLCJlbGFzdGljYmVhbnN0YWxrLXVzLXdlc3QtMi02NDg4MTI3NzE4MjUiXSxbImVxIiwiJGFjbCIsInByaXZhdGUiXV19\"}","instance_ids":["i-06a18c392aa73327c"],"data":"9e0cfab0-f725-11e6-8f0e-9f392d16cbe4","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"9e0cfab0-f725-11e6-8f0e-9f392d16cbe4","command_timeout":"600"}
[2017-02-20T04:32:43.702Z] INFO [3166] : Command processor should execute command.
[2017-02-20T04:32:43.702Z] DEBUG [3166] : Storing current stage..
[2017-02-20T04:32:43.702Z] DEBUG [3166] : Stage_num does not exist. Not saving null stage. Returning..
[2017-02-20T04:32:43.702Z] DEBUG [3166] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-02-20T04:32:43.702Z] DEBUG [3166] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-02-20T04:32:43.703Z] DEBUG [3166] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-02-20T04:32:43.704Z] INFO [3166] : Found enabled addons: ["logpublish", "logstreaming"].
[2017-02-20T04:32:43.706Z] INFO [3166] : Updating Command definition of addon logpublish.
[2017-02-20T04:32:43.706Z] INFO [3166] : Updating Command definition of addon logstreaming.
[2017-02-20T04:32:43.707Z] DEBUG [3166] : Loaded definition of Command CMD-TailLogs.
[2017-02-20T04:32:43.707Z] INFO [3166] : Executing CMD-TailLogs
[2017-02-20T04:32:43.707Z] INFO [3166] : Executing command: CMD-TailLogs...
[2017-02-20T04:32:43.708Z] INFO [3166] : Executing command CMD-TailLogs activities...
[2017-02-20T04:32:43.708Z] DEBUG [3166] : Setting environment variables..
[2017-02-20T04:32:43.708Z] INFO [3166] : Running AddonsBefore for command CMD-TailLogs...
[2017-02-20T04:32:43.708Z] DEBUG [3166] : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2017-02-20T04:32:43.708Z] INFO [3166] : Running stage 0 of command CMD-TailLogs...
[2017-02-20T04:32:43.708Z] DEBUG [3166] : Loaded 1 actions for stage 0.
[2017-02-20T04:32:43.708Z] INFO [3166] : Running 1 of 1 actions: TailLogs...

Running a script from .ebextensions folder in aws elastic beanstalk

I am trying to run a script from when war is uploaded so here is the contents of configurations
container_commands:
01_setup_apache:
command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
02_setup_script:
command: "sudo su root"
03_setup_script:
command: "sudo mkdir -p /home/dev"
04_setup_script:
command: "sudo chmod 777 /home/dev -R"
05_setup_script:
command: "sudo cp .ebextensions/scripts/setup.sh /home/dev/"
06_setup_script:
command: "sudo chmod +x /home/dev/setup.sh"
07_setup_script:
command: "sudo /home/dev/setup.sh"
08-restart-apache:
command: "sudo /etc/init.d/httpd restart"
I tried every thing but deployment always fail on executing setup.sh. In above example it fails on 07_setup_script
Here is log contents
] : Starting activity...
/Command 01_setup_apache] : Starting activity...
/Command 01_setup_apache] : Completed activity.
/Command 02_setup_script] : Starting activity...
/Command 02_setup_script] : Completed activity.
/Command 03_setup_script] : Starting activity...
/Command 03_setup_script] : Completed activity.
/Command 04_setup_script] : Starting activity...
/Command 04_setup_script] : Completed activity.
/Command 05_setup_script] : Starting activity...
/Command 05_setup_script] : Completed activity.
/Command 06_setup_script] : Starting activity...
/Command 06_setup_script] : Completed activity.
/Command 07_setup_script] : Starting activity...
/Command 07_setup_script] : Activity execution failed, because: sudo: unable to execute /home/dev/setup.sh: No such file or directory
(ElasticBeanstalk::ExternalInvocationError)
If ssh on instances there is no folder or file over there (/home/dev) or ( /home/dev/setup.sh) it seems previous commands were not executed but log says its completed
I know there is way to create a script file on run time, but can we avoid that and just use the above method.
A couple of issues. You shouldn't start trying to manage a home directory/directory structure at all, that's definitely outside of beanstalk best-practices. Also don't run things as sudo, it executes hooks as root.
Do something like this:
in .ebextension/foo.config:
container_commands:
01_restart_httpd:
command: /etc/init.d/httpd restart
files:
/etc/httpd/conf.d/enable_mod_deflate.conf:
mode: "000644"
owner: root
group: root
content: |
#content of your conf
or also
files:
/etc/httpd/conf.d/enable_mod_deflate.conf:
mode: "000644"
owner: root
group: root
content: |
#content of your conf
/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_httpd:
mode: "000777"
owner: root
group: root
content: |
#!/bin/sh
/etc/init.d/httpd restart