Reputation: 55
I'm trying to deploy Echo bot from microsoft samples of botframework to azure web app (python) and Whenever i try to test it after a successful deployment an error appears says
Initiating warmup request to container test_0_fea5f125 for site test 2023-11-09T09:25:00.574Z ERROR - Container test_0_fea5f125 for site test has exited, failing site start 2023-11-09T09:25:00.607Z ERROR - Container test_0_fea5f125 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
I've tried to deploy the .net Echo bot to azure web app and it's working perfectly but the python one doesn't, and i tried to add the WEBSITES_PORT = 8000 in azure web app configuration and still got the same error.
Upvotes: 0
Views: 1095
Reputation: 1
If you are deploying using a zip file, when creating the ZIP package for deployment, don't include the root directory, but only the files and directories in it. It took me a while to deploy my echo bot, and the error was due the way I was creating the zip file. More info here: https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package
# Bash
zip -r <file-name>.zip .
# PowerShell
Compress-Archive -Path * -DestinationPath <file-name>.zip
Upvotes: 0
Reputation: 8579
Follow the below steps to create and deploy Echo Bot to Azure App Service.
cookiecutter https://github.com/microsoft/BotBuilder-Samples/releases/download/Templates/echo.zip
Bot Framework Emulator response in local:
app = web.Application(middlewares=[aiohttp_error_middleware])
app.router.add_post("/api/messages", messages)
if __name__ == "__main__":
try:
web.run_app(app, host="0.0.0.0", port=CONFIG.PORT)
except Exception as error:
raise error
Instead, add the below code taken from SO.
def init_func(argv):
APP = web.Application(middlewares=[aiohttp_error_middleware])
APP.router.add_post("/api/messages", messages)
return APP
if __name__ == "__main__":
APP = init_func(None)
try:
web.run_app(APP, host="0.0.0.0", port=CONFIG.PORT)
except Exception as error:
raise error
requirements.txt:
botbuilder-integration-aiohttp>=4.14.0
aiohttp
botbuilder-core
botbuilder-schema
python -m venv env
env\Scripts\activate
Azure Bot=> Configuration
, paste your web app's URL by adding /api/messages
(https://<webapp_name>.azurewebsites.net/api/messages) in the Messaging EndPoint.Microsoft App ID
value.Microsoft App password
in the code).import os
class DefaultConfig:
""" Bot Configuration """
PORT = 3978
APP_ID = os.environ.get("MicrosoftAppId", "<Your_App_ID>")
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "<Your_App-Password")
After deploying the application to Azure:
web app=>Settings=> Configuration =>General Settings=> Startup Command
, add the command:python3 -m aiohttp.web -H 0.0.0.0 -P 8000 app:init_func
Upvotes: 1