R
Railwayβ€’8mo ago
Sakin

"Application failed to respond" after successfull deploy

I have deployed a flask server using docker but when I'm trying to access the route getting Application failed to respond here is the deploy logs
No description
23 Replies
Percy
Percyβ€’8mo ago
Project ID: 02456656-8527-4d43-92f2-e16dfc73d2ab
Sakin
Sakinβ€’8mo ago
02456656-8527-4d43-92f2-e16dfc73d2ab tried multiple times same error here is my dockerfile if it helps
FROM python:3.10.6

RUN mkdir -p $HOME/blah

COPY license/blah.lic $HOME/blah/blah.lic

WORKDIR /app

ADD . /app

RUN apt-get update && apt-get install -y git

RUN pip install --upgrade pip

RUN pip install numpy
RUN pip install cmake

RUN pip install -r requirements.txt

RUN python -c "import spacy; spacy.load('en_core_web_sm')" || python -m spacy download en_core_web_sm

expose 5000
CMD ["gunicorn", "--bind", "0.0.0.0", "wsgi:app"]
FROM python:3.10.6

RUN mkdir -p $HOME/blah

COPY license/blah.lic $HOME/blah/blah.lic

WORKDIR /app

ADD . /app

RUN apt-get update && apt-get install -y git

RUN pip install --upgrade pip

RUN pip install numpy
RUN pip install cmake

RUN pip install -r requirements.txt

RUN python -c "import spacy; spacy.load('en_core_web_sm')" || python -m spacy download en_core_web_sm

expose 5000
CMD ["gunicorn", "--bind", "0.0.0.0", "wsgi:app"]
Fragly
Fraglyβ€’8mo ago
Medim
Medimβ€’8mo ago
ur exposing on 5000 but in the logs it listens on 8000?
Sakin
Sakinβ€’8mo ago
not sure if it's port related issue here it's exposing railway provided port after updating CMD ["gunicorn", "wsgi:app"]
No description
Sakin
Sakinβ€’8mo ago
I am not sure which port railway will assign so exposed an static port 5000
Medim
Medimβ€’8mo ago
Ok, may not be the best idea to check if its a port related issue but try this out: Expose port 8000 in your dockerfile Make your app listen on port 8000 Assign a PORT=8000 env var in your project
Sakin
Sakinβ€’8mo ago
exposed the port using variable like EXPOSE $PORT it assigned dynamically
Brody
Brodyβ€’8mo ago
fun fact you don't need to expose the port in your dockerfile
Sakin
Sakinβ€’8mo ago
it didn't have any effect so far
Brody
Brodyβ€’8mo ago
I know so what ya downloading?
Sakin
Sakinβ€’8mo ago
this python -m spacy download en_core_web_sm
Brody
Brodyβ€’8mo ago
you are running that during the build phase (good) but then you are running that download again when your app starts (bad) add some logic there to detect if it was already downloaded and skip the second download if it was found
Sakin
Sakinβ€’8mo ago
doesn't it supposed to that RUN python -c "import spacy; spacy.load('en_core_web_sm')" || python -m spacy download en_core_web_sm In the code i didn't specify anything to download
Brody
Brodyβ€’8mo ago
thats running it in the build phase (good) but as I can see clear as day from your screenshot of the start phase, you are downloading something again, likely the spacy thing you can see the download progress bars in your screenshot right? that's from the deployment logs, aka runtime logs, you are downloading something again during runtime
Sakin
Sakinβ€’8mo ago
you're right something is downloading but I'm not yet not sure what. need to debug
Brody
Brodyβ€’8mo ago
let me know when the double download is resolved
Sakin
Sakinβ€’8mo ago
sure thanks for the help
Medim
Medimβ€’8mo ago
my project didn't work when i deployed without exposing πŸ’€ but it was like almost a year ago, now since its all exposed from the dockerfile i just don't mess with it anymore lmao
Sakin
Sakinβ€’8mo ago
forgot to update, the problem was I was loading whisper model on runtime found out didnt need that part of code just commented out
Brody
Brodyβ€’8mo ago
yep that sounds exactly like what was happening, all good now?
Sakin
Sakinβ€’8mo ago
yeah
Brody
Brodyβ€’8mo ago
awsome!