-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unified stack, custom step, container works again
- Loading branch information
Showing
8 changed files
with
478 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.venv/ | ||
.aws-sam/ | ||
.aws-sam/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
version = 0.1 | ||
[dev.deploy.parameters] | ||
stack_name = "anyscale5-dev" | ||
stack_name = "anyscale8-dev" | ||
resolve_s3 = true | ||
s3_prefix = "sam-app" | ||
region = "us-east-1" | ||
capabilities = "CAPABILITY_IAM" | ||
rollback_on_failure = false | ||
parameter_overrides = [ | ||
"paramDomainName=lambda-or-alb5.cloud.okulist.net", | ||
"paramHostedZoneId=Z00976901X2BWQNUQ03E3" | ||
"paramDomainName=lambda-or-anyscale8.cloud.okulist.net", | ||
"paramHostedZoneId=Z00976901X2BWQNUQ03E3", | ||
"paramWithFargate=yes", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
import logging | ||
import os | ||
|
||
from fastapi import FastAPI | ||
from mangum import Mangum | ||
|
||
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) | ||
|
||
logger.info('Loading function') | ||
logger.info('Loading function........') | ||
|
||
|
||
app = FastAPI() | ||
|
||
handler = Mangum(app) | ||
|
||
|
||
@app.get("/asf") | ||
def read_root(): | ||
return {"Hello": "World"} | ||
|
||
handler = Mangum(app) | ||
|
||
logger.info('Loading function complete') | ||
|
||
if __name__ == "__main__": | ||
logger.info('processing __main__ condition') | ||
# if 'LAMBDA_TASK_ROOT' not in os.environ: | ||
logger.info('LAMBDA_TASK_ROOT in os.environ') | ||
import uvicorn | ||
uvicorn.run(app, host="0.0.0.0", port=8080) | ||
|
||
logger.info('Loading function complete') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# set | ||
|
||
# Check if we are running in the AWS Lambda environment according to whether FUNCTION_TASK_ROOT is set. | ||
if [ -n "$FUNCTION_TASK_ROOT" ]; then | ||
# Start the Lambda function handler | ||
exec /var/lang/bin/python -m awslambdaric $1 | ||
if [ -n "$AWS_LAMBDA_FUNCTION_MEMORY_SIZE" ]; then | ||
echo "Running as a Lambda function" | ||
/var/runtime/bootstrap app.handler | ||
else | ||
# Start the FastAPI application using Uvicorn for Fargate | ||
cd /var/task | ||
exec uvicorn app:app --host 0.0.0.0 --port 80 | ||
echo "Running as a Fargate container" | ||
exec uvicorn app:app --host "0.0.0.0" --port 8080 --log-level debug | ||
fi |
Oops, something went wrong.