Giter Site home page Giter Site logo

stratospheric-dev / stratospheric Goto Github PK

View Code? Open in Web Editor NEW
250.0 13.0 182.0 13.84 MB

All you need to know to get your Spring Boot application into production with AWS ๐Ÿƒ

Home Page: https://stratospheric.dev

License: Apache License 2.0

Java 78.94% HTML 12.02% Shell 6.57% Dockerfile 0.20% CSS 0.04% JavaScript 0.99% TypeScript 1.24%
aws-sdk spring spring-boot aws cloudformation spring-cloud aws-cdk spring-cloud-aws cloud-native

stratospheric's People

Contributors

anthony-be avatar bjoernkw avatar branislavbeno avatar dependabot[bot] avatar rieckpil avatar shantdashjian avatar skhurram avatar szantopeter avatar thombergs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stratospheric's Issues

Running the App in Dev Mode

Is the app supposed to run locally?
According to the book after starting docker via ./start-dependencies.sh (works) I should be able to start the app via gradle:
./gradlew bootRun

However, that last step fails with an exception concerning aws credentials.

~/devel/stratospheric/application$ ./gradlew bootRun
./gradlew: 39: cd: can't cd to "./
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

> Task :bootRun
Listening for transport dt_socket at address: 5005

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.4.RELEASE)

