我尝试设置 Heroku Button,我的应用程序需要几个部署后脚本。不知道如何把它放在每个旁边。
这是我的 app.json
{
"name": "App on Heroku",
"description": "The App deployable to Heroku.",
"keywords": [
"App",
"Heroku"
],
"repository": "https://github.com/myaccount/myapp",
"logo": "http://node-js-sample.herokuapp.com/node.svg",
"addons": [
"heroku-postgresql",
"postmark"
],
"scripts": {
"postdeploy": [
"bundle exec rake db:migrate",
"bundle exec rake db:seed",
"bundle exec my_sample:load"
]
}
}
Run Code Online (Sandbox Code Playgroud)
这里的错误信息在
运行脚本和扩展 dynos
部署后退出代码不是 0
bash: ((: bundle exec rake db:migrate,bundle exec rake db:seed,bundle exec my_sample:load: syntax error in expression (error token is "exec rake db:migrate,bundle exec rake db:seed,bundle exec my_sample:load")
Run Code Online (Sandbox Code Playgroud)
这对我有用:
myscript.sh在与 app.json 文件相同的目录中创建一个 bash/sh 脚本(通常,这应该是您的根目录)。chmod +x myscript.sh.我的app.json文件:
{
...
"scripts": {
"postdeploy": "./myscript.sh"
}
}
Run Code Online (Sandbox Code Playgroud)
该myscript.sh文件:
#!/bin/sh
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec my_sample:load
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4231 次 |
| 最近记录: |