changed to gunicorn

This commit is contained in:
Dmitry Afanasyev 2022-08-16 12:57:56 +03:00
parent a53153f1ef
commit 21db4c2272
2 changed files with 6 additions and 1 deletions

View File

@ -66,9 +66,14 @@ async def webhook(request: web.Request) -> web.Response:
return web.Response(status=HTTPStatus.OK)
async def on_startup_gunicorn(app: web.Application) -> None:
await dispatcher.bot.set_webhook(WEBHOOK_URL)
async def create_app() -> web.Application:
application = web.Application()
application.router.add_post('/', webhook)
application.on_startup.append(on_startup_gunicorn)
return application

View File

@ -4,4 +4,4 @@
echo "starting the bot"
cd /opt/mosgortrans \
&& source /home/balsh/.cache/pypoetry/virtualenvs/mosgortrans-3eZxMcY3-py3.10/bin/activate \
&& gunicorn app.main:create_app --bind prod-server.lan:8084 --reload --worker-class aiohttp.GunicornWebWorker
&& gunicorn app.main:create_app --bind prod-server.lan:8084 --worker-class aiohttp.GunicornWebWorker