Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa6765 committed May 25, 2024
1 parent 37234b3 commit d83d239
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 14 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/sls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches:
- master
workflow_dispatch:
# This allows the workflow to be manually triggered

name: Deploy master branch

jobs:
deploy:
name: deploy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Deployment of your project
- name: serverless deploy
uses: suprgames/[email protected]
with:
command: deploy
args: -v
env:
# To link with your Serverless Framework account, equivalent to login
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
# The AWS Credentials
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4 changes: 2 additions & 2 deletions fastapi_project/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def create_application():
if load_sql_project == True:
print("SQL_PROJECT is enabled")
# Include additional routers if LOAD_SQL_PROJECT is enabled
from fastapi_project.api.v1 import user
application.include_router(user.router)
# from fastapi_project.api.v1 import user
# application.include_router(user.router)

# Add CORS middleware
# In production, replace the "*" with the actual frontend URL
Expand Down
4 changes: 0 additions & 4 deletions lambda_handler.py

This file was deleted.

6 changes: 6 additions & 0 deletions lamda_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from mangum import Mangum
from fastapi_project.main import app

handler = Mangum(app)


3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fastapi
python-dotenv
sqlalchemy
psycopg2-binary
fastapi
uvicorn
mangum
15 changes: 8 additions & 7 deletions serverless.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
org: kintaro
app: demo-app-api
service: demo-app-api
org: code4mk
app: demo-app-api-fastapi
service: demo-app-api-fastapi

frameworkVersion: '3'

plugins:
- serverless-python-requirements
- serverless-wsgi
provider:
name: aws
runtime: python3.9
region: us-west-2
runtime: python3.11
region: us-east-1

functions:
demo_app_fastapi:
handler: lambda_handler.handler
handler: lamda_handler.handler
events:
- http:
path: /{proxy+}
method: any

0 comments on commit d83d239

Please sign in to comment.