Skip to content

This application is made as a DEMO to illustrate the use of localstack as a possible way to efficiently learn how the AWS ecosystem works

License

Notifications You must be signed in to change notification settings

jesperancinha/staco-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StaCo - A Stamps and Coins application


Generic badge GitHub release

CircleCI staco-app e2e-staco-app

Codacy Badge

Codacy Badge codecov Coverage Status

GitHub language count GitHub top language GitHub top language


Technologies used

Please check the TechStack.md file for details.

Introduction

This repo is the official support repo to my article on medium:

Stable releases

Project Layout

Article related
  • Stamps and Coins Demo - Module used to create Demo data. It sends Coin and Stamps images and it can generate the initial data
  • Stamps and Coins Common - Contains common libraries, namely, Data Transfer Objects, Domain model
  • Stamps and Coins Common Cloud - Contains common libraries for the cloud projects.
  • Stamps and Coins Batch - Spring batch Quartz based Jobs. They dump the data from PostgreSQL to a file and ship it to S3. Another Job retrieves the data, unpacks it and sends it to DynamoDB.
  • Stamps and Coins Service - This is our starting point. It contains a Reactive Application which uses PostgreSQL using R2DBC repos on coroutines
  • Stamps and Coins Local Stack Service - This application serves data in the same way as the above except that it connects to DynamoDB. All Localstack implementations are manual
  • Stamps and Coins Web - Front End Application to explore the different implementations. Pagination is implemented
External to article
  • Stamps and Coins Cloud Server - Uses automated configuration and tries to use Localstack as much as possible.
  • Stamps and Coins Blocking Service - The initial application that started this project back in April 2021. It is now a login authentication/authorization security exploration module, which contains implementations of BASIC Auth, OAUTH2 local Auth and OAUTH with GitHub.

Setup environment

Be sure to have Docker installed

Install sdk7

Be sure to have SDK-MAN installed for this to work. You can choose another way. It is only important to have JDK17 installed to have this working.

. ./sdk17.sh

K8s

. ./bash/k8s-setup.sh 

Docker

. ./bash/docker-setup.sh

How to run

Running all automatically

make docker-clean-build-start

These containers take a while to start, so depending on your machine, the containers can start in anywhere between 10 seconds up to 5 minutes. Keep checking the logs with docker logs or docker-compose logs.

Sequence diagram

To visualize these diagrams you may need the mermaid-diagrams plugin installation.

To visualize them in Intellij, please install the mermaid plugin.

Old Sketch

sequenceDiagram
    participant User
    participant StaCo App
    participant StaCo Service
    participant PostgreSQL Database
    
    rect rgb(200,200,200)
    
    User->>StaCo App: User logs into application
    StaCo App->>StaCo Service: A list of coins and stamps is requested by filter
    StaCo Service->>PostgreSQL Database: Data is fetched via the filter
    PostgreSQL Database ->>StaCo Service: Data is returned
    StaCo Service->>StaCo App: Minimal data manipulation and return
    StaCo App->>User: Results given to the User
    
    end
Loading

Current Sequence Diagram

sequenceDiagram
    participant Web
    participant Reactive Service
    participant Localstack Reactive Service
    participant Batch
    participant Blocking Service
    participant Cloud Service
    participant PostgreSQL Database
    participant S3
    participant DynamoDB
    participant SSM
    
    rect rgb(200,200,200)
    
    Web->>Reactive Service: User logs into application
    Web->>Blocking Service: User logs into application
    Web->>Blocking Service: User asks data from application
    Reactive Service->>PostgreSQL Database: Request Data
    PostgreSQL Database->>Reactive Service: Returns Data
    Reactive Service->>Web: Returns Data
    Web->>Localstack Reactive Service: User asks data from application
    Localstack Reactive Service->>DynamoDB: Requests Data
    DynamoDB->>Localstack Reactive Service: Sends data back
    Localstack Reactive Service->>Web: Sends data back
    Batch->>PostgreSQL Database: Requests Data
    PostgreSQL Database->>Batch: Sends Data Back
    Batch->>Batch: Processes data and creates CSV
    Batch->>S3: Sends GZ file
    Batch->>S3: Asks for data
    S3->>Batch: Sends GZ file back
    Batch->>Batch: Uncompresses file
    Batch->>DynamoDB: Saves data in data base
    Reactive Service->>SSM: Startup
    SSM->>Reactive Service: Configuration Data
    Localstack Reactive Service->>SSM: Startup
    SSM->>Localstack Reactive Service: Configuration Data
    Batch->>SSM: Startup
    SSM->>Batch: Configuration Data
    Cloud Service->>SSM: Startup
    SSM->>Cloud Service: Configuration Data
    end
Loading

Walk through

Demo

To make it easy for you, I've created a few scripts to run this demo in a seamless way.

The most important script however, is the demo-full-manual.

If you run:

make demo-full-manual

Then just wait until it completes. The cypress pop-up will appear. You can then start the tests manually and see how this application works!

Swagger tests

You can make tests for this application using the Swagger UI at:

Stamps and Coins LocalStack Service
Stamps and Coins Reactive Service

References

Videos

Online

About me

GitHub followers