2020-11-13 11:59:23.243  INFO 2099 --- [  restartedMain] dev.stratospheric.TodoApplication        : Starting TodoApplication on DESKTOP-TJ97MJA with PID 2099 (/home/gmerlin63/devel/stratospheric/application/build/classes/java/main started by gmerlin63 in /home/gmerlin63/devel/stratospheric/application)
2020-11-13 11:59:23.245  INFO 2099 --- [  restartedMain] dev.stratospheric.TodoApplication        : The following profiles are active: dev
2020-11-13 11:59:23.286  INFO 2099 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-13 11:59:23.287  INFO 2099 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-11-13 11:59:27.021  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-11-13 11:59:27.022  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
2020-11-13 11:59:27.062  INFO 2099 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface dev.stratospheric.collaboration.TodoCollaborationRequestRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.
2020-11-13 11:59:27.063  INFO 2099 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface dev.stratospheric.person.PersonRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.
2020-11-13 11:59:27.063  INFO 2099 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface dev.stratospheric.todo.TodoRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.
2020-11-13 11:59:27.064  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 33ms. Found 0 JDBC repository interfaces.
2020-11-13 11:59:27.072  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-11-13 11:59:27.072  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-11-13 11:59:27.104  INFO 2099 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 26ms. Found 3 JPA repository interfaces.
2020-11-13 11:59:27.321  INFO 2099 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#57a9e543' of type [com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-11-13 11:59:27.327  INFO 2099 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#41f6e2c9' of type [com.amazonaws.auth.profile.ProfileCredentialsProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-11-13 11:59:27.328  INFO 2099 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'credentialsProvider' of type [org.springframework.cloud.aws.core.credentials.CredentialsProviderFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-11-13 11:59:27.328  INFO 2099 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'credentialsProvider' of type [com.amazonaws.auth.AWSCredentialsProviderChain] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-11-13 11:59:27.662  INFO 2099 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-11-13 11:59:27.670  INFO 2099 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-11-13 11:59:27.670  INFO 2099 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-11-13 11:59:27.742  INFO 2099 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-11-13 11:59:27.743  INFO 2099 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4456 ms
2020-11-13 11:59:27.781  INFO 2099 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-11-13 11:59:27.873  INFO 2099 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-11-13 11:59:27.878  INFO 2099 --- [  restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:postgresql://localhost:5432/aws101'
2020-11-13 11:59:27.972  INFO 2099 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 6.4.4 by Redgate
2020-11-13 11:59:27.991  INFO 2099 --- [  restartedMain] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://localhost:5432/aws101 (PostgreSQL 13.0
2020-11-13 11:59:28.001  WARN 2099 --- [  restartedMain] o.f.c.internal.database.base.Database    : Flyway upgrade recommended: PostgreSQL 13.0 is newer than this version of Flyway and support has not been tested. The latest supported version of PostgreSQL is 12.
2020-11-13 11:59:28.047  INFO 2099 --- [  restartedMain] o.f.core.internal.command.DbValidate     : Successfully validated 3 migrations (execution time 00:00.024s)
2020-11-13 11:59:28.057  INFO 2099 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Current version of schema "public": 003
2020-11-13 11:59:28.059  INFO 2099 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema "public" is up to date. No migration necessary.
2020-11-13 11:59:28.145  INFO 2099 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-11-13 11:59:28.207  INFO 2099 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.21.Final
2020-11-13 11:59:28.360  INFO 2099 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-11-13 11:59:28.455  INFO 2099 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialec
2020-11-13 11:59:28.985  INFO 2099 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-11-13 11:59:28.989  INFO 2099 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-11-13 11:59:29.457  WARN 2099 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-11-13 11:59:29.588  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'clientInboundChannelExecutor'
2020-11-13 11:59:29.591  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'clientOutboundChannelExecutor'
2020-11-13 11:59:29.597  INFO 2099 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'messageBrokerTaskScheduler'
2020-11-13 11:59:29.617  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'brokerChannelExecutor'
2020-11-13 11:59:29.737  INFO 2099 --- [  restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2020-11-13 11:59:30.141  INFO 2099 --- [  restartedMain] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: c7c160dc-4741-4fe9-b0d7-e16bca569fd2

2020-11-13 11:59:30.218  INFO 2099 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@6f19478c, org.springframework.security.web.context.SecurityContextPersistenceFilter@2fb22d5f, org.springframework.security.web.header.HeaderWriterFilter@68d1a540, org.springframework.security.web.csrf.CsrfFilter@297c6a5b, org.springframework.security.web.authentication.logout.LogoutFilter@72918e35, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@4cb104a7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6ca48279, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@73dcb9c3, org.springframework.security.web.session.SessionManagementFilter@5a1e82af, org.springframework.security.web.access.ExceptionTranslationFilter@5d5c9008, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@14ec0f12]
2020-11-13 11:59:30.251  INFO 2099 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-11-13 11:59:32.594  WARN 2099 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMessageListenerContainer' defined in class path resource [org/springframework/cloud/aws/messaging/config/annotation/SqsConfiguration.class]: Invocation of init method failed; nested exception is com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@4a71bb64: Unable to load credentials from service endpoint, com.amazonaws.auth.profile.ProfileCredentialsProvider@63d9b336: profile file cannot be null]
2020-11-13 11:59:32.605  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'brokerChannelExecutor'
2020-11-13 11:59:32.606  INFO 2099 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'messageBrokerTaskScheduler'
2020-11-13 11:59:32.607  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'clientOutboundChannelExecutor'
2020-11-13 11:59:32.608  INFO 2099 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'clientInboundChannelExecutor'
2020-11-13 11:59:32.610  INFO 2099 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-11-13 11:59:32.622  INFO 2099 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2020-11-13 11:59:32.649  INFO 2099 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2020-11-13 11:59:32.651  INFO 2099 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-11-13 11:59:32.662  INFO 2099 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-13 11:59:32.668 ERROR 2099 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMessageListenerContainer' defined in class path resource [org/springframework/cloud/aws/messaging/config/annotation/SqsConfiguration.class]: Invocation of init method failed; nested exception is com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@4a71bb64: Unable to load credentials from service endpoint, com.amazonaws.auth.profile.ProfileCredentialsProvider@63d9b336: profile file cannot be null]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
        at dev.stratospheric.TodoApplication.main(TodoApplication.java:10) ~[main/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.3.4.RELEASE.jar:2.3.4.RELEASE]
Caused by: com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@4a71bb64: Unable to load credentials from service endpoint, com.amazonaws.auth.profile.ProfileCredentialsProvider@63d9b336: profile file cannot be null]
        at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1186) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:776) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:726) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:719) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:701) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:669) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:651) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:515) ~[aws-java-sdk-core-1.11.415.jar:na]
        at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2147) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2116) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2105) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at com.amazonaws.services.sqs.AmazonSQSClient.executeGetQueueUrl(AmazonSQSClient.java:1138) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at com.amazonaws.services.sqs.AmazonSQSClient.getQueueUrl(AmazonSQSClient.java:1110) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient.getQueueUrl(AmazonSQSBufferedAsyncClient.java:260) ~[aws-java-sdk-sqs-1.11.415.jar:na]
        at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver.resolveDestination(DynamicQueueUrlDestinationResolver.java:94) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver.resolveDestination(DynamicQueueUrlDestinationResolver.java:38) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.messaging.core.CachingDestinationResolverProxy.resolveDestination(CachingDestinationResolverProxy.java:92) ~[spring-messaging-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.cloud.aws.messaging.listener.AbstractMessageListenerContainer.queueAttributes(AbstractMessageListenerContainer.java:321) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.cloud.aws.messaging.listener.AbstractMessageListenerContainer.initialize(AbstractMessageListenerContainer.java:293) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.cloud.aws.messaging.listener.SimpleMessageListenerContainer.initialize(SimpleMessageListenerContainer.java:111) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.cloud.aws.messaging.listener.AbstractMessageListenerContainer.afterPropertiesSet(AbstractMessageListenerContainer.java:268) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.cloud.aws.messaging.listener.SimpleMessageListenerContainer.afterPropertiesSet(SimpleMessageListenerContainer.java:45) ~[spring-cloud-aws-messaging-2.2.2.RELEASE.jar:2.2.2.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        ... 22 common frames omitted


Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 17s
3 actionable tasks: 1 executed, 2 up-to-date

Finalize registration/login flow

  • check the current issue on production
  • make user creation more resilient (catch some exception from AWS SDK and provide a fallback/fail gracefully)
  • basic test
  • accept a profile pic for further processing (feature idea: upload to S3 -> AWS Lambda to resize to thumbnail image)
  • ensure users can log in on production
  • make HTTPS work
  • redirect from Cognito works

[eBook]: Test

What happened?

On page 47 there's a typo 'Strotospheric'

Version

1.1

Suggested Changes

2121

Check if requirements for CDK "destroy" scripts can be relaxed

Some of the CDK NPM scripts for removing CDK stacks require environment variables such as:

  • githubToken (deployment-sequencer:destroy)
  • dockerImageTag (service:destroy)
  • password (canary:destroy)

or an existing lamba.zip distribution file (in the case of deployment-sequencer:destroy).

These are not actually required when destroying the infrastructure and hence the strict dependency on those variables should perhaps be removed to simplify the deletion / termination of existing infrastructure.

Alternatively, we could provide dummy values to the destroy scripts.

Additionally, these scripts each lack an environmentName environment variable, which is required for them to run:

  • monitoring:destroy
  • service:destroy
  • messaging:destroy
  • database:destroy
  • cognito:destroy

Don't fail the pipeline if Stack is currently in "update in progress"

Right now our pipeline fails if we push two commits right after each other as both trigger the GItHub actions workflow to run.

Most of the time the second commit & push then fails because the first push currently updates our AWS infrastructure.

Ideas to fix:

  • wait if there is currently a running pipeline
  • don't fail if stack is in progress and rather mark it green

"Container startup failed" when running "gradle build"

When testing the app with Testcontainers during gradle build the following error occurs:

Container startup failed
org.testcontainers.containers.ContainerLaunchException: Container startup failed
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:330)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:311)
at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.start(TestcontainersExtension.java:242)
at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.access$200(TestcontainersExtension.java:229)
at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$null$1(TestcontainersExtension.java:59)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$getOrComputeIfAbsent$0(ExtensionValuesStore.java:81)
at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.get(ExtensionValuesStore.java:182)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:84)
at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:53)
at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$beforeAll$2(TestcontainersExtension.java:59)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.testcontainers.junit.jupiter.TestcontainersExtension.beforeAll(TestcontainersExtension.java:59)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:132)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:413)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=localstack/localstack:0.10.0, imagePullPolicy=DefaultPullPolicy())
at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1279)
at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:613)
at org.testcontainers.containers.localstack.LocalStackContainer.configure(LocalStackContainer.java:69)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:316)
... 71 more
Caused by: java.lang.IllegalStateException: Can not connect to Ryuk at localhost:32786
at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:176)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:168)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.listImagesCmd(LazyDockerClient.java:12)
at org.testcontainers.images.LocalImagesCache.maybeInitCache(LocalImagesCache.java:68)
at org.testcontainers.images.LocalImagesCache.get(LocalImagesCache.java:32)
at org.testcontainers.images.AbstractImagePullPolicy.shouldPull(AbstractImagePullPolicy.java:18)
at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:59)
at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:26)
at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20)
at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27)
at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1277)
... 74 more

