33<img src="https://img.shields.io/badge/LocalStack-deploys-4D29B4.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAKgAAACoABZrFArwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALbSURBVHic7ZpNaxNRFIafczNTGIq0G2M7pXWRlRv3Lusf8AMFEQT3guDWhX9BcC/uFAr1B4igLgSF4EYDtsuQ3M5GYrTaj3Tmui2SpMnM3PlK3m1uzjnPw8xw50MoaNrttl+r1e4CNRv1jTG/+v3+c8dG8TSilHoAPLZVX0RYWlraUbYaJI2IuLZ7KKUWCisgq8wF5D1A3rF+EQyCYPHo6Ghh3BrP8wb1en3f9izDYlVAp9O5EkXRB8dxxl7QBoNBpLW+7fv+a5vzDIvVU0BELhpjJrmaK2NMw+YsIxunUaTZbLrdbveZ1vpmGvWyTOJToNlsuqurq1vAdWPMeSDzwzhJEh0Bp+FTmifzxBZQBXiIKaAq8BBDQJXgYUoBVYOHKQRUER4mFFBVeJhAQJXh4QwBVYeHMQJmAR5GCJgVeBgiYJbg4T8BswYPp+4GW63WwvLy8hZwLcd5TudvBj3+OFBIeA4PD596nvc1iiIrD21qtdr+ysrKR8cY42itCwUP0Gg0+sC27T5qb2/vMunB/0ipTmZxfN//orW+BCwmrGV6vd63BP9P2j9WxGbxbrd7B3g14fLfwFsROUlzBmNM33XdR6Meuxfp5eg54IYxJvXCx8fHL4F3w36blTdDI4/0WREwMnMBeQ+Qd+YC8h4g78wF5D1A3rEqwBiT6q4ubpRSI+ewuhP0PO/NwcHBExHJZZ8PICI/e73ep7z6zzNPwWP1djhuOp3OfRG5kLROFEXv19fXP49bU6TbYQDa7XZDRF6kUUtEtoFb49YUbh/gOM7YbwqnyG4URQ/PWlQ4ASllNwzDzY2NDX3WwioKmBgeqidgKnioloCp4aE6AmLBQzUExIaH8gtIBA/lFrCTFB7KK2AnDMOrSeGhnAJSg4fyCUgVHsolIHV4KI8AK/BQDgHW4KH4AqzCQwEfiIRheKKUAvjuuu7m2tpakPdMmcYYI1rre0EQ1LPo9w82qyNziMdZ3AAAAABJRU5ErkJggg=="> <img src="https://img.shields.io/badge/AWS-deploys-F29100.svg?logo=amazon">
44
55### Prerequisites
6+ ** This demo was conceived and ran on macOS Catalina version 10.15.7. Other operating systems might
7+ need slight variations in using command line tools.
68
79- Maven 3.8.5 & Java 17
810- AWS free tier account
911- Docker - for running LocalStack
10- - AWS Command Line Interface - for managing your services
12+ - Terraform for creating AWS & LocalStack resources
1113- npm - for running the frontend app
1214
1315## Purpose
@@ -37,18 +39,19 @@ The AWS services involved are:
3739## How we will be using it
3840
3941We’ll be walking through a few scenarios using the application, and we expect it to maintain the
40- behavior in both production and development environments.
42+ behavior in both production and development environments. This behaviour can be "scientifically" backed up
43+ by adding integration tests.
44+
4145We’ll take advantage of one of the core features of the Spring framework that allows us to bind our
4246beans to different profiles, such as dev, test, and prod. Of course, these beans need to know how to
4347behave in each environment, so they’ll get that information from their designated configuration
44- files,
45- ` application-prod.yml ` , and ` application-dev.yml ` .
48+ files, ` application-prod.yml ` , and ` application-dev.yml ` .
4649
4750## Running it
4851
4952### Production simulation
5053
51- Now we don’t have a real production environment because that’s not the point here, but most likely,
54+ Now, we don’t have a real production environment because that’s not the point here, but most likely,
5255an application like this runs on a container orchestration platform, and all the necessary configs
5356are still provided. Since we’re only simulating a production instance, all the configurations are
5457kept in the ` application-prod.yml ` file.
@@ -60,28 +63,46 @@ needs to be created with the following policies:
6063- AWSLambda_FullAccess
6164- AmazonDynamoDBFullAccess
6265
63- The ` scripts/new-bucket.sh ` script will create the necessary S3 resource.
66+ We will be using the user's credentials and export them as temporary environment variable with the
67+ ` export ` (` set ` on Windows) command:
68+ ```
69+ export AWS_ACCESS_KEY_ID=[your_aws_access_key_id]
70+ export AWS_SECRET_ACCESS_KEY=[your_aws_secret_access_key_id]
71+ ```
72+ Make sure you have Terraform [ installed] ( https://developer.hashicorp.com/terraform/downloads ) .
73+ Under setup/terraform run:
74+ ```
75+ terraform init
76+ terraform plan
77+ ```
78+ once these 2 commands run successfully and no errors occur, it's time to run:
79+ ```
80+ terraform apply --auto-approve
81+ ```
6482
65- At startup @dynamobee helps set up the table we need and populate it with some sample data.
66- @dynamobee is library for tracking, managing, and applying database changes
67- The changelog acts as a database version control. It tracks all the changes made to the database,
68- and helps you manage database migration.
83+ This should create the needed S3 bucket, the DynamoDB ` shipment ` table and populate it with some sample data.
6984
70- To run the backend simply use
85+ Now ` cd ` into ` src/main/shipment-list-frontend ` and run ` npm install ` and ` npm start ` .
86+ This will spin up the React app that can be accessed on ` localhost:3000 ` .
87+
88+ For running it on Windows, there are some
89+ [ extra requirements] ( https://learn.microsoft.com/en-us/windows/dev-environment/javascript/react-on-windows ) ,
90+ but no worries, it should be straightforward.
91+
92+ Go back to the root folder and run the backend simply by using
7193
7294```
7395mvn spring-boot:run -Dspring-boot.run.profiles=prod
7496```
97+ Notice the ` prod ` profile is being set via command line arguments.
7598
76- Now ` cd ` into ` src/main/shipment-list-frontend ` and run ` npm install ` and ` npm start ` .
77- This will spin up the React app that can be accessed on ` localhost:3000 ` .
78-
79- You should now be able to see a list of shipments with standard icons, that means that only the
80- database
81- is populated, the pictures still need to be added from the ` sample-pictures ` folder.
82- The weight of a shipment we can perceive, but not the size, that's why we need to display it,
99+ At ` localhost:3000 ` you should now be able to see a list of shipments with standard icons,
100+ that means that only the database is populated, the pictures still need to be added from the
101+ ` sample-pictures ` folder.
102+ The weight of a shipment we can perceive, but not the size, that's why we need pictures to understand,
83103using the "banana for scale" measuring unit. How else would we know??
84104
105+
85106The Lambda function is still not up. This falls under the ` shipment-list-lambda-validator ` project.
86107
87108```
0 commit comments