0

我有以下 app.json 设置来在 Heroku 中创建评论应用程序。

{
  "name": "Small Sharp Tool",
  "description": "This app does one little thing, and does it well.",
  "keywords": [
    "rails",
    "ruby",
    "angular"
  ],
  "scripts": {
    "postdeploy": "bash script/bootstrap.sh"
  },
  "env": {
    "SECRET_TOKEN": {
      "description": "A secret key for verifying the integrity of signed cookies.",
      "generator": "secret"
    },
    "WEB_CONCURRENCY": {
      "description": "The number of processes to run.",
      "value": "5"
    },
    "LANG": {
      "value": "en_US.UTF-8"
    },
    "RAILS_LOG_TO_STDOUT": {
      "value": "enabled"
    },
    "S3_KEY": {
      "required": true
    },
    "S3_SECRET": {
      "required": true
    },
    "RAILS_SERVE_STATIC_FILES": {
      "value": "true"
    }
  },
  "formation": {
    "web": {
      "quantity": 1
    },
    "sidekiq": {
      "quantity": 1
    }
  },
  "addons": [
    {
      "plan": "heroku-redis:hobby-dev",
      "as": "Redis"
    },
    {
      "plan": "heroku-postgresql:hobby-dev",
      "as": "postgresql",
      "options": {
        "version": "12"
      }
    }
  ],
  "buildpacks": [
    {
      "url": "heroku/ruby"
    },
    {
      "url": "heroku/nodejs"
    },
    {
      "url": "https://github.com/simplefractal/heroku-buildpack-wkhtmltopdf.git"
    }
  ],
  "environments": {
    "test": {
      "scripts": {
        "test": "bundle exec rake test"
      }
    }
  },
  "stack": "heroku-16"
}

并且bootstrap.sh文件目前只有pg_restore命令,并且根据日志似乎恢复正常。

在此处输入图像描述

shell脚本文件有:

#!/bin/bash

echo $HEROKU_APP_NAME
curl https://s3-bucket-url | pg_restore --verbose --clean --no-acl --no-owner --dbname $POSTGRESQL_URL

但我收到错误为Could not create review app. Postdeploy exit code was not 0.. 我在这里想念什么?

4

1 回答 1

0

我遇到了同样的问题并找到了另一个解决方案:我使用了预制界面,这为我解决了问题。但是,如果您想要不同的数据库管理系统(例如,我想要 PostgreSQL)或任何其他附加组件,则必须自定义代码。这是的,但请注意,它仍然存在您抱怨的问题 - 如果您发现了,为什么我的代码无法正常工作,如果您告诉我,我会非常高兴。

于 2020-07-13T09:12:43.510 回答