Confusion around the sslCertificateArn in chapter-6 network stack

I am currently playing around with deploying chapter-6 network stack.

I see in package.json an acm certificate. It's not yet mentioned in the book where and how we can generate it.

When I tried to do so, I went to https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html#request-public-cli

Requesting a certificate requires a parameter --domain-name http://example.com
But in the mean time I don't want to give a domain name.

I'm a bit confused about this one. Can you please give me a hint or link me somewhere useful?

can I remove the sslCertificateArn=arn:aws:acm:... altogether?

`spring-boot-starter-oauth2` should be changed to `spring-boot-starter-oauth2-client`/`server`

What can we improve?

In chapter 10. Building User Registration and Login with Amazon Cognito > item Using AWS Cognito as an Identity Provider with Spring Security it is stated:

The relevant security components are part of the following two Spring Boot starters:

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-security'
  implementation 'org.springframework.boot:spring-boot-starter-oauth2'
}

I think org.springframework.boot:spring-boot-starter-oauth2 is not accurate (or up to date anymore).

In the source code it's correctly listed as:

implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

Version

Revision 1.2 (2021-10-24)

Suggested Changes

Change the code snippet in the mentioned section to:

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-security'
  implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
}

Actually log out user from AWS Cognito upon /logout action

Currently, only the browser session seems to be invalidated with the OAuth token still remaining active. Hence, after having logged out by just clicking "Sign in" one is immediately logged in again without AWS Cognito asking for username and password once more.

