【发布时间】:2022-12-14 00:36:32
【问题描述】:
我想这是一个非常愚蠢的问题,但我在 devops 方面真的很差。
我有一个小型 Python 编程项目,我需要将其部署到 Web 上。它不是一个真正的应用程序,只是一个小脚本,我需要将其放在网上几天然后将其关闭。
我开发了一个使用 Python Bottle 服务器在本地运行的脚本。现在,我正在运行一个 AWS 实例,并尝试使用 App Runner 部署此应用程序。貌似我的环境和代码都没问题,就是健康检查过不了。以前只在传统服务器上部署过代码,对云上的操作不是很熟悉。
11-05-2022 02:37:47 PM [AppRunner] Health check on port '8080' failed. Service is rolling back. Check your configured port number. For more information, read the application logs.
11-05-2022 02:31:36 PM [AppRunner] Performing health check on port '8080'.
11-05-2022 02:31:26 PM [AppRunner] Provisioning instances and deploying image for publicly accessible service.
11-05-2022 02:31:15 PM [AppRunner] Successfully built source code.
11-05-2022 02:26:53 PM [AppRunner] Starting source code build.
11-05-2022 02:26:52 PM [AppRunner] Successfully pulled source code.
11-05-2022 02:25:56 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
11-05-2022 02:25:55 PM [AppRunner] Service creation started.
这是我的“server.py”文件中的代码部分。
import os
from bottle import route, run, template, get, post, request
from scraper import scrap, get_dropdown_choices
index_html = '''My first web app! By <strong>{{ author }}</strong>.'''
@route('/')
def index():
return template(index_html, author='Tim')
@route('/name/<name>')
def name(name):
return template(index_html, author=name)
run(host='0.0.0.0', port=8080)
我应该怎么做才能通过健康检查测试?
【问题讨论】:
-
请提供有关您的 App Runner 设置的更多信息,否则只能猜测哪里出了问题。
-
我们需要更多信息。您的应用程序是否公开了
/路由?如果不是,那将导致健康检查失败。将运行状况检查配置为使用您的应用公开的端点,或者创建一个/端点。如果这些都不是问题,请编辑您的问题,我们将从那里开始。谢谢 -
@ronrothman 我已经按照建议添加了路由
/端点。这条路线在当地运作良好。 -
你能和我们分享网络服务器日志吗?服务器是否收到健康检查调用?
标签: python amazon-web-services devops bottle amazon-app-runner