我正在学习如何使用扩展名自定义Elastic Beanstalk创建的EC2实例上的文件。
因此,我在此java-tomcat-v3.zip sample application下载了Tomcat page,并修改了其.ebextensions/logging.config
文件。
下面是我的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
将zip文件部署到Elastic Beanstalk环境后,不会创建文件/usr/share/tomcat8/conf/Catalina/localhost/rewrite.config
。
所有其他3个文件均已正确创建。
我的配置出了什么问题?
在rewrite.config
中有一些有关/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...
我不明白为什么在部署过程中弹性beantalk会执行rm -rf /usr/share/tomcat8/conf/Catalina/localhost/rewrite.config
命令。
创建文件后,是否有任何命令可以删除/usr/share/tomcat8/conf/Catalina/localhost/rewrite.config
?
以下是/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
我发现rm -rf /usr/share/$TOMCAT_NAME/conf/Catalina/localhost/*
中有一个命令/opt/elasticbeanstalk/hooks/appdeploy/enact/02clean.sh
。
这可能是我无法在/usr/share/tomcat8/conf/Catalina/localhost/
下创建文件的原因。
我的最终目标是使用Tomcat rewrite valve。我想我必须寻找另一种解决方案。