"Waiter StackUpdateComplete failed: Waiter encountered a terminal failure state" error during deployment

After having merge https://github.com/aws101/aws101/tree/todo-sharing-feature this error occurs during the "Create or update application stack" build step with build ultimately failing:

upload: ./network.yml to s3://aws101.dev/stacks/application/network.yml
{
"StackId": "arn:aws:cloudformation:::stack/aws101-application-parent/860672b0-c3c3-11ea-9df5-0a1a4d297742"
}
Waiter StackUpdateComplete failed: Waiter encountered a terminal failure state
##[error]Process completed with exit code 1.

See https://github.com/aws101/aws101/actions/runs/220988679

Implement different CI workflows for master and other branches

The current GitHub Action config does an AWS deployment for each push on any branch. We need to change this so that:

  • on master, run the build and deploy to AWS
  • on other branches, only run the build (if possible, provide a manual on-demand deployment to a different stack)

Enable local development

For local development, we need a PostgreSQL database and the AWS Cognito service.

Create a docker-compose.yml that spins up a PostgreSQL database and a Cognito mock with LocalStack.

Use the cdk.json file to configure non-secret context variables

What's going wrong and not working?

We pass various CDK context values to all our CDK apps like region, environmentName, sslCertificateArn, etc. using the --context CLI parameter.

This makes the corresponding npm commands inside our package.json quite long, hard to maintain, and a little bit cumbersome for readers to adjust if they want to deploy the stack with their configuration values to their AWS account.

The AWS CDK provides various solutions to configure these values. One of these solutions is a cdk.json file that is already under version control and present in each CDK project.

We could leverage this file to outsource our configuration values at a central place. I did a small PoC for this and it worked out well. I also identified various duplicates (e.g. we configure the root URL twice with two different configuration parameters) which we could streamline with this approach.

