Skip to main content

Easy serverless deploy of python web applications

Project description

Simple deploy of python web-apps @YandexCloud

Forget about setting up your own infrastructure, vps, network, orchestrators, etc... go serverless

Quickstart

  1. setup virtual env, create your app
  2. create account at Yandex Cloud
  3. install Yappa
$ pip install yappa -U
$ pip freeze > requirements.txt
  1. 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:

Django

please see examples:

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. Any other database you use 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

Acknowledgements

  • Mikhail Novikov for starting this project two years ago
  • httpx as a great tool for calling WSGI/ASGI apps offline
  • Zappa for inspiration

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yappa-0.4.18.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yappa-0.4.18-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file yappa-0.4.18.tar.gz.

File metadata

  • Download URL: yappa-0.4.18.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for yappa-0.4.18.tar.gz
Algorithm Hash digest
SHA256 8da280e2804cb1ab031c85286aa55f1538e66547fd6285030d2adfd00e0afaef
MD5 d3ef056f37129c59530f872392d7b5b4
BLAKE2b-256 9987153dfc36ebc5967554cd7dd171dd1aa5dbcef9bb5d2e0461ae6830ba9f9c

See more details on using hashes here.

File details

Details for the file yappa-0.4.18-py3-none-any.whl.

File metadata

  • Download URL: yappa-0.4.18-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for yappa-0.4.18-py3-none-any.whl
Algorithm Hash digest
SHA256 9e5134f421e6c53172042cf88e7096f9112e2e00fba6d38bbc65e8c33f934ba8
MD5 671c064ddb5298501cc0ea83561b7cf0
BLAKE2b-256 da107a6a1d58439063c8889ca56c66595b9be6b11aeea85b86665921e120002c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page