Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease the deployment of API as a serverless application #95

Closed
demeringo opened this issue Jun 4, 2022 · 6 comments
Closed

Ease the deployment of API as a serverless application #95

demeringo opened this issue Jun 4, 2022 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@demeringo
Copy link
Collaborator

demeringo commented Jun 4, 2022

Problem

In some enterprise context, querying a public API may not be allowed due to security / confidentiality constraints or internet access limitations.

Solution

User may want to self host the API for internal use.

The cloud-scanner for example can be pointed to a specific (private) instance of the API.

An option is to allow the deployment of the API as a serverless application (lambda on AWS) which is relatively cheap and do not imply upfront costs.
As a first step, we could wrap the existing API into a lambda using the serverless framework.

Alternatives

Additional context or elements

@demeringo demeringo added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 4, 2022
@demeringo
Copy link
Collaborator Author

@da-ekchajzer
Copy link
Collaborator

Should we build a specific package on each release or provide an option in the env variable of the docker package ?

@demeringo
Copy link
Collaborator Author

demeringo commented Jun 4, 2022

What i would like to try is to simply add the serverless.yml directly at the root of the repository.

IMHO, we do not need to deploy this serveless app through gh action but only provide the boilerplate serverless config to make it easy to deploy for user wanting to create his own instance (in his own account).
This means that user should be able to deploy any version of the API by checking out this git revision and running a serveless deploy command.

We may not even need docker for this, serverless framework should be able to wrap/deploy existing fastapi app to lambda is a transparent way. The only additional dependency seems to be https://mangum.io/ which seems to expose the routes of the API in a aws AP gateway / lambda compatible way.

More info: https://adem.sh/blog/tutorial-fastapi-aws-lambda-serverless

@demeringo
Copy link
Collaborator Author

demeringo commented Jun 7, 2022

Some insights on customizing openapi spec generation. This may help to serve openapi spec from non-root AWS API gateway route (like when using stage parameter in serveless deployment).

fastapi/fastapi#2678

@demeringo
Copy link
Collaborator Author

Kludex/mangum#147

@demeringo demeringo self-assigned this Jun 12, 2022
@demeringo
Copy link
Collaborator Author

Closing the issue (fully implemented and serving openapi doc now works fine) : #96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants