Skip to content

Commit

Permalink
feat : implement of aws-lamda using spring cloud (#550)
Browse files Browse the repository at this point in the history
* feat : initial commit of aws-lamda

* fix permission issue

* fix : pipeline fix

* feat : add docker compose file and properties

* polish

* fixes: junit failure

* rename project
  • Loading branch information
rajadilipkolli authored Nov 22, 2023
1 parent f8fb655 commit 4f09123
Show file tree
Hide file tree
Showing 13 changed files with 952 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/aws-lamda-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: aws-lambda-project

on:
push:
paths:
- "aws-lambda-project/**"
branches: [main]
pull_request:
paths:
- "aws-lambda-project/**"
types:
- opened
- synchronize
- reopened

jobs:
build:
name: Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: "aws-lambda-project"
strategy:
matrix:
distribution: [ 'temurin' ]
java: [ '17' ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: ${{ matrix.distribution }}
cache: 'maven'

- name: Build with Maven
run: ./mvnw clean verify

- if: ${{ github.ref == 'refs/heads/main' }}
name: Build and Publish Docker Image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=${{ secrets.DOCKER_USERNAME }}/aws-lambda-project-${{ matrix.java }}
docker push ${{ secrets.DOCKER_USERNAME }}/aws-lambda-project-${{ matrix.java }}
Binary file added aws-lambda-project/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions aws-lambda-project/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
18 changes: 18 additions & 0 deletions aws-lambda-project/docker/docker-compose-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3.8'
services:

aws-sqs-project:
build: ..
ports:
- "18080:8080"
- "18787:8787"
restart: always
depends_on:
- postgresqldb
- localstack
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgresqldb:5432/appdb
- SPRING_DATASOURCE_USERNAME=siva
- SPRING_DATASOURCE_PASSWORD=secret
25 changes: 25 additions & 0 deletions aws-lambda-project/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'
services:

postgresqldb:
image: postgres:16.1-alpine
environment:
- POSTGRES_USER=appuser
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=appdb
ports:
- "5432:5432"

localstack:
image: localstack/localstack:3.0.0
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DEBUG=${DEBUG-}
- DOCKER_HOST=unix:///var/run/docker.sock
- SERVICES=lambda
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
- "../.localstack:/etc/localstack/init/ready.d" # ready hook
Loading

0 comments on commit 4f09123

Please sign in to comment.