Having issues connecting to my docker file, also need help on how to trouble shoot the instance.

I'm creating and API, that should be hosted on port 8000. Having issue trouble shooting the railway instance, and connecting to the API.
33 Replies
Percy
Percy8mo ago
Project ID: N/A
Brody
Brody8mo ago
Please state what issues you are running into
BlackJesus
BlackJesusOP8mo ago
The API is not responding, and I want to check the container to know that everything is working correctly
Brody
Brody8mo ago
The API is not responding
going to need more specifics than that are there any errors in the deployment logs?
BlackJesus
BlackJesusOP8mo ago
I'm getting 405 errors
Brody
Brody8mo ago
are you sure you are using https when calling the railway domain?
BlackJesus
BlackJesusOP8mo ago
No description
BlackJesus
BlackJesusOP8mo ago
I think I'm calling https http
Brody
Brody8mo ago
dont run uvicorn with a file watcher
BlackJesus
BlackJesusOP8mo ago
I need to take that off
Brody
Brody8mo ago
yes, you also need to call the api with https
BlackJesus
BlackJesusOP8mo ago
CMD ["sh", "-c", "uvicorn src.main:app --reload --host 0.0.0.0 --port 8000"]
CMD ["sh", "-c", "uvicorn src.main:app --reload --host 0.0.0.0 --port 8000"]
what turns off the file watcher
Brody
Brody8mo ago
CMD uvicorn src.main:app --host 0.0.0.0 --port $PORT
CMD uvicorn src.main:app --host 0.0.0.0 --port $PORT
BlackJesus
BlackJesusOP8mo ago
No description
BlackJesus
BlackJesusOP8mo ago
No description
Brody
Brody8mo ago
are you using https when calling the api?
BlackJesus
BlackJesusOP8mo ago
I'm using https now it didn't go this far before so it fixed a little of my issue.
FROM mcr.microsoft.com/vscode/devcontainers/python:3.10

# RUN addgroup app && adduser -S -G app app -h /home/app

# set the user to run the app
# USER app
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
FROM mcr.microsoft.com/vscode/devcontainers/python:3.10

# RUN addgroup app && adduser -S -G app app -h /home/app

# set the user to run the app
# USER app
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
Brody
Brody8mo ago
please use https everywhere you make an api call
BlackJesus
BlackJesusOP8mo ago
is there any way to get into the container to trouble shoot.
Brody
Brody8mo ago
no, theres nothing wrong with the container, this is a code issue
BlackJesus
BlackJesusOP8mo ago
I have one more question when I try to use the interal DNS it's not connecting to it?
BlackJesus
BlackJesusOP8mo ago
I added the sleep function still getting it
No description
Brody
Brody8mo ago
is data.railway.interal in the same project?
BlackJesus
BlackJesusOP8mo ago
Yes
Brody
Brody8mo ago
show me how you have implemented the sleep
BlackJesus
BlackJesusOP8mo ago
No description
BlackJesus
BlackJesusOP8mo ago
# USER app
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD sleep 3 && uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
# USER app
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD sleep 3 && uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
Can you have private and open network going at the same time? when I to private network does it go to the correct port?
Brody
Brody8mo ago
not with uvicorn you cant, you would need to use hypercorn for that
hypercorn src.main:app --bind [::]:$PORT
hypercorn src.main:app --bind [::]:$PORT
BlackJesus
BlackJesusOP8mo ago
I noticed when I use extneral address it moved 8000 to port regular https port.
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD sleep 3 && uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
CMD sleep 3 && uvicorn src.main:app --host 0.0.0.0 --port $PORT
EXPOSE 8000
1 of 1 unhandled error
Next.js (14.1.2) out of date (learn more)

Unhandled Runtime Error
Error: connect ECONNREFUSED fd12:f569:4236::52:35e4:250b:443

Source
thirdwebAuth.ts (20:29) @ async Object.onUser

18 | last_active: new Date().toISOString(),
19 | }
> 20 | const data = await axios.post(`${process.env.BACKEND_URL}/users`, payload);
| ^
21 | return data.data
22 | }
23 | },
Call Stack
async BuildPage
app/build/page.tsx (5:15)
1 of 1 unhandled error
Next.js (14.1.2) out of date (learn more)

Unhandled Runtime Error
Error: connect ECONNREFUSED fd12:f569:4236::52:35e4:250b:443

Source
thirdwebAuth.ts (20:29) @ async Object.onUser

18 | last_active: new Date().toISOString(),
19 | }
> 20 | const data = await axios.post(`${process.env.BACKEND_URL}/users`, payload);
| ^
21 | return data.data
22 | }
23 | },
Call Stack
async BuildPage
app/build/page.tsx (5:15)
Getting this error when I try to connet to the internal network
Brody
Brody8mo ago
as previously mentioned, you would need to use hypercorn, you would also need to specify the port in the url
BlackJesus
BlackJesusOP8mo ago
No description
Brody
Brody8mo ago
you would need to install hypercorn
Want results from more Discord servers?
Add your server