awslabs / aws-devops-essential

In few hours, quickly learn how to effectively leverage various AWS services to improve developer productivity and reduce the overall time to market for new product capabilities.
Apache License 2.0
714 stars 501 forks source link

Lab5 ~ Stage2 - Step8 - Deploying Java "webapp" application issue #31

Open clemusgo9981 opened 2 years ago

clemusgo9981 commented 2 years ago

Hello team,

Hope you're doing well. I was setting this AWS DevOps Lab on my personal account, and during the Lab5, Stage2, Step8, I'm getting the following error while trying to deploy java application "webapp". Looks like the mirror for installing Apache Tomcat is no longer valid:

2022-08-24T03:20:32.801-05:00 | Step 8/22 : RUN java -version | 2022-08-24T03:20:32.801-05:00 | ---> Running in f13afa63f92e | 2022-08-24T03:20:36.338-05:00 | openjdk version "1.8.0_342" | 2022-08-24T03:20:36.338-05:00 | OpenJDK Runtime Environment (build 1.8.0_342-b07) | 2022-08-24T03:20:36.338-05:00 | OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode) | 2022-08-24T03:20:36.338-05:00 | Removing intermediate container f13afa63f92e | 2022-08-24T03:20:36.338-05:00 | ---> 14062452e9e2 | 2022-08-24T03:20:36.338-05:00 | Step 9/22 : RUN wget http://mirror.linux-ia64.org/apache/tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7.0.96.tar.gz && tar -xvf apache-tomcat-7.0.96.tar.gz && rm apache-tomcat.tar.gz && mv apache-tomcat ${CATALINA_HOME} | 2022-08-24T03:20:36.338-05:00 | ---> Running in a1bf2b989760 | 2022-08-24T03:20:36.338-05:00 | --2022-08-24 08:20:33-- http://mirror.linux-ia64.org/apache/tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7.0.96.tar.gz | 2022-08-24T03:20:36.338-05:00 | Resolving mirror.linux-ia64.org (mirror.linux-ia64.org)... 89.189.177.241, 37.193.156.169 | 2022-08-24T03:20:36.338-05:00 | Connecting to mirror.linux-ia64.org (mirror.linux-ia64.org)|89.189.177.241|:80... connected. | 2022-08-24T03:20:36.338-05:00 | HTTP request sent, awaiting response... 404 Not Found | 2022-08-24T03:20:36.338-05:00 | 2022-08-24 08:20:33 ERROR 404: Not Found. | 2022-08-24T03:20:36.338-05:00 |   | 2022-08-24T03:20:36.338-05:00 | The command '/bin/sh -c wget http://mirror.linux-ia64.org/apache/tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7.0.96.tar.gz && tar -xvf apache-tomcat-7.0.96.tar.gz && rm apache-tomcat.tar.gz && mv apache-tomcat ${CATALINA_HOME}' returned a non-zero code: 8 | 2022-08-24T03:20:36.338-05:00 |   | 2022-08-24T03:20:36.338-05:00 | [Container] 2022/08/24 08:20:34 Command did not exit successfully docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG . exit status 8 | 2022-08-24T03:20:36.338-05:00 | [Container] 2022/08/24 08:20:34 Phase complete: BUILD State: FAILED | 2022-08-24T03:20:36.338-05:00 | [Container] 2022/08/24 08:20:34 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .. Reason: exit status 8 | 2022-08-24T03:20:36.338-05:00 | [Container] 2022/08/24 08:20:34 Entering phase POST_BUILD | 2022-08-24T03:20:36.338-05:00 | [Container] 2022/08/24 08:20:34 Running command echo Build completed on date | 2022-08-24T03:20:36.338-05:00 | Build completed on Wed Aug 24 08:20:34 UTC 2022

Cloud9 CLI Command executed

carlos.lemus:~/environment $ ecs-cli compose --project-name ecsdemo-javawebapp service up --timeout 15 --create-log-groups --target-group-arn $target_group_arn --private-dns-namespace service --enable-service-discovery --container-name ecsdemo-javawebapp --container-port 8080 --cluster-config ecs-demo --vpc $vpc INFO[0000] Using ECS task definition TaskDefinition="ecsdemo-javawebapp:4" WARN[0000] Failed to create log group ecsdemo-javawebapp in us-east-1: The specified log group already exists WARN[0000] Service Discovery can not be enabled on an existing ECS Service. Skipping this flag... WARN[0000] You cannot update the load balancer configuration on an existing service. serviceName=ecsdemo-javawebapp INFO[0000] Updated ECS service successfully desiredCount=1 force-deployment=false service=ecsdemo-javawebapp INFO[0025] (service ecsdemo-javawebapp) has started 1 tasks: (task c893e6cba06c4045bb54be5865d3f321). timestamp="2022-08-24 08:36:53 +0000 UTC" INFO[0086] (service ecsdemo-javawebapp) has started 1 tasks: (task aa8684ed1b794d06b15633a6727404b3). timestamp="2022-08-24 08:37:52 +0000 UTC" INFO[0146] (service ecsdemo-javawebapp) has started 1 tasks: (task fdb4a3cb2c0c483a8e9a7a8f8d798f3f). timestamp="2022-08-24 08:38:53 +0000 UTC" INFO[0487] (service ecsdemo-javawebapp) has started 1 tasks: (task d3b7cc10c4324cb6994cc278c68b41bc). timestamp="2022-08-24 08:44:33 +0000 UTC" ERRO[0758] Error describing service error="ExpiredTokenException: The security token included in the request is expired\n\tstatus code: 400, request id: 376c5a6e-d73a-4822-8c87-c36457ce069e" service=ecsdemo-javawebapp FATA[0758] ExpiredTokenException: The security token included in the request is expired status code: 400, request id: 376c5a6e-d73a-4822-8c87-c36457ce069e

Stopped reason CannotPullContainerError: inspect image has been retried 1 time(s): failed to resolve ref "docker.io/javawebapp/latest:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

NOTE: I ensured myself to cover the issue by adding permissions to the repository "javawebappdemo" just in case, but still getting the same problem with the URL mirror for installing Apache Tomcat. The error message "ExpiredTokenException" is due to multiple times the java app deployment process was tried, so this should be expected after all. Those warning messages showing in the Cloud9 CLI command output is expected. This should not affect the process of deploying the java application. The whole lab was retried, but still getting the same results.

IMPORTANT: Most of the roles that were deployed are facing issues by not declaring the version of the json file, actions by not having an applicable resource, and actions not support resource level permissions, which requires a wildcard for the resource. It's worth it to update those roles, in order to avoid updating them manually (which this was my case). I'll ensure to upload the updates done on every role. Hopefully, this contributes for the community and all audience.

Any feedback or guidance is appreciated. Thanks in advance. Carlos Lemus

Role01 - Before Role01 - After Role02 - Before Role02 - After