Skip to content

Commit 985b676

Browse files
author
AncaGhenade
committed
change scripts to be run individually in case of failure + enhance README.md
1 parent 94ae3b4 commit 985b676

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,43 +46,62 @@ files,
4646

4747
## Running it
4848

49-
### Production simulation
49+
## Production simulation
5050

5151
Now we don’t have a real production environment because that’s not the point here, but most likely,
5252
an application like this runs on a container orchestration platform, and all the necessary configs
5353
are still provided. Since we’re only simulating a production instance, all the configurations are
5454
kept in the `application-prod.yml` file.
5555

56+
### User credentials
57+
5658
Before getting started, it's important to note that an IAM user, who's credentials will be used,
5759
needs to be created with the following policies:
5860

5961
- AmazonS3FullAccess
6062
- AWSLambda_FullAccess
6163
- AmazonDynamoDBFullAccess
6264

65+
### Creating the picture bucket
66+
6367
The `scripts/new-bucket.sh` script will create the necessary S3 resource.
6468

69+
### Creating the DynamoDB table
70+
71+
6572
At startup @dynamobee helps set up the table we need and populate it with some sample data.
6673
@dynamobee is library for tracking, managing, and applying database changes
6774
The changelog acts as a database version control. It tracks all the changes made to the database,
6875
and helps you manage database migration.
6976

77+
### Running the central backend service
78+
7079
To run the backend simply use
7180

7281
```
7382
mvn spring-boot:run -Dspring-boot.run.profiles=prod
7483
```
7584

85+
### Running the GUI
86+
7687
Now `cd` into `src/main/shipment-list-frontend` and run `npm install` and `npm start`.
7788
This will spin up the React app that can be accessed on `localhost:3000`.
7889

90+
### Using the application
91+
7992
You should now be able to see a list of shipments with standard icons, that means that only the
8093
database
8194
is populated, the pictures still need to be added from the `sample-pictures` folder.
8295
The weight of a shipment we can perceive, but not the size, that's why we need to display it,
8396
using the "banana for scale" measuring unit. How else would we know??
8497

85-
The Lambda function is still not up. This falls under the `shipment-list-lambda-validator` project.
98+
Current available actions using the GUI:
99+
- upload a new image
100+
- delete shipment from the list
101+
102+
### Running the Lambda function
103+
104+
The Lambda function is still not there. This falls under the `shipment-list-lambda-validator` project.
86105

87106
```
88107
git clone https://github.com/tinyg210/shipment-list-lambda-validator.git
@@ -101,22 +120,23 @@ You should now be able to add a new picture for each shipment. Files that are no
101120
deleted
102121
and the shipment picture will be replaced with a generic icon.
103122

104-
### Developer environment
123+
## Developer environment
105124

106125
To switch to using LocalStack instead of AWS services just run `docker compose up` to spin up a
107126
Localstack
108127
container.
109-
After that, the Spring Boot application needs to start using the dev profile:
128+
After that, the Spring Boot application needs to start using the dev profile (ideally stop the previous instance):
110129

111130
```
112131
mvn spring-boot:run -Dspring-boot.run.profiles=dev
113132
```
114133

115134
This should again populate the DynamoDB, this time on LocalStack.
116135
From here on, the rest of the steps are the same, but all the scripts that need to run end
117-
in `-local`,
136+
in the `-local` suffix,
118137
as they use the `awslocal` CLI.
119138

120139
The same actions should be easily achieved again, but locally.
121140

122141

142+

scripts/new-bucket-local.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/bin/bash
22

3-
# Set the name of the S3 bucket
4-
bucket_name="shipment-list-demo-bucket"
5-
aws_region="eu-central-1"
6-
73
# Create the S3 bucket
8-
awslocal s3api create-bucket --bucket $bucket_name
4+
awslocal s3api create-bucket --bucket shipment-list-demo-bucket

scripts/new-bucket.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
# Access key and secret key are set by using `aws configure`
55
# to manage the aws cli on your local machine
66

7-
# Set the name of the S3 bucket
8-
bucket_name="shipment-list-demo-bucket"
9-
aws_region="eu-central-1"
107

118
# Create the S3 bucket and set the region
12-
aws s3api create-bucket --bucket $bucket_name --region eu-central-1 \
9+
aws s3api create-bucket --bucket shipment-list-demo-bucket --region eu-central-1 \
1310
--create-bucket-configuration LocationConstraint=eu-central-1
1411

1512
# Set the bucket policy
16-
aws s3api put-bucket-acl --bucket $bucket_name --acl private
13+
aws s3api put-bucket-acl --bucket shipment-list-demo-bucket --acl private

0 commit comments

Comments
 (0)