Skip to content

Commit d83d239

Browse files
committed
workflow
1 parent 37234b3 commit d83d239

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

.github/workflows/sls.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
workflow_dispatch:
6+
# This allows the workflow to be manually triggered
7+
8+
name: Deploy master branch
9+
10+
jobs:
11+
deploy:
12+
name: deploy
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
# Deployment of your project
19+
- name: serverless deploy
20+
uses: suprgames/[email protected]
21+
with:
22+
command: deploy
23+
args: -v
24+
env:
25+
# To link with your Serverless Framework account, equivalent to login
26+
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
27+
# The AWS Credentials
28+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
29+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

fastapi_project/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def create_application():
2121
if load_sql_project == True:
2222
print("SQL_PROJECT is enabled")
2323
# Include additional routers if LOAD_SQL_PROJECT is enabled
24-
from fastapi_project.api.v1 import user
25-
application.include_router(user.router)
24+
# from fastapi_project.api.v1 import user
25+
# application.include_router(user.router)
2626

2727
# Add CORS middleware
2828
# In production, replace the "*" with the actual frontend URL

lambda_handler.py

-4
This file was deleted.

lamda_handler.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from mangum import Mangum
2+
from fastapi_project.main import app
3+
4+
handler = Mangum(app)
5+
6+

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
fastapi
21
python-dotenv
32
sqlalchemy
43
psycopg2-binary
4+
fastapi
5+
uvicorn
56
mangum

serverless.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
org: kintaro
2-
app: demo-app-api
3-
service: demo-app-api
1+
org: code4mk
2+
app: demo-app-api-fastapi
3+
service: demo-app-api-fastapi
44

55
frameworkVersion: '3'
66

77
plugins:
88
- serverless-python-requirements
9+
- serverless-wsgi
910
provider:
1011
name: aws
11-
runtime: python3.9
12-
region: us-west-2
12+
runtime: python3.11
13+
region: us-east-1
1314

1415
functions:
1516
demo_app_fastapi:
16-
handler: lambda_handler.handler
17+
handler: lamda_handler.handler
1718
events:
1819
- http:
1920
path: /{proxy+}
2021
method: any
21-
22+

0 commit comments

Comments
 (0)