NodeBB Docker image connected to external MongoDB Atlas database?
Néstor Llamas Llopis last edited by
I am maybe planning to deploy NodeBB with a Docker image into Zeit Now service for free. Regarding the NodeBB connection with the database (MongoDB/Redis), Zeit Now recommends always running the database externally (in my case would be MongoDB Atlas), as I also think it should be. So, is that possible? Can I link or connect the deployed Docker image with an external database? I think the NodeBB Docker image includes the database itself, no? It is all integrated. So this won't work fine.
Can anyone explain me how it works exactly? I am new in cloud deployment and Docker/Kubernetes containerization. I am used to DigitalOcean Linux Virtual Machine (VPS Web Hosting).
the "host" part in MongoDB config is there for a reason
And no, NodeBB Docker image doesn't contain any database. You can see the dockerfile here - notice there is no mention of neither MongoDB, redis nor PostgreSQL. The choice of DB is left to you.
I don't think Docker should interfere with remote connections, so just changing mongodb/redis/PostgreSQL uri should work.
However, I'm not don't think that NodeBB can run serverless. It runs it own web server and uses websockets - so with Zeit small time limits even if you got NodeBB to run, the client would be reestablishing websocket connection every 10 seconds.
Going serverless seems great for apps that only need server-side processing occasionally. If you only can divide the app into small tasks that need to be done from time to time - for example every time the user requests a webpage.
Adapting NodeBB to work with Zeit Now, AWS Lambda, Google App Engine, Azure Functions or whichever serverless platform you want to use would require a lot of work. Socket.io would have to be replaced with something that supports serverless apps until a way to use it that way is added (I believe Zeit is working on this, but they are at it for some time now. And a lot of things would have to be moved away from NodeBB app itself to the selected serverless platform.
But I'm not really experienced with neither serverless nor docker, so I might've misunderstood something.
I don't know if Zeit Now (while really cool!) would work for NodeBB... NodeBB is a web application, and does lots of stuff in the background that relies on a server running. To have a service that spins up whenever a request comes in would be much too slow, if only because that first spin up would take many seconds!