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
Percy2mo ago
Project ID: N/A
Brody
Brody2mo ago
Please state what issues you are running into
BlackJesus
BlackJesus2mo ago
The API is not responding, and I want to check the container to know that everything is working correctly
Brody
Brody2mo ago
The API is not responding
going to need more specifics than that are there any errors in the deployment logs?
BlackJesus
BlackJesus2mo ago
I'm getting 405 errors
Brody
Brody2mo ago
are you sure you are using https when calling the railway domain?
BlackJesus
BlackJesus2mo ago
No description
BlackJesus
BlackJesus2mo ago
I think I'm calling https http
Brody
Brody2mo ago
dont run uvicorn with a file watcher
BlackJesus
BlackJesus2mo ago
I need to take that off
Brody
Brody2mo ago
yes, you also need to call the api with https
BlackJesus
BlackJesus2mo 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
Brody2mo 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
BlackJesus2mo ago
No description
BlackJesus
BlackJesus2mo ago
No description
Brody
Brody2mo ago
are you using https when calling the api?
BlackJesus
BlackJesus2mo 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
Brody2mo ago
please use https everywhere you make an api call
BlackJesus
BlackJesus2mo ago
is there any way to get into the container to trouble shoot.
Brody
Brody2mo ago
no, theres nothing wrong with the container, this is a code issue
BlackJesus
BlackJesus2mo ago
I have one more question when I try to use the interal DNS it's not connecting to it?
BlackJesus
BlackJesus2mo ago
I added the sleep function still getting it
No description
Brody
Brody2mo ago
is data.railway.interal in the same project?
BlackJesus
BlackJesus2mo ago
Yes
Brody
Brody2mo ago
show me how you have implemented the sleep
BlackJesus
BlackJesus2mo ago
No description
BlackJesus
BlackJesus2mo 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
Brody2mo 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
BlackJesus2mo 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
Brody2mo ago
as previously mentioned, you would need to use hypercorn, you would also need to specify the port in the url
BlackJesus
BlackJesus2mo ago
No description
Brody
Brody2mo ago
you would need to install hypercorn