[英]What does "=!= Unknown error" indicate on Heroku build?
I have a Django application running on Heroku with a web
dyno on a container
stack.我有一个
web
应用程序在 Heroku 上运行,web 测功机在container
堆栈上。 On adding a worker
dyno via my app.json and heroku.yml files, Heroku's build system for my Review app logs:通过我的 app.json 和 heroku.yml 文件添加
worker
测功机,Heroku 为我的 Review 应用程序日志构建系统:
=== Fetching app code
=!= Unknown error
The application builds properly locally via Docker and via Docker Compose.该应用程序通过 Docker 和 Docker Compose 在本地正确构建。 It has been building properly on Heroku until I modified my
heroku.yml
file and app.json
file to add a worker.它一直在 Heroku 上正确构建,直到我修改了
heroku.yml
文件和app.json
文件以添加工人。
My questions are:我的问题是:
heroku.yml: heroku.yml:
build:
docker:
web: Dockerfile
release:
command:
- ./release_commands.sh
image: web
run:
web:
command: newrelic-admin run-program python manage.py runserver 0.0.0.0:$PORT
worker:
command: newrelic-admin run-program python manage.py rqworker app
image: web
app.json: app.json:
{
"name": "my-app",
"stack": "container",
"formation": {
"web": {
"quantity": 1
},
"worker": {
"quantity": 1
}
},
"environments": {
"review": {
"formation": {
"web": {
"quantity": 1,
"size": "hobby"
},
"worker": {
"quantity": 1,
"size": "hobby"
}
},
"addons": [
"heroku-redis",
{
"plan": "heroku-postgresql",
"options": {
"version": 13
}
}
],
"env": {
"DEBUG": 1,
"ENVIRONMENT": "dev",
"ALLOWED_HOST": ".herokuapp.com",
"CSRF_TRUSTED_DOMAIN": "*.herokuapp.com"
}
}
}
}
For the next person to encounter this problem: this was corner case between two heroku.yml
issues, caused by YAML ordering.对于下一个遇到此问题的人:这是两个
heroku.yml
问题之间的极端案例,由 YAML 订购引起。
run.<app>.command
to be an array. run.<app>.command
是一个数组。 If it isn't, Heroku will throw a parsing error (below).run
to be defined above release
. run
在release
上面定义。 If it isn't, and condition (1) is present, Heroku will fail to throw a parsing error and instead throw Unknown error
.Unknown error
。 Here is the error the user would see if the above heroku.yml
were modified:如果上述
heroku.yml
被修改,用户将看到以下错误:
Properly ordered heroku.yml
with command
improperly set as a string instead of an array:正确订购
heroku.yml
且command
不正确地设置为字符串而不是数组:
build:
docker:
web: Dockerfile
run:
web:
command: newrelic-admin run-program python manage.py runserver 0.0.0.0:$PORT
worker:
command: newrelic-admin run-program python manage.py rqworker app
image: web
release:
command:
- ./release_commands.sh
image: web
Yields the build error:产生构建错误:
=== Fetching app code
=!= There were problems parsing your heroku.yml. We've detected the following issues:
run.worker.command needs to be in array format, such as:
run:
worker:
command:
- newrelic-admin run-program python manage.py rqworker app heap braze
image: web
Order shouldn't matter to YAML keys ( https://yaml.org/spec/1.2.2/#3221-mapping-key-order ).顺序对 YAML 键( https://yaml.org/spec/1.2.2/#3221-mapping-key-order )无关紧要。 But when
run
is defined below release
, and no other changes are made, Heroku's error output looks like this:但是当
run
定义在release
下面,并且没有进行其他更改时,Heroku 的错误 output 看起来像这样:
=== Fetching app code
=!= Unknown error
So, one cause of this Heroku error output is YAML ordering.因此,此 Heroku 错误 output 的一个原因是 YAML 订购。 Switching keys around fixes the problem.
左右切换键可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.