0

I was trying to deploy my backend in heroku with docker. Here is my heroku.yml file

setup:
  addons:
    - plan: heroku-postgresql
      as: DATABASE
build:
  docker:
    web: mymeds/Dockerfile
release:
  image: web
  command:
    - ./release-tasks.sh
run:
  web: python manage.py run

But getting /bin/sh: 1: ./release-tasks.sh: not found although it's in the same folder. Here is my directory structure Directory Structure

Dec 15 05:58:17 mymedsbackend app/api Starting process with command `/bin/sh -c 'if curl $HEROKU_RELEASE_LOG_STREAM --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
Dec 15 05:58:17 mymedsbackend app/api   chmod u+x /tmp/log-stream
Dec 15 05:58:17 mymedsbackend app/api   /tmp/log-stream /bin/sh -c '"'"'/bin/sh -c ./release-tasks.sh'"'"'
Dec 15 05:58:17 mymedsbackend app/api else
Dec 15 05:58:17 mymedsbackend app/api   /bin/sh -c ./release-tasks.sh
Dec 15 05:58:17 mymedsbackend app/api fi'` by user palumboe1@gmail.com
Dec 15 05:58:22 mymedsbackend heroku/release.7559 Starting process with command `/bin/sh -c 'if curl https://heroku-release-output.s3.amazonaws.com/log-stream?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3LIQ2SWG7V76SVQ%2F20201215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201215T135816Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=4f30c56d2f692e9d76dcaaebb9920cb7097c71cedcca597e26d2228de0e8497c --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
  chmod u+x /tmp/log-stream
  /tmp/log-stream /bin/sh -c '"'"'/bin/sh -c ./release-tasks.sh'"'"'
else
  /bin/sh -c ./release-tasks.sh
fi'`
Dec 15 05:58:23 mymedsbackend heroku/release.7559 State changed from starting to up
Dec 15 05:58:25 mymedsbackend heroku/release.7559 Process exited with status 127
Dec 15 05:58:25 mymedsbackend heroku/release.7559 State changed from up to complete
Dec 15 05:58:25 mymedsbackend app/release.7559 /bin/sh: 1: curl: not found
Dec 15 05:58:25 mymedsbackend app/release.7559 /bin/sh: 1: ./release-tasks.sh: not found
Dec 15 05:58:27 mymedsbackend app/api Release v35 command failed by user someone@gmail.com
Dec 15 05:59:35 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/robots.txt" host=mymedsbackend.herokuapp.com request_id=0640e377-880e-4e05-9fcc-c5b541020aac fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https
Dec 15 05:59:35 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/" host=mymedsbackend.herokuapp.com request_id=0bb24c8a-9064-4d37-8c14-0ac046947583 fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https
Dec 15 05:59:36 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mymedsbackend.herokuapp.com request_id=ed25b7de-de79-479f-a060-e322534d39a4 fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https

My release-tasks.sh file is here

cd mymeds/
python manage.py db init
python manage.py db migrate --message 'initial database migration'
python manage.py db upgrade

1 Answers1

0

Do you have a step to copy the file in the Dockerfile?

I encountered this issue too, and turned out my output image was missing the shell script.

You can verify if it is being copied by running the docker image locally and inspecting it (Docker desktop has a nice CLI tool for this, or you can use docker exec)

Aamir Mulla
  • 61
  • 1
  • 2