R
Railway•11mo ago
ZeroxAdvanced

NiceGUI deployment to Railway help with dockerfile

Hi I hope someone can help me. So far I am loving Railway. I already have a Django project and it runs fine. Now I am using nicegui to build an app but I cannot get the deployment to Railway working. App Code is mostly in main.py How to deploy my nicegui app to railway? I created a dockerfile and it seems succesfully running but I think uvicorn is not running? Code is below: # Pull the official base image FROM python:3.10-slim-buster # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # The port environment variable is set by Railway when the container is run # But we can default it to 8080 for local development ENV PORT=8080 # Expose the port EXPOSE $PORT # Set work directory in the container WORKDIR /code # Install dependencies COPY requirements.txt /code/ RUN pip install --upgrade pip RUN pip install -r requirements.txt # Copy project COPY . /code/ # Command to run on container start CMD ["python", "main.py"] In the console I get the feed: NiceGUI ready to go on http://localhost:8080, and http://172.17.2.235:8080 But i think i need to expose it with the uvicorn? Can someone help? project id: 3e62bf9f-3eee-4bbd-80e8-83d7d0e2acf1
39 Replies
Percy
Percy•11mo ago
Project ID: 3e62bf9f-3eee-4bbd-80e8-83d7d0e2acf1
Brody
Brody•11mo ago
is nicegui a fastapi app?
ZeroxAdvanced
ZeroxAdvanced•11mo ago
Hi yes it is fast api and just py i believe
Brody
Brody•11mo ago
do you have uvicorn in your requirements.txt file?
ZeroxAdvanced
ZeroxAdvanced•11mo ago
Need to check i believe it is.
Brody
Brody•11mo ago
in the main.py file, is the fastapi variable called app ?
ZeroxAdvanced
ZeroxAdvanced•11mo ago
No there is no app definition in the main.py it is not needed for niceGUI. See docs of nicegui it just runs with python main.py and no ref needed for an app variable
Brody
Brody•11mo ago
send me the docs please try setting a PORT service variable to 8080
ZeroxAdvanced
ZeroxAdvanced•11mo ago
hi i see on their site also this info You can run it if you only have main.py with docker run -it --rm -p 8888:8080 \ -v "$PWD":/app zauberzeug/nicegui i did in the docker file But we can default it to 8080 for local development ENV PORT=8080 It is running NiceGUI ready to go on http://localhost:8080/, and http://172.17.2.235:8080/ I think i have some ip mapping wrong or need to add extra line for uvicorn?
ZeroxAdvanced
ZeroxAdvanced•11mo ago
NiceGUI
NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more.
Brody
Brody•11mo ago
a service variable
ZeroxAdvanced
ZeroxAdvanced•11mo ago
ok how do i set the service variable?
Brody
Brody•11mo ago
in the variables tab
ZeroxAdvanced
ZeroxAdvanced•11mo ago
ok checking doesnt work let me check my requirements.txt aiofiles==23.2.1 aiohttp==3.8.6 aiosignal==1.3.1 annotated-types==0.6.0 anyio==3.7.1 async-timeout==4.0.3 attrs==23.1.0 bidict==0.22.1 certifi==2023.7.22 charset-normalizer==3.3.2 click==8.1.7 exceptiongroup==1.1.3 fastapi==0.104.1 fastapi-socketio==0.0.10 frozenlist==1.4.0 h11==0.14.0 httpcore==1.0.1 httptools==0.6.1 httpx==0.25.1 idna==3.4 ifaddr==0.2.0 itsdangerous==2.1.2 Jinja2==3.1.2 markdown2==2.4.10 MarkupSafe==2.1.3 multidict==6.0.4 nicegui==1.4.2 orjson==3.9.10 pscript==0.7.7 pydantic==2.4.2 pydantic_core==2.10.1 Pygments==2.16.1 python-dotenv==1.0.0 python-engineio==4.8.0 python-multipart==0.0.6 python-socketio==5.10.0 PyYAML==6.0.1 requests==2.31.0 simple-websocket==1.0.0 sniffio==1.3.0 starlette==0.27.0 typing_extensions==4.8.0 urllib3==2.0.7 uvicorn==0.22.0 uvloop==0.19.0 vbuild==0.8.2 watchfiles==0.21.0 websockets==12.0 wsproto==1.2.0 yarl==1.9.2
Brody
Brody•11mo ago
show me how you've set the service variable
Want results from more Discord servers?
Add your server