Skip to content

Commit

Permalink
Renaming some modules
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadto committed Mar 24, 2024
1 parent e0631fa commit c241cb7
Show file tree
Hide file tree
Showing 50 changed files with 1,147 additions and 1,625 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ README.md

settings-spring.xml

spring-native-aws-lambda-infra
spring-native-aws-service-infra
docker-compose.yml
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
ENV: ${{ env.ENV }}
COST_CENTRE: ${{ env.COST_CENTRE }}
run: |
./mvnw -ntp clean verify -DskipTests -pl spring-native-aws-lambda-infra
./mvnw -ntp clean -Pnative -DskipTests native:compile package -pl spring-native-aws-lambda-function
./mvnw -ntp clean verify -DskipTests -pl spring-native-aws-service-infra
./mvnw -ntp clean -Pnative -DskipTests native:compile package -pl spring-native-aws-service
- name: cdk diff
uses: muhamadto/aws-cdk-github-actions@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Apache [spring-native-aws-lambda-function]
Apache [spring-native-aws-function]
Copyright 2021 Muhammad Hamadto

This product includes software developed by:
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# spring-native-aws-lambda
# spring-native-aws-function

[![CodeQL](https://github.com/muhamadto/spring-native-aws-lambda/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/muhamadto/spring-native-aws-lambda/actions/workflows/codeql-analysis.yml)
[![Build](https://github.com/muhamadto/spring-native-aws-lambda/actions/workflows/build.yml/badge.svg)](https://github.com/muhamadto/spring-native-aws-lambda/actions/workflows/build.yml)
Expand Down Expand Up @@ -56,8 +56,8 @@ $ ./mvnw -ntp clean verify -U
1. Run the following commands
```shell
$ export SPRING_PROFILES_ACTIVE=local
$ ./mvnw -ntp clean -Pnative -DskipTests native:compile package -pl spring-native-aws-lambda-function
$ ./spring-native-aws-lambda-function/target/spring-native-aws-lambda-function
$ ./mvnw -ntp clean -DskipTests -Pnative native:compile package -pl spring-native-aws-service
$ ./spring-native-aws-service/target/spring-native-aws-service
```
The service starts in less than 100 ms
```shell
Expand Down Expand Up @@ -134,7 +134,7 @@ and the following trust relationship
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
},
"StringLike": {
"token.actions.githubusercontent.com:sub": "repo:{github-account-or-org}/spring-native-aws-lambda:*"
"token.actions.githubusercontent.com:sub": "repo:{github-account-or-org}/spring-native-aws-service:*"
}
}
}
Expand Down Expand Up @@ -259,7 +259,7 @@ and the following trust relationship
"SNS:UntagResource"
],
"Resource": [
"arn:aws:sns:{aws-region}:{aws-account-number}:spring-native-aws-lambda-function-dead-letter-topic"
"arn:aws:sns:{aws-region}:{aws-account-number}:spring-native-aws-function-dead-letter-topic"
]
},
{
Expand All @@ -281,8 +281,8 @@ and the following trust relationship
"lambda:UpdateFunctionConfiguration"
],
"Resource": [
"arn:aws:lambda:{aws-region}:{aws-account-number}:function:spring-native-aws-lambda-function",
"arn:aws:lambda:{aws-region}:{aws-account-number}:function:spring-native-aws-lambda-function:$LATEST"
"arn:aws:lambda:{aws-region}:{aws-account-number}:function:spring-native-aws-function",
"arn:aws:lambda:{aws-region}:{aws-account-number}:function:spring-native-aws-function:$LATEST"
]
},
{
Expand Down Expand Up @@ -310,9 +310,9 @@ and the following trust relationship
"iam:DetachRolePolicy"
],
"Resource": [
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-lambda-springnativeawslambdafun-*",
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-lambda-springnativeawslambdares-4FVJBBHF9EL2",
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-lambda-function-rest-api/CloudWatchRole"
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-service-springnativeawslambdafun-*",
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-service-springnativeawslambdares-4FVJBBHF9EL2",
"arn:aws:iam::{aws-account-number}:role/spring-native-aws-function-rest-api/CloudWatchRole"
]
},
{
Expand Down Expand Up @@ -346,7 +346,7 @@ in step 4
Now that the setup is done you can deploy to AWS.

1. Create a new release in
Github [releases page](https://github.com/muhamadto/spring-native-aws-lambda/releases),
Github [releases page](https://github.com/muhamadto/spring-native-aws-service/releases),
the [github action](.github/workflows/release.yml) will start and a deployment to AWS
environment.
2. Test via curl
Expand Down
2 changes: 1 addition & 1 deletion cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "./mvnw exec:java -pl spring-native-aws-lambda-infra -Dexec.mainClass=com.coffeebeans.springnativeawslambda.infra.Application"
"app": "./mvnw exec:java -pl spring-native-aws-service-infra -Dexec.mainClass=com.coffeebeans.springnativeawslambda.infra.Application"
}
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

version: "3.9"
services:
spring-native-aws-lambda-function-infra:
image: muhamadto/spring-native-amazonlinux2-builder:21-amazonlinux2-awscliv2
spring-native-aws-function-infra:
image: ghcr.io/muhamadto/spring-native-amazonlinux2-builder:21-amazonlinux2-awscliv2
volumes:
- ./:/app
- ${M2_REPO}:/home/worker/.m2
Expand All @@ -29,7 +29,9 @@ services:
AWS_SECRET_ACCESS_KEY: local
AWS_ENDPOINT_URL: http://localstack:4566
BUILD_ARTIFACT: 'true'
FUNCTION_NAME: spring-native-aws-lambda-function
FUNCTION_NAME: spring-native-aws-service
SPRING_MAIN_WEBAPPLICATIONTYPE: servlet
SPRING_CLOULD_AWS_DYNAMODB_ENDPOINT: http://localstack:4566
STAGE: compose
MAVEN_OPTS: |
-DskipTests=true
Expand All @@ -45,7 +47,7 @@ services:
- -c
command: |
'
function package_spring_native_lambda() {
function package_spring_native_function() {
if [ "$$BUILD_ARTIFACT" = "true" ]; then
./mvnw -ntp clean -Pnative -DskipTests native:compile package -pl "$$FUNCTION_NAME"
else
Expand All @@ -61,7 +63,7 @@ services:
print_info_message "divider" "Package GraalVM function" &&
package_spring_native_lambda &&
package_spring_native_function &&
print_info_message "divider" "Creating LAMBDA function" &&
lambda_create_function "$$FUNCTION_NAME" provided.al2023 512 ./"$$FUNCTION_NAME"/target/"$$FUNCTION_NAME"-native-zip.zip "$$FUNCTION_NAME" &&
Expand Down
41 changes: 34 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
<name>${project.artifactId}</name>
<version>${revision}</version>
<packaging>pom</packaging>
<description>Demo project for Spring cloud function with graalvm native image deployed with cdk
</description>
<description>Demo project for Spring cloud function with graalvm native image deployed with cdk</description>

<developers>
<developer>
Expand Down Expand Up @@ -79,26 +78,47 @@
</properties>

<modules>
<module>spring-native-aws-lambda-function</module>
<module>spring-native-aws-lambda-infra</module>
<module>spring-native-aws-service</module>
<module>spring-native-aws-service-infra</module>
</modules>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-dependencies</artifactId>
<version>3.1.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- SPRING-NATIVE-AWS-LAMBDA -->
<dependency>
<groupId>com.coffeebeans</groupId>
<artifactId>spring-native-aws-lambda-function</artifactId>
<artifactId>spring-native-aws-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coffeebeans</groupId>
<artifactId>spring-native-aws-lambda-infra</artifactId>
<artifactId>spring-native-aws-service-infra</artifactId>
<version>${project.version}</version>
</dependency>

<!-- SPRING-NATIVE-AWS-LAMBDA ENDS -->

<dependency>
<groupId>com.coffeebeans</groupId>
<artifactId>coffeebeans-cdk-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.coffeebeans</groupId>
<artifactId>coffeebeans-cdk-assertions</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<!-- AWS -->
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down Expand Up @@ -187,7 +207,7 @@
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>aws-cdk-lib</artifactId>
<version>2.116.1</version>
<version>2.128.0</version>
</dependency>
<!-- AWS CDK ENDS -->

Expand All @@ -213,6 +233,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down

This file was deleted.

Loading

0 comments on commit c241cb7

Please sign in to comment.