How to run Node.js app on V4?

I’m a docker-newbie and really excited that V4 is using docker under the hood. I’d really love to run Node.js app (like NodeBB) on V4. Any pointer on how can I get started with NodeBB on V4?

Thanks a ton!

Hey @nezam05

You can actually do that, but the amount of work required for it will be non-trivial and would require knowledge of Nginx, nginx-proxy, containers etc… So it will be not easy to do it, and given the fact that developer’s documentation is still needs lot of work so, It’ll even be more difficult. Still if you want to give it a shot, you can try the following to get started.

  1. Get familiar with nginx-proxy as much as possible.
  2. Look at our developer documentation.

As a proof of concept, I ran the following commands and was successfully able to run a NodeBB app:

docker run -dit --name=nodebb_app -e VIRTUAL_HOST=sitename.com -e VIRTUAL_PATH=/ -e VIRTUAL_PORT=4567 -e HSTS=off nodebb/docker
docker network connect ee-global-frontend-network nodebb_app
docker restart nodebb_app

Hence it is possible to run NodeJS apps on v4 :slight_smile:. However, It isn’t connected to Redis/DB container so you won’t even be able to set it after setup screen and that’s why I said proof-of-concept.

To take it further from here, you’ll need to make a docker-compose file having

  1. Node BB service
  2. Postgres/Redis/DB service

To do it, you can take reference of docker-compose.yml and .env file of any PHP site which will be located at -

  • /opt/easyengine/example.com/docker-compose.yml and
  • /opt/easyengine/example.com/.env

then you need to ensure NodeBB service in docker-compose is connected to following docker network: ee-global-frontend-network and Postgres/Redis/DB service is connected to ee-global-backend-network and both are connected to a common network (Generally we name it site’s network example.com).

But if you’re planning to reach till here, expect a lot of head banging if you don’t know much about nginx configuration, nginx-proxy, docker, docker-compose and NodeJS.

In case you’re able to do the above and get a NodeBB app running with DB and all, Let me know, I will guide you to next step where you’ll create you own EasyEngine site-type!
i.e. you (or anyone else) will be able to run

ee site create example.com --type=nodebb

and a NodeBB site will be created for you :nerd_face:

Happy Hacking :wink:

2 Likes

interesting challenge. sound like hard. I will wait common solution :slight_smile: