Skip to content

Commit 94f909e

Browse files
author
AncaGhenade
committed
update README.md
1 parent b2fb2ac commit 94f909e

File tree

1 file changed

+40
-21
lines changed

1 file changed

+40
-21
lines changed

README.md

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
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.
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.
88

99
- Maven 3.8.5 & Java 17
1010
- AWS free tier account
@@ -66,38 +66,38 @@ needs to be created with the following policies:
6666
We will be using the user's credentials and export them as temporary environment variable with the
6767
`export` (`set` on Windows) command:
6868
```
69-
export AWS_ACCESS_KEY_ID=[your_aws_access_key_id]
70-
export AWS_SECRET_ACCESS_KEY=[your_aws_secret_access_key_id]
69+
$ export AWS_ACCESS_KEY_ID=[your_aws_access_key_id]
70+
$ export AWS_SECRET_ACCESS_KEY=[your_aws_secret_access_key_id]
7171
```
7272
Make sure you have Terraform [installed](https://developer.hashicorp.com/terraform/downloads).
7373
Under setup/terraform run:
7474
```
75-
terraform init
76-
terraform plan
75+
$ terraform init
76+
$ terraform plan
7777
```
7878
once these 2 commands run successfully and no errors occur, it's time to run:
7979
```
80-
terraform apply --auto-approve
80+
$ terraform apply --auto-approve
8181
```
8282

8383
This should create the needed S3 bucket, the DynamoDB `shipment` table and populate it with some sample data.
8484

8585
Now `cd` into `src/main/shipment-list-frontend` and run `npm install` and `npm start`.
8686
This will spin up the React app that can be accessed on `localhost:3000`.
8787

88-
For running it on Windows, there are some
88+
For running it on Windows, there are some
8989
[extra requirements](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/react-on-windows),
9090
but no worries, it should be straightforward.
9191

9292
Go back to the root folder and run the backend simply by using
9393

9494
```
95-
mvn spring-boot:run -Dspring-boot.run.profiles=prod
95+
$ mvn spring-boot:run -Dspring-boot.run.profiles=prod
9696
```
9797
Notice the `prod` profile is being set via command line arguments.
9898

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
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
101101
`sample-pictures` folder.
102102
The weight of a shipment we can perceive, but not the size, that's why we need pictures to understand,
103103
using the "banana for scale" measuring unit. How else would we know??
@@ -106,7 +106,7 @@ using the "banana for scale" measuring unit. How else would we know??
106106
The Lambda function is still not up. This falls under the `shipment-list-lambda-validator` project.
107107

108108
```
109-
git clone https://github.com/tinyg210/shipment-list-lambda-validator.git
109+
$ git clone https://github.com/tinyg210/shipment-list-lambda-validator.git
110110
```
111111

112112
The `create-lambda.sh` script will do everything that needs for the creation and configuration of
@@ -124,19 +124,38 @@ and the shipment picture will be replaced with a generic icon.
124124

125125
### Developer environment
126126

127-
To switch to using LocalStack instead of AWS services just run `docker compose up` to spin up a
128-
Localstack
129-
container.
130-
After that, the Spring Boot application needs to start using the dev profile:
131127

128+
To switch to using LocalStack instead of AWS services just run `docker compose up` in the root folder
129+
to spin up a Localstack container.
130+
131+
To generate the exact same resources on LocalStack, we need `tflocal`, a thin wrapper script around
132+
the terraform command line client. `tflocal` takes care of automatically configuring the local service
133+
endpoints, which allows you to easily deploy your unmodified Terraform scripts against LocalStack.
134+
135+
You can [install](https://docs.localstack.cloud/user-guide/integrations/terraform/) the `tflocal`
136+
command via pip (requires a local Python installation):
137+
```
138+
$ pip install terraform-local
139+
```
140+
Once installed, the `tflocal` command should be available, with the same interface as the terraform
141+
command line. Try it out:
142+
```
143+
$ tflocal --help
144+
Usage: terraform [global options] <subcommand> [args]
145+
...
132146
```
133-
mvn spring-boot:run -Dspring-boot.run.profiles=dev
147+
From here on, it's the same as before:
134148
```
149+
$ terraform plan
150+
$ terraform apply --auto-approve
151+
```
152+
153+
154+
After that, the Spring Boot application needs to start using the dev profile:
135155

136-
This should again populate the DynamoDB, this time on LocalStack.
137-
From here on, the rest of the steps are the same, but all the scripts that need to run end
138-
in `-local`,
139-
as they use the `awslocal` CLI.
156+
```
157+
$ mvn spring-boot:run -Dspring-boot.run.profiles=dev
158+
```
140159

141160
The same actions should be easily achieved again, but locally.
142161

0 commit comments

Comments
 (0)