A possible cdk.json file can look like the following:

{
  "context": {
    "applicationName": "todo-app",
    "region": "eu-central-1",
    "accountId": "123456789",
    "dockerRepositoryName": "todo-app",
    "dockerImageTag": "4",
    "applicationUrl": "https://app.utilzr.io",
    "loginPageDomainPrefix": "app-utilzr",
    "environmentName": "staging",
    "springProfile": "aws",
    "activeMqUsername": "activemqUser",
    "canaryUsername": "canary",
    "canaryUserPassword": "s3cret",
    "confirmationEmail": "[email protected]",
    "applicationDomain": "app.utilzr.io",
    "sslCertificateArn": "arn:aws:acm:eu-central-1:123456789:certificate/4db31ae5-157b-4673-aef2-abe89e1f2a88",
    "hostedZoneDomain": "utilzr.io",
    "@aws-cdk/core:enableStackNameDuplicates": "true",
    "aws-cdk:enableDiffNoFail": "true",
    "@aws-cdk/core:stackRelativeExports": "true"
  }
}

We could then use the jq CLI tool for our GitHub Actions workflows to dynamically replace secret values to avoid hardcoding them in the git repository or use the "old" CLI option as this takes precedence over the cdk.json. So that we could override/specify values ad-hoc like:

npm run service:deploy -- -c dockerImageTag=42

Readers would only have to adjust one single file and could then run all our npm scripts with ease.

Plus we avoid configuration duplicates, reduce the command length of our npm scripts, and could theoretically add one single CDK App that creates/updates all Stacks together.

Expected outcome

Consider an alternative way to pass the context values to allow a convenient usage of our CDK apps for the readers.

Find alternative solution to manual cleaning of "Parameters Stack"

What's going wrong and not working?

In the ServiceApp#L54 there's a "Parameters Stack" being constructed as a container for some output parameters: Quoted from the source code:

// This means that each update will generate a new parameters stack that needs to be cleaned up manually!

While developing solutions such as the ToDo app, deployed to the cloud, I'm looking for solutions that provide the least manual intervention possible.

I think in a production-grade application, which scales up and down as needed and there's a CI/CD flow, we can't possibly expect from anyone to manually clean up any stack created by the deployment pipeline.

I'm a total newbie to cloud development, AWS, and DevOps practices in general, and maybe in this case there's no such alternative, but I'd really love to get rid of this "manual clean up" .... it just feels weird.

Expected outcome

To not have to clean up manually the "Parameters Stack" (or any other, for the matter), but to find an alternative solution where the stack (or any similar resource) is automatically cleaned up, or updated if needed.

start-dependencies.sh fails on Windows

When running the script from gitbash on Windows 10 I am getting:
ERROR: for localstack_main Cannot create container for service localstack: mkdir C:\Program Files\Git\private: Access is denied.

ERROR: for localstack Cannot create container for service localstack: mkdir C:\Program Files\Git\private: Access is denied.
ERROR: Encountered errors while bringing up the project.

gmerl@DESKTOP-TJ97MJA MINGW64 ~/gitrepo/stratospheric/application (main)

Find alternative to storing the cognito client secret as a String parameter

What's going wrong and not working?

Currently when the Cognito stack is deployed, the client secret is stored as a string parameter:

StringParameter.Builder.create(this, "userPoolClientSecret")

This might be a security issue!

