Simple deploy of python web-apps @YandexCloud
Forget about setting up your own infrastructure, vps, network, orchestrators, etc... go serverless
- Quickstart
- Deployment examples
- Django
- Yandex Cloud authorization
- Limitations
- Articles
- Roadmap
- Troubleshooting
- Support and contribution
- Acknowledgements
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
Both WSGI and ASGI applications are supported (as well as raw functions). So Django, Flask, FastAPI... etc could be easily deployed.
Furthermore, not just regular json API could be deployed this way. Several types of applications could be launched with Yappa:
- raw serverless function
- raw serverless function + Postgres
- json API (Flask, FastAPI, Django rest framework)
- single page application
- SPA + multiple API versions
...
more examples will be added soon
Django
please see examples:
- Django Rest Framework basic - basic DRF app. To explore serverless and Yappa features, like management commands
- Django Rest Framework + Postgres -
- DRF app with managed Postgres connectivity
Management commands
django manage.py commands are supported. just run
$ yappa manage migrate
In order to support management commands, for Django projects second cloud function is being created every deploy. It's made only for handling management commands, and it's not public. Therefore, commands do not support user inputs: to every command '--no-input' flag is added.
Creating superuser
As of Django 3.0 env variables are supported for createsuperuser command. So you should deploy your app with DJANGO_SUPERUSER_USERNAME, DJANGO_SUPERUSER_PASSWORD environment variables. Then run
$ yappa manage createsuperuser
The other way around would be to implement custom management command (see StackOverflow topic)
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
Limitations
There are some limitations, however YandexCloud team is constantly releasing new features and services. Also, the team of this project will try to keep up. So stay tuned :)
Database connectivity
Managed Postgres and YandexDB is supported inside Yandex Cloud. In case any other DB - it has to have public IP address
For details on how te set up connection with managed postgres please refer to
Headers and authorization
Please note that some request headers (like Authorization) are deleted before function is invoked
Articles
Habr:
Development and Contribution
Please see project boards and issues. With any questions and suggestions please visit our telegram chat
In the near future we will be focused on documentation improvements (mainly deployment examples) and support of async tasks (serverless workers and scheduler for celery).
Troubleshooting
- installing grpcio on Apple M1: installing with anaconda may help. Also look at stackoverflow
- versions of python 3.7 support yappa up to 0.3.12. You should use python 3.8 and above for new versions of yappa.
Acknowledgements
- Mikhail Novikov for starting this project two years ago
- httpx as a great tool for calling WSGI/ASGI apps offline
- Zappa for inspiration
Metadata
Release files for yappa 0.4.30
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yappa-0.4.30.tar.gz | 21.6 kB | Without provenance | Details for yappa-0.4.30.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yappa-0.4.30-py3-none-any.whl | Python 3 | none | any | Details for yappa-0.4.30-py3-none-any.whl |
Total release size: 48.6 kB
Release files / yappa-0.4.30.tar.gz
| Download URL | yappa-0.4.30.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20ea69afcfc82dd900fef3fa16c432c61eae343f8588a2748747a3950c196652
|
|
BLAKE2b-256 checksum How to use checksums |
4408210f9ec5285116441122b589b9875504cece97f92fd70df84586eaca947d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.20
|
Release files / yappa-0.4.30-py3-none-any.whl
| Download URL | yappa-0.4.30-py3-none-any.whl |
|---|---|
| Size | 27.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37c86100468c95e8c40a746034dc0daecb22ff56d407a3d9c03e1df5ecf6d782
|
|
BLAKE2b-256 checksum How to use checksums |
47a09734c17737e33e3b14a6abc3259308779bf51944ab1900ab61a3af325e0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.20
|
Security for yappa 0.4.30
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.