How to deploy a Python app with (non-PyPI) mongod dependency?

lmmx
HOBBY

a year ago

I successfully deployed a FastAPI / htmx web app the other day and thought I’d try to port over another one which relies on both Python and mongod.

The `mongod` application is required to speak to a MongoDB database and is not a Python requirement, it cannot be set up via pip or any other Python dependency manager.

On other platforms this is automatically taken care of for you by a MongoDB image, and I assumed that perhaps that’d be the case for the MongoDB database connection on Railway.

It’s very nice how the nixpack autodetects the PDM lockfile and installs them, but unfortunately this leaves me scratching my head about how to install the mongod application.

Can anyone help a Railway noob out? :-)

4 Replies

a year ago

If I understand correctly you need to deploy a MongoDB database?


lmmx
HOBBY

a year ago

No I deployed a MongoDB database no problem, but the mongod daemon (https://www.mongodb.com/docs/manual/reference/program/mongod/) is not installed in the web service I am serving. The mongod dependency is not installable via PyPI. Typically I would use conda to install such a dep but am unsure if there's a better/more idiomatic way for Railway.


a year ago

Is that needed for the mongo python client?


lmmx
HOBBY

a year ago

Yes. See e.g. https://pymongo.readthedocs.io/en/stable/tutorial.html