B4J Question Dockers and JServer apps

Magma

Expert
Licensed User
Longtime User
I am thinking creating something like my own docker for jserver apps. I saw this thread https://www.b4x.com/android/forum/t...n-linux-docker-container.170250/#post-1042334

Probably will be a jserver app too... but i wanna ask how will manage the ports and if is possible to have same ports somehow or need to change from server-app to server-app...

The real question is more debian/ubuntu question how can multiple ips and possible.. and if anyone did something like this?

In jserver is it possible to set the ip will use ? or better is it possible to set domain have the same ip (like apache is doing)?
 
All you need is some docker knowledge and a Dockerfile . Check my signature in "my contributions" in B4J tutorials to get a grip of how this is done. Please note also that I wrote this tutorial when I was learning docker and cybersecurity-wise is way far behind best practices on the matter. In docker you can map ports but if you only use http/https protocol you can use a reverse proxy to divert traffic directly inside the container.
 
Upvote 0
Nice... @hatzisn
you prob mean that

may be i m saying wrong.... i dont think need to have them in different img .. so my thought is not using exactly dockers but my .jar executing the same time... with different domains... different IPs just saw it by Erel's point...which is a nice solution

also yours is nice.. but from my view is getting a lot of ram and cpu usage. sure is more secured...

From my view every jar is different system and thats because will be only mine at least at starr.

So i will need a maiin jar that will manage all my dockers-jar using same style of a configuration.. the manager will start-stop jservers.. and will show logs...

The only thing must find how to use diff domains with same ip, same port at least in front and then forward at internal diff port of each jserver-docker..
 
Upvote 0
Nice... @hatzisn
you prob mean that

may be i m saying wrong.... i dont think need to have them in different img .. so my thought is not using exactly dockers but my .jar executing the same time... with different domains... different IPs just saw it by Erel's point...which is a nice solution

also yours is nice.. but from my view is getting a lot of ram and cpu usage. sure is more secured...

From my view every jar is different system and thats because will be only mine at least at starr.

So i will need a maiin jar that will manage all my dockers-jar using same style of a configuration.. the manager will start-stop jservers.. and will show logs...

The only thing must find how to use diff domains with same ip, same port at least in front and then forward at internal diff port of each jserver-docker..

Actually they consume only space and not that much memory and processing time. What you are describing for starting the webapps already exists and it is called Kubernetes (but it is for containers). Both for containers of docker and Kubernetes you can take a look at the playlists of Christian Lempa's channel in YouTube. I learned a lot from him.
 
Upvote 0
Yeap i know that... also already know some dockers ready solutions doing that i want... but i want mine solution...
i think with ufw commands will do that port forwarding ... but don't know how will bind domains and if need binding... may be no need anything..
🤔
 
Upvote 0
I just tried nginx proxy manager (not Nginx web server) which installed inside a docker on my VPS.

The B4J app is running on port 8080 but served on port 80 (without showing internal port number to end users).

The B4J app is not inside a docker but running as usual (nohup) and using the host Java.
Meaning I can save some disk space with only 1 copy of Java installed in the host for several B4J servers.
If using docker images then for each B4J server it has it's own docker image and it's own Java inside it.

I have my domain on a shared hosting but I create subdomain pointing to the VPS.

I understand that we can point multiple domains or subdomains to the same VPS and let multiple B4J servers with different ports running without showing the port numbers to the end users.
 
Last edited:
Upvote 0
Back
Top