mongodb-labs / full-stack-fastapi-mongodb

Full stack, modern web application generator. Using FastAPI, MongoDB as database, Docker, automatic HTTPS and more.
MIT License
498 stars 86 forks source link

celeryworker.dockerfile exiting with code: 1 #25

Closed aidancahill closed 6 months ago

aidancahill commented 8 months ago

Docker compose build command exits with code: 1, line 17 - 20 in the celeryworker.dockerfile in the backend directory. Getting this response in the terminal "23.63 Environment production is not defined by project config 23.65 chmod: cannot access '/app/worker-start.sh'$'\r': No such file or directory

failed to solve: process "/bin/sh -c python -m pip install --no-cache-dir --upgrade pip \"pipx==$PIPX_VERSION\"\r\npipx install \"hatch==$HATCH_VERSION\"\r\nhatch env prune && hatch env create production\r\nchmod +x /app/worker-start.sh\r\n" did not complete successfully: exit code: 1"

Am I doing something wrong here? I definitely can be making a dumb config mistake. Default configuration to localhost.

Jibola commented 8 months ago

Hey @aidancahill, thanks for your patience on this issue.

To start, could you share if you have the file /app/worker-start.sh in your backend directory? In your generated app the pathname should look like this {project_name}/backend/app/worker-start.sh? If not that may be the root issue. It may have been accidentally deleted or removed. Let me know if that helps. If not, we can follow up with this in a formal JIRA ticket.

aidancahill commented 8 months ago

Hey @Jibola,

Thanks for taking the time,

Yes in the directory {project_name}/backend/app/, I have a worker-start.sh. I was pretty sparse with the amount of context I provided in the original post, happy to provide any additional generated files to replicate the bug.

(The content of worker-start.sh)

! /usr/bin/env bash

set -e

hatch run python /app/app/celeryworker_pre_start.py hatch run celery -A app.worker worker -l info -Q main-queue -c 1

shouari commented 7 months ago

I have the same issue.

csouflis commented 6 months ago

I am also getting this issue.

csouflis commented 6 months ago

Hey guys I solved the issue by separating out the RUN commands in the celeryworker.dockerfile, like this:

RUN python -m pip install --no-cache-dir --upgrade pip "pipx==$PIPX_VERSION" RUN pipx install "hatch==$HATCH_VERSION" RUN hatch env prune && hatch env create production RUN chmod +x /app/worker-start.sh

blink1073 commented 6 months ago

Thanks @csouflis! I opened https://jira.mongodb.org/browse/PYTHON-4351 to track this bug.

blink1073 commented 6 months ago

I applied the change in #38.