Skip to content

Commit f9c7c1c

Browse files
authored
fix the sample app deployment (#9)
* fix the deployment * fix the ci * fix terraform deployment * fix terraform deployment * fix terraform deployment * fix terraform deployment * fix frontend deployment
1 parent 1edbbe4 commit f9c7c1c

File tree

8 files changed

+65
-49
lines changed

8 files changed

+65
-49
lines changed

.github/workflows/ci.yml

+37-27
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '22'
2429

2530
- name: Setup Python
2631
uses: actions/setup-python@v4
2732
with:
28-
python-version: '3.9'
33+
python-version: '3.11'
2934

3035
- name: Set up JDK
3136
uses: actions/setup-java@v2
@@ -36,40 +41,45 @@ jobs:
3641
- name: Set up Maven
3742
run: sudo apt-get install -y maven
3843

39-
- name: Install localstack & awslocal
44+
- name: Start LocalStack
45+
uses: LocalStack/[email protected]
46+
with:
47+
image-tag: 'latest'
48+
use-pro: 'true'
49+
configuration: LS_LOG=trace
50+
install-awslocal: 'true'
51+
env:
52+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
53+
54+
- name: Install Terraform
55+
uses: hashicorp/setup-terraform@v3
56+
57+
- name: Install tflocal
4058
run: |
41-
pip install localstack
42-
pip install terraform-local
43-
pip install awscli-local
59+
pip install --upgrade terraform-local
4460
4561
- name: Build project
4662
run: |
4763
cd shipment-picture-lambda-validator
4864
mvn clean package shade:shade
4965
50-
- name: Start LocalStack
51-
run: |
52-
docker pull localstack/localstack:latest
53-
# Start LocalStack in the background
54-
LS_LOG=trace localstack start -d
55-
# Wait 30 seconds for the LocalStack container to become ready before timing out
56-
echo "Waiting for LocalStack startup..."
57-
localstack wait -t 15
58-
echo "Startup complete"
59-
60-
- name: Run Terraform Config File
66+
- name: Deploy using Terraform
6167
run: |
6268
cd terraform
63-
bash run-tflocal.sh
69+
tflocal init
70+
tflocal plan
71+
tflocal apply --auto-approve
72+
73+
- name: Build frontend
74+
run: |
75+
cd shipment-list-frontend
76+
npm install
77+
CI=false npm run build
6478
65-
- name: Check for Bucket
79+
- name: Show LocalStack logs
80+
if: always()
6681
run: |
67-
output=$(awslocal s3api list-buckets --query "Buckets[?contains(Name, 'shipment-picture-bucket')].Name" --output text)
68-
if [ -z "$output" ]; then
69-
echo "Created bucket not found."
70-
exit 1
71-
else echo "Bucket with random name was found: $output"
72-
fi
82+
localstack logs
7383
7484
- name: Send a Slack notification
7585
if: failure() || github.event_name != 'pull_request'
@@ -91,7 +101,7 @@ jobs:
91101
92102
- name: Upload the Diagnostic Report
93103
if: failure()
94-
uses: actions/upload-artifact@v3
104+
uses: actions/upload-artifact@v4
95105
with:
96106
name: diagnose.json.gz
97-
path: ./diagnose.json.gz
107+
path: ./diagnose.json.gz

.gitignore

+9-6
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ src/main/shipment-list-frontend/yarn-debug.log*
5757
src/main/shipment-list-frontend/yarn-error.log*
5858

5959
# terraform
60-
61-
setup/terraform/terraform.tfstate
62-
setup/terraform/.terraform.lock.hcl
63-
setup/terraform/terraform.tfstate.backup
60+
terraform/.terraform/
61+
terraform/terraform.tfstate
62+
terraform/.terraform.lock.hcl
63+
terraform/terraform.tfstate.backup
6464

6565
# lambda module
66-
/shipment-picture-lambda-validator/.idea
67-
/shipment-picture-lambda-validator/target/
66+
shipment-picture-lambda-validator/.idea
67+
shipment-picture-lambda-validator/target/
68+
69+
# frontend
70+
shipment-list-frontend/node_modules

shipment-list-frontend/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

shipment-picture-lambda-validator/pom.xml

+16-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<dependency>
5858
<groupId>org.projectlombok</groupId>
5959
<artifactId>lombok</artifactId>
60-
<version>1.18.22</version>
60+
<version>1.18.30</version>
6161
<scope>compile</scope>
6262
</dependency>
6363
</dependencies>
@@ -84,6 +84,20 @@
8484
</resources>
8585

8686
<plugins>
87+
<plugin>
88+
<groupId>org.apache.maven.plugins</groupId>
89+
<artifactId>maven-compiler-plugin</artifactId>
90+
<version>3.13.0</version>
91+
<configuration>
92+
<annotationProcessorPaths>
93+
<path>
94+
<groupId>org.projectlombok</groupId>
95+
<artifactId>lombok</artifactId>
96+
<version>1.18.30</version>
97+
</path>
98+
</annotationProcessorPaths>
99+
</configuration>
100+
</plugin>
87101
<plugin>
88102
<groupId>org.apache.maven.plugins</groupId>
89103
<artifactId>maven-shade-plugin</artifactId>
@@ -103,4 +117,4 @@
103117
</plugins>
104118
</build>
105119

106-
</project>
120+
</project>

src/main/resources/buckets.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
shipment-picture-bucket=shipment-picture-bucket-artistic-alpaca
2-
shipment-picture-bucket-validator=shipment-picture-lambda-validator-bucket-artistic-alpaca
1+
shipment-picture-bucket=shipment-picture-bucket-polite-ghoul
2+
shipment-picture-bucket-validator=shipment-picture-lambda-validator-bucket-polite-ghoul

terraform/cleanup.sh

-4
This file was deleted.

terraform/main.tf

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
terraform {
22
required_providers {
3-
aws = {
4-
source = "hashicorp/aws"
5-
version = "~> 5.59.0"
6-
}
7-
83
random = {
94
source = "hashicorp/random"
105
version = "~> 3.6.2"

terraform/run-tflocal.sh

-3
This file was deleted.

0 commit comments

Comments
 (0)