stratospheric-dev / stratospheric

All you need to know to get your Spring Boot application into production with AWS 🍃
https://stratospheric.dev
Apache License 2.0
262 stars 187 forks source link

multiple fixes with latest CDK and cognito #275

Closed szantopeter closed 6 months ago

szantopeter commented 7 months ago

I tried to deploy chapter 10 to my AWS account, but the application wasn't working for multiple reasons

  1. It deploys the stratospheric-v1 docker image, that was built from the previous chapter and has no authentication in it. There seems to be no v2 image in dockerhub, so if you agree with this approach then could you please build and publish one?
  2. fix to run stack with latest CDK commandline
  3. Fix misspelled property name
  4. Register loadbalancer URL with cognito. I don't have a domain name so at least I could test through the loadbalancer URL
  5. Fix broken authentication by enabling sticky session (this took some while to debug)
szantopeter commented 6 months ago

@rieckpil @BjoernKW Have you had a chance to look at this PR? I made some updates and eventually the login fully works through the loadbalancer

rieckpil commented 6 months ago

thank you very much for the fixes @szantopeter - In general, we don't maintain the chapter versions anymore as this is a "maintenance hell", but I'm happy to accept your changes to improve our fixes.

So LGTM, @BjoernKW feel free to integrate

BjoernKW commented 6 months ago

Thanks again, @szantopeter! I've just merged your pull request (without the -v2 change for the Docker image name, though; see the comment above).

szantopeter commented 6 months ago

Thanks for meging and even more for writing the book :) I find it much more valuable to learn through real world scenarios than to spend a lot of time on exam preparation!

Regarding the docker image name I am just unsure what was your original intentions. What happens is that

  1. Developer deploys app with CDK
  2. Application shows a "hello world", instead of the expected features
  3. Developer realizes that the CDK config uses to the chapter 1 docker image in the public docker hub
  4. Developer builds the code, pushes to his own docker hub, or ECR repo and redeploys the application
  5. Application finally works

I was proposing to publish v2, v3 etc images so every chapter can be deployed independently without the need to build a docker image out of it.

Was your plan that everyone have to build their own docker image?

BjoernKW commented 6 months ago

Was your plan that everyone have to build their own docker image?

Essentially, yes. This particularly applies to the chapter versions of the application, which are to be understood as intermediate steps to the final result.

szantopeter commented 6 months ago

if that was the intention then maybe it would be better reflected by having something like this in the cdk.json

"dockerImageUrl": "build this chapter and place your docker image URL here",

instead of

"dockerImageUrl": "docker.io/stratospheric/todo-app-v1:latest",

that deploys a wrong application. Though I am still not sure what is the value of everyone having to build the image for themselves, but I am fine either way. (I already build and pushed my images :) )