Easy serverless deploy of python web applications
Project description
Simple serverless deploy of python web-apps @YandexCloud
Forget about setting up your own infrastructure, vps, network, orchestrators, etc...
Quickstart
- setup virtual env, create your app
- create account at Yandex Cloud
- install Yappa
$ pip install yappa -U
$ pip freeze > requirements.txt
- use Yappa:
$ yappa setup
$ yappa deploy
...that's it! Your application is deployed
updates
when your code is updated just run
$ yappa deploy
Deployment examples
Not just regular json API could be deployed this way. Several types of applications could be deployed with Yappa:
- raw serverless function
- json API (Flask, Django rest framework)
- regular Django app
- single page application
- SPA + multiple API versions
...
see examples folder
Yandex Cloud authorization
Command '$ yappa setup' prompts you for OAuth token. Then, Yappa creates service account "yappa-uploader-service" with roles editor and serverless.functions.admin for the specified folder. Key for this account is created and saved locally at .yc file.
Command '$ yappa deploy' supports two types of authorization
- service account key saved at .yc file (generated during '$ yappa setup')
- environment variables YC_OAUTH and YC_FOLDER
Troubleshooting
- installing grpcio on M1 Apple M1
installing with anaconda may help. Also look at stackoverflow
Limitations
There are some limitations, however YandexCloud team is constantly releasing the features and services. Also, this project will try to keep up. So stay tuned :)
Frameworks support
At this point WSGI applications and raw functions are supported, tested on Flask and Django. ASGI applications (FastAPI, Starlette) will be added in the future
Database connectivity
Only YandexDB is supported inside Yandex Cloud. So any database you use has to have public IP address
Managed Postgress will be added soon, see updates
Headers and authorization
Please note that some request headers (like Authorization) are deleted before function is invoked
Roadmap
Lots of features are on the way :)
Listed order may not be the chronological order of implementation.
However, it's up to you, welcome to our telegram chat
-
Support of asgi app
-
Django support
- management commands call
- postgres support
- support of S3 storage
-
Improvements in CLI
- undeploy command
- validation of inputs at yappa setup
- validation of requirements and entrypoint at yappa deploy
- auto-suggestion of app path (trying to load asgi or wsgi app)
- upload_to_bucket - add progress bar
-
Error handling
- no access
-
Documentation
- add deployment examples
- pretty flask app
- django + postgres
- classic django with s3
- SPA
- SPA + DRF + authorisation
- SPA + two api versions
- habr articles with deployment examples
- habr article with full cycle of web-site (from code to domain)
- add deployment examples
-
Random features
- delete s3 key after deploy
- avoiding s3 or avoiding reinstalling of all pip packages
- cli logs command
- why flask.app not working, fix it
faraway plans
- health checks and revert policy
- celery support
- django: ydb orm support
Support and contribution
Feel free to make pull request or ask anything at telegram chat
Also looking for contributors %)
Acknowledgements
- Mikhail Novikov for starting this project two years ago
- httpx as a great tool for calling WSGI/ASGI apps
- Zappa for inspiration
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.