I'm aware it's not so straightforward (probably not an option at all) to store a given secret (a value itself) as a Secret using AWS SSM, and there has been some discussion about it (see aws/aws-cdk#5810) but I feel there must be at least a workaround to this current approach, which seems insecure to me.

Expected outcome

A possible solution I can think of right now (I haven't tested it though) is to not store the secret value at all, and have this method (the one to retrieve the secret value) called by whatever code needs it at the very same moment the secret value is needed.

Update to Gradle 7.3 for Java 17 compatibility

What's going wrong and not working?

Unsupported Java.
Your build is currently configured to use Java 17.0.1 and Gradle 6.3.

Possible solution:

  • Use Java 14 as Gradle JVM: Open Gradle settings
  • Upgrade Gradle wrapper to 6.7 version and re-import the project

Expected outcome

The application should build with Java 17.

HTTPS listener not created properly: An exception occured while executing the Java class. No value present

Bug report by GitHub user @stevenschwenke

In chapter 5, "Using the SpringBootApplicationStack", I have changed the generated app and ended up with the following main class:

package com.myorg;

import dev.stratospheric.cdk.SpringBootApplicationStack;
import software.amazon.awscdk.core.App;
import software.amazon.awscdk.core.Environment;
import software.amazon.awscdk.core.StackProps;

import java.util.Arrays;

import static java.util.Objects.requireNonNull;

public class FirstAppFromBookApp {
    public static void main(final String[] args) {
        App app = new App();

        String accountId = (String) app.getNode().tryGetContext("accountId");
        requireNonNull(accountId, "context variable 'accountId' must not be null");

        String region = (String) app.getNode().tryGetContext("region");
        requireNonNull(region, "context variable 'region' must not be null");

        new SpringBootApplicationStack(
                app,
                "SpringBootApplication",
                makeEnv(accountId, region),
                "docker.io/stratospheric/todo-app-v1:latest"
        );

        app.synth();
    }

    static Environment makeEnv(String account, String region) {
        return Environment.builder()
                .account(account)
                .region(region)
                .build();
    }
}

The app compiles.

When trying to deploy it with

cdk deploy -c accountId=582070606165 -c region=eu-central-1

I get the following exception:

PS C:\repositories\cdk_playground\first_app_from_book> cdk deploy -c accountId=582070606165 -c region=eu-central-1
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project first_app_from_book: An exception occured while executing the Java class. No value present -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project first_app_from_book: An exception occured while executing the Java class. No value present
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. No value present
    at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:311)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: java.util.NoSuchElementException: No value present
    at java.util.Optional.get (Optional.java:141)
    at dev.stratospheric.cdk.Service.<init> (Service.java:74)
    at dev.stratospheric.cdk.SpringBootApplicationStack.<init> (SpringBootApplicationStack.java:32)
    at com.myorg.FirstAppFromBookApp.main (FirstAppFromBookApp.java:25)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:830)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Subprocess exited with error 1

It seems that the HTTPS listener is not created properly.

It would be nice to have the changed app on Github to make sure the reader did'nt introduce a typo.

A listener already exists on this port for this load balancer

When I run "npm run network:deploy" it creates a load balancer and adds a listener to it (in the Network.createLoadBalancer()) then when I run "npm run domain:deploy " it tries to create a load balancer and add a listener on the same port (in the DomainStack) and causes the error "A listener already exists on this port for this load balancer". I believe creating the listener should be on either networkApp or domainApp not both. can you please help me with this? thanks

Use GitHub Action's concurrency support to avoid simultaneous deployments

What can we improve?

Instead of using SQS and a Lambda to avoid concurrent deploys, you should be using the concurrency support in GitHub Actions, which handles exactly that.

From the docs:

When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled

Read about concurrency in the docs.

Version

latest

Suggested Changes

No response

Add todo sharing feature

Share a todo with another user:

  • E-Mail sending via SES
  • Sharing button in UI per each issue
  • Resilient E-Mail sending via queue in between (SQS)

Spring Session and OAuth2 Authorization Code Grant flow

Hello!

I am currently reading your book and one part sounds wrong to me. Namely, in chapter 10 Building User Registration and Login with Cognito in Shortcomings when Scaling Out section (p. 197) you state that Spring Session would not help with the "redirection to another instance" problem.

I tried to play a bit with the Spring Session to check that out. My test scenario was the following:

Setup:

  • Use local OIDC provider (I used Keycloak docker)
  • Use simple Spring Boot REST application that just returns OidcUser upon successful login
  • Use Spring Session with Redis (Redis running in a separate container)

