awslabs / aws-saas-boost

AWS SaaS Boost is a ready-to-use toolset that removes the complexity of successfully running SaaS workloads in the AWS cloud.
Apache License 2.0
954 stars 188 forks source link

Can't get sample app deployed to SaaS Boost environment - M1 Mac architecture may be problem? #204

Open legut2 opened 2 years ago

legut2 commented 2 years ago

:question: General Issue

I am unfamiliar with this codebase and was going through the getting started steps. I got to step 7 and when running install.sh it gave me an error. When I looked into the error I stumbled across this stackoverflow post. Which leads me to believe it's my machine's architecture that is the problem.

The Question

How do I finish deploying the sample app? I think I have to modify the dockerfile but what do I change it to. I'm unfamiliar with the architecture of this project.

Environment

cdk version 2.15.0 (build 151055e)

Other information

Please enter your AWS SaaS Boost Environment label: dev
us-west-1
Running AWS CLI version 2
Login Succeeded
xxxxxxxxxxxx.dkr.ecr.us-west-1.amazonaws.com/sb-dev-core-nf8uxvu01u9y-ecsrepository-1phzdz3eqvz2:latest
[INFO] Scanning for projects...
[INFO] 
[INFO] -----< com.amazon.aws.partners.saasfactory:saas-boost-hello-world >-----
[INFO] Building HelloWorld 1.0.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ saas-boost-hello-world ---
[INFO] Deleting /Users/user/awsSaaSboost/aws-saas-boost/samples/java/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ saas-boost-hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ saas-boost-hello-world ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 35 source files to /Users/user/awsSaaSboost/aws-saas-boost/samples/java/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ saas-boost-hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/user/awsSaaSboost/aws-saas-boost/samples/java/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ saas-boost-hello-world ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ saas-boost-hello-world ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:3.2.3:war (default-war) @ saas-boost-hello-world ---
[INFO] Packaging webapp
[INFO] Assembling webapp [saas-boost-hello-world] in [/Users/user/awsSaaSboost/aws-saas-boost/samples/java/target/HelloWorld]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/user/awsSaaSboost/aws-saas-boost/samples/java/src/main/webapp]
[INFO] Webapp assembled in [221 msecs]
[INFO] Building war: /Users/user/awsSaaSboost/aws-saas-boost/samples/java/target/HelloWorld.war
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.6.1:repackage (default) @ saas-boost-hello-world ---
[INFO] Layout: WAR
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.797 s
[INFO] Finished at: 2022-03-11T14:24:04-06:00
[INFO] ------------------------------------------------------------------------
[+] Building 0.7s (4/4) FINISHED                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                   0.0s
 => => transferring dockerfile: 84B                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                        0.0s
 => CANCELED [internal] load metadata for public.ecr.aws/docker/library/alpine:latest                                                                                  0.6s
 => ERROR [internal] load metadata for docker.io/library/amazoncorretto:11-alpine                                                                                      0.6s
------
 > [internal] load metadata for docker.io/library/amazoncorretto:11-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:048c8890b9bb0c98fa5841005be3ca415bf6ce0235d4c74a371b866dc597c93d: not found
Error response from daemon: No such image: helloworld:latest
The push refers to repository [xxxxxxxxxxxx.dkr.ecr.us-west-1.amazonaws.com/sb-dev-core-nf8uxvu01u9y-ecsrepository-1phzdz3eqvz2]
An image does not exist locally with the tag: xxxxxxxxxxxx.dkr.ecr.us-west-1.amazonaws.com/sb-dev-core-nf8uxvu01u9y-ecsrepository-1phzdz3eqvz2
brtrvn commented 2 years ago

I do not have an M1 machine to test on. Did you try the suggestion in that Stackoverflow post to add --platform= to the Dockerfile?

To get up-and-running, the easiest solution might be to just use a temporary Cloud9 instance to run the installation.

legut2 commented 2 years ago

I don't consider this issue solved. I did just end up using a different machine (which has ubuntu and an intel chip) and it worked to get me past this point. So I do believe I have confirmed the problem does seem to be related to the mac M1 arm processor.

brtrvn commented 2 years ago

Looks like there are ARM flavors of both the Amazon Corretto and Alpine images available from Docker Hub. You can alter the dockerfile in the Java sample project accordingly and see if it will build on your M1 mac.

goodbyedavid commented 2 years ago

I'm using a M1 machine and had the same issue. Tried to follow the suggestion from the stack overflow page, cleaned some internal cache and changed the following line: FROM --platform=linux/amd64 amazoncorretto:11-alpine AS build It worked for building the docker image, but when trying to provision a new tenant using this image. ECS tasks are giving errors, so it is not a right solution: [FATAL tini (6)] exec java failed: No such file or directory

goodbyedavid commented 2 years ago

as suggested by @brtrvn, the easiest installation solution is probably just use cloud9 directly. https://github.com/awslabs/aws-saas-boost/blob/main/docs/install_using_cloud9.md