R
Railway•14mo 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•14mo ago
Project ID: 02456656-8527-4d43-92f2-e16dfc73d2ab
Sakin
SakinOP•14mo 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•14mo ago
Medim
Medim•14mo ago
ur exposing on 5000 but in the logs it listens on 8000?
Sakin
SakinOP•14mo 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
SakinOP•14mo ago
I am not sure which port railway will assign so exposed an static port 5000
Medim
Medim•14mo 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
SakinOP•14mo ago
exposed the port using variable like EXPOSE $PORT it assigned dynamically
Brody
Brody•14mo ago
fun fact you don't need to expose the port in your dockerfile
Sakin
SakinOP•14mo ago
it didn't have any effect so far
Brody
Brody•14mo ago
I know so what ya downloading?
Sakin
SakinOP•14mo ago
this python -m spacy download en_core_web_sm
Brody
Brody•14mo 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
SakinOP•14mo 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•14mo 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
SakinOP•14mo ago
you're right something is downloading but I'm not yet not sure what. need to debug
Brody
Brody•14mo ago
let me know when the double download is resolved
Sakin
SakinOP•14mo ago
sure thanks for the help
Medim
Medim•14mo 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
SakinOP•14mo 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•14mo ago
yep that sounds exactly like what was happening, all good now?
Sakin
SakinOP•14mo ago
yeah
Brody
Brody•14mo ago
awsome!
Want results from more Discord servers?
Add your server