Steps:

  • Launch Keycloak and create a realm, user, client, etc.
  • Launch Redis
  • Launch the application docker
  • Request trigger endpoint via browser (/oauth2/authorize/keycloak) and get redirected to the Keycloak login page, but do not enter credentials (at this point we should have Authorization request stored in the dedicated repository)
  • Kill the application container (Redis is still running)
  • Start the application container again
  • Perform login in Keycloak and get redirected back to the application

Result:

OidcUser information is available.

Without Spring Session the same scenario doesn't work, the application throws an error because it can not find the original AuthorizationRequest.

So the whole thing here is in AuthorizationRequestRepository (HttpSessionOAuth2AuthorizationRequestRepository to be more precise). And I believe Spring Session works in a way that does not alter HttpSessionOAuth2AuthorizationRequestRepository's behavior.

So I conclude that Spring Session with external storage (ex. Redis) can be used in scaling environment along with the OAuth2 Authorization code flow.

Chapter 7 - make GitHub Scripts easier to find

What can we improve?

The names of the GitHub scripts are not mentioned in the book which makes them hard to find in the repository. Also, they differ a bit.

Version

1.2

Suggested Changes

Makes the GitHub scripts in the book the same as in the repo and make them easier to find.

Investigate AmazonMQ warning logs on application start

During the bootstrap phase of our Spring Boot backend, we currently see the following two warnings:

2021-04-30 07:20:37.380 WARN 1 --- [nio-8080-exec-2] o.apache.activemq.broker.BrokerService : Memory Usage for the Broker (1024mb) is more than the maximum available for the JVM: 123 mb - resetting to 70% of maximum available: 86 mb 
2021-04-30 07:20:38.481 WARN 1 --- [nio-8080-exec-2] o.apache.activemq.broker.BrokerService : Temporary Store limit is 51200 mb (current store usage is 0 mb). The data directory: / only has 18559 mb of usable space. - resetting to maximum available disk space: 18559 mb 

General refactoring efforts

A list of possible refactoring efforts we can tackle:

  • add a type-safe definition of our custom properties with a StratosphericProperties class to define the properties like:
stratospheric:
  registration:
    invite-codes: ABC
  collaboration:
    auto-confirm: false
    sharing-queue:
    web-socket-relay-endpoint:
   ...

instead of

custom:
  invitation-codes: DUKE, HELLO_WORLD, STRATOSPHERIC # TODO: outsource them -> e.g. env variable or database
  sharing-queue: stratospheric-todo-sharing
  external-url: https://app.stratospheric.dev
  auto-confirm-collaborations: false
  breadcrumb-table-name: breadcrumbs

As some of these refactorings will change code examples and explanations in the book, we should organize such refactoring efforts and do them once the book is content-complete.

Make Github Actions configurable to support multiple environments (dev, staging, prod)

Currently, the cloudformation stacks are only created / updated on push to master.

To test changes in a cloudformation stack, we have to push to master.

Make the deployment scripts configurable so that we can add a name prefix or something, so that we can create the stacks from multiple branches. Each branch would then create its own stacks for testing.

cdk deploy fails

What's going wrong and not working?

for Chapter 5. Page 72 says we can run CDK deploy just with the required code but at the end, the command fails because it starts failing on Service.java (74), then. SpringBootApplicationStack.java(32) both of them from the stratospheric maven library. It seems it fails because on SpringBootApplicationStack.java line 26, the fifth argument building the Network.NetworkInputParameters() is using that empty constructor, which means we are not going to use SslCertifcateArn:

Caused by: java.util.NoSuchElementException: No value present
    at java.util.Optional.get (Optional.java:141)
    at dev.stratospheric.cdk.Service.<init> (Service.java:74)
    at dev.stratospheric.cdk.SpringBootApplicationStack.<init> (SpringBootApplicationStack.java:32)
    at com.myorg.MyCdkApp.main (MyCdkApp.java:29)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:832)

Line 29 form MyCdkApp.java is

 new SpringBootApplicationStack(
          app,
          "SpringBootApplication",
          makeEnv(accountId, region),        //line 29
          "docker.io/stratospheric/todo-app-v1:latest"
        );

Expected outcome

Cloudformation built from CDK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.