Deploy LlamaIndex Apps | Streamlit on the Port the Platform Assigns
Streamlit apps that bind the assigned port. The stock one never does.
chat-with-pdf
Just deployed
summarize-url
Just deployed
Deploy and Host LlamaIndex Apps on Railway
Two small LlamaIndex apps on Streamlit, deployed as separate services: one chats with a PDF, the other summarizes a URL. Both listen on the port the platform assigns.
About Hosting LlamaIndex Apps
The existing LlamaIndex Apps template reports 0% health: no deployment of it succeeds. The cause is one line, and it is in the template rather than the code.
Its start command is a bare streamlit run streamlit_app.py. Streamlit then listens on its own default port, which is not the port the platform assigns and routes to. The template does set a PORT variable, but Streamlit does not read PORT; it wants --server.port or STREAMLIT_SERVER_PORT, so that variable changes nothing.
Here the start command passes it explicitly:
streamlit run streamlit_app.py --server.port $PORT --server.address 0.0.0.0 --server.headless true
--server.headless true matters in a container too: without it Streamlit tries to open a browser and prompts for an email on first run.
Common Use Cases
- Asking questions about a PDF: upload it to chat-with-pdf and query it.
- Summarizing a web page: give summarize-url a link and get a summary back.
- A working base for your own Streamlit and LlamaIndex apps, with a start command that already binds the assigned port.
Dependencies for LlamaIndex Apps Hosting
Deployment Dependencies
- chat-with-pdf, built from ak40u/llama-index-railway, directory
/chat-with-pdf(public) - summarize-url, built from the same repository, directory
/summarize-url(public) - An OpenAI API key, entered in each app's own sidebar at runtime. Nothing in this template asks for a key up front.
The Apps
- chat-with-pdf: upload a PDF, ask questions about it
- summarize-url: give it a link, get a summary
Both are unmodified from the upstream project by alphasec, MIT licensed. The only change is the start command.
Verification
Both services deployed and answered /_stcore/health with ok, and their logs show a clean start with no import errors. The apps themselves need the OpenAI API key entered in the sidebar; that part was not exercised during testing.
Why Deploy LlamaIndex Apps on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying LlamaIndex Apps on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
chat-with-pdf
ak40u/llama-index-railwaysummarize-url
ak40u/llama-index-railway