Could not create review app. Postdeploy exit code was not 0

458 Views Asked by At

I have below app.json setup to create review apps in 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"
}

and bootstrap.sh file has for now only pg_restore command and it seems the restore went fine as per the log.

enter image description here

shell script file has:

#!/bin/bash

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

But I am getting error as Could not create review app. Postdeploy exit code was not 0. . What is that I am missing here?

1

There are 1 best solutions below

0
On

I had the same issue and found another solution: I used pre-made interface, and that solved the problem for me. However if you want a different database management system (eg i wanted PostgreSQL)or any other add-on, you will have to customize the code. Here is mine, but beware, it has still the issue you were complaining about - if you found, why my code isn´t working I ll be very glad if you let me know.