Anyone interested to see I destroy my VPS?

Daestrum

Expert
Licensed User
Longtime User
You did make me look up what LEMP was, so I learnt something.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
You did make me look up what LEMP was, so I learned something.
Yes, LAMP is more popular and which I use to have.
LAMP = Linux + Apache + MySQL + PHP
LEMP which replaces Apache with nginx (pronounced as engine X) as the http web server. The M for MySQL also can be replaced by MariaDB.
B4J server app can run without any of the web servers mentioned above since it is a web server itself.
Because I like the simplicity of adminer which is a one file PHP app, to manage my MySQL database (compare the more complex PhpMyAdmin), I need to install LAMP or LEMP in my VPS. Alternatively, I can also use my jAdmin app.
Recently I was looking for how to host RTMP server, so I come across nginx again and the guide to install LEMP.

Good to hear that you learned something. That is always my intention but not always obvious. :)
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
If anyone is curious...
or want to see me wipe out my VPS and reinstall the OS, install OpenJDK from scratch, install Let's Encrypt, run B4J server / jRDC2 app, assign a sub domain from another hosting provider and optionally install a LEMP server.
If you are interested, please comment.
It will be a great starting point for someone like me who will in the near future switch to VPS
 

hatzisn

Well-Known Member
Licensed User
Longtime User
Yes, LAMP is more popular and which I use to have.
LAMP = Linux + Apache + MySQL + PHP
LEMP which replaces Apache with nginx (pronounced as engine X) as the http web server. The M for MySQL also can be replaced by MariaDB.
B4J server app can run without any of the web servers mentioned above since it is a web server itself.
Because I like the simplicity of adminer which is a one file PHP app, to manage my MySQL database (compare the more complex PhpMyAdmin), I need to install LAMP or LEMP in my VPS. Alternatively, I can also use my jAdmin app.
Recently I was looking for how to host RTMP server, so I come across nginx again and the guide to install LEMP.

Good to hear that you learned something. That is always my intention but not always obvious. :)

I also like adminer. It is the swiss army knife for DBs. I believe you must also use docker because it is much easier to install docker containers with full programs in 3 sec in your vps which can be wiped out in a blink of the eye and leave your VPS again brand new as it was just reinstalled with os.
 

aeric

Expert
Licensed User
Longtime User
I also like adminer. It is the swiss army knife for DBs. I believe you must also use docker because it is much easier to install docker containers with full programs in 3 sec in your vps which can be wiped out in a blink of the eye and leave your VPS again brand new as it was just reinstalled with os.
No, I don't use docker. I don't think I need it. For me it is a waste of resources.
I don't understand why people use it.
 

hatzisn

Well-Known Member
Licensed User
Longtime User
No, I don't use docker. I don't think I need it. For me it is a waste of resources.
I don't understand why people use it.

It is true that a 10 mb B4J webapp with another 2 mb html files and pictures can create a docker image of about 330 mb but it has a lot of advantages. Briefly:
1) You can migrate your app in blink of an eye and you will never get "but why? It works perfect in my computer". All needed resources are in the container.
2) It renders the broken resources side effect a thing of the past. Imagine you have used php 7.x.x in a webapp and someone upgrades php to the latest one which has some new declares of certain subs. Your app is ruined in this case. With docker it is containerized with all its resources and you will never get this error.
3) Each container is considered a "dedicated" server so you can have multiple instances of your app container (containers from image) and your app will be listening in the same port number in each container. If you connect all these containers (containers with different names) to a user created docker network and connect also to this network haproxy while the latter is also connected to docker bridge network you will get with just one vps a pretty stable app because hackers and bugs will target one of many and not one of one app.
 

aidymp

Well-Known Member
Licensed User
Longtime User
yes please, I can do about 30% of that, but badly! lol I use a Pi4 for a forward facing website. Its very flawed, but it works...

looking forward to seeing the results...
 

aeric

Expert
Licensed User
Longtime User
It is true that a 10 mb B4J webapp with another 2 mb html files and pictures can create a docker image of about 330 mb but it has a lot of advantages. Briefly:
1) You can migrate your app in blink of an eye and you will never get "but why? It works perfect in my computer". All needed resources are in the container.
2) It renders the broken resources side effect a thing of the past. Imagine you have used php 7.x.x in a webapp and someone upgrades php to the latest one which has some new declares of certain subs. Your app is ruined in this case. With docker it is containerized with all its resources and you will never get this error.
3) Each container is considered a "dedicated" server so you can have multiple instances of your app container (containers from image) and your app will be listening in the same port number in each container. If you connect all these containers (containers with different names) to a user created docker network and connect also to this network haproxy while the latter is also connected to docker bridge network you will get with just one vps a pretty stable app because hackers and bugs will target one of many and not one of one app.
Regarding disk space, this is important for me. My laptop come with limited space SSD and the cheap plan of VPS also provide very limited disk space.

The advantages of solving the issues above happen for other programming language, does not apply for Java and B4X.
1. This never/seldom happen to me as I don't need to communicate with a devops engineer. I am all-in-one full stack developer and infra engineer. Things happen to a team that have no idea what the other co-worker is doing. This also not likely to happen because unlike other programming language which has problem with the dependency version that not backward compatible. Building and deploying a B4J server app to a VPS provide a really solid "working as it is" product, eliminating what I experience with other programming language. Problem with other programming languages especially those rely on third party web server.
2. I agree especially in shared hosting server. Everytime the hosting migrated my server, I experience this problem, countless time and it's really frustrating. My apps are in production and my PHP apps just don't work. With VPS, this problem would never happen, I can have a good sleep. No one is going to touch my server. I don't need docker to solve this issue.
3. Sounds good for fault tolerant. So far all my apps are simple and not high usage. I haven't reach the level to have HA and I think my cheap VPS would not allow that. I rather share the limited RAM to run more different apps. Guess how many RAM I have in my VPS? 1 GB.

Conclusion:
So in my use case, docker is not feasible and redundant. B4J server app itself has JVM and act like a container.
 

aeric

Expert
Licensed User
Longtime User
Sorry guys, I have postponed the demo. I planned to do a youtube live streaming since last week but I was not feeling well. I plan for these few days before the subscription ends.
 

ilan

Expert
Licensed User
Longtime User
this will be really great @aeric
something that i really would like to learn is
having multiple domains on the same VPS with multiple SSL certificate (lets ecrypt or any other)
i managed to have a running LAMP server but only with a single domain. i dont know how i can have multiple domain and each domain should point to a different server
the problem is you cannot redirect a domain to a ip address with a specific port like 204.1.20.66:5000
you have to put the ip only and that makes it for 1 domain only because you cannot point 2 domains to the same ip address.
have you managed to have multiple domain pointing to the same VPS and each domain has its own server running?
 

aeric

Expert
Licensed User
Longtime User
having multiple domains on the same VPS with multiple SSL certificate
No. You only can assign only ONE domain to a VPS.

What I am doing is creating a sub domain from shared hosting provider where I purchase the TLD domain name.
e.g
Shared hosting: example.com
VPS: prod.example.com
I manage the subdomain in shared hosting and point the sub domain name to the VPS IP address.
The auto renew SSL which is provided by CPanel in shared hosting should be disabled.

You can install SSL (Let's Encrypt) to a webserver such as apache2 or nginx using certbot.
With Let's Encrypt, I create a java keystore for B4J servers.
Each B4J server uses different port numbers.
e.g
prod.example.com:5000
prod.example.com:6000
 

ilan

Expert
Licensed User
Longtime User
I manage the subdomain in shared hosting and point the sub domain name to the VPS IP address.
and you can create a sub domain that redirects to ip with port number?
like: prod.example.com -> [ip]:5000
 

aeric

Expert
Licensed User
Longtime User
If you want to have multiple domains in the same VPS, I think you need to use software like CPanel which require an expensive license which I am not going to do.
Some free web panel software provided by VPS hosting are very limited in functions and does not allow advanced features.
 

aeric

Expert
Licensed User
Longtime User
and you can create a sub domain that redirects to ip with port number?
like: prod.example.com -> [ip]:5000
i think the mapping is like:
prod.example.com -> [ip]

Then,
prod.example.com:80 -> [ip]:80 (nginx/apache2)
prod.example.com:5000 -> [ip]:5000 (B4J server 1)
prod.example.com:8000 -> [ip]:8000 (B4J server 2)
etc...

edit:
or
prod.example.com -> [ip] (B4J server 1 on port 80 and 443 with SSL)
prod.example.com:88 -> [ip]:88 (nginx)
prod.example.com:90 -> [ip]:90 (apache2)
prod.example.com:5000 -> [ip]:5000 (B4J server 2)
 
Last edited:

ilan

Expert
Licensed User
Longtime User
If you want to have multiple domains in the same VPS, I think you need to use software like CPanel which require an expensive license which I am not going to do.
Some free web panel software provided by VPS hosting are very limited in functions and does not allow advanced features.
i have my own pc (old amc mini) that i am using as a VPS.
i have a public static ip address so it wont change.
where i bought the domains (whois.com) i set the DNS to point to my ip address. it work fine. also the paid SSL certification (dont like lets encrypt) works fine.
the thing is that i cannot point another domain to the same ip.

but there are ways how to do that:

How do I add multiple domains in VPS?


Install a web server software on your VPS, such as Apache or Nginx, and configure it to serve multiple websites. Create virtual hosts for each website, and configure them to point to the appropriate directories on your VPS. Each virtual host should have its own unique domain name and server name.

this is something that i still need to investigate.

having your own VPS at home using a old pc is handy.
the late 2012 macmini is still very good for such a task.
i have everything installed there (sql, php, ...) and it is working fine with b4j servers.
 

ilan

Expert
Licensed User
Longtime User
i think the mapping is like:
prod.example.com -> [ip]

Then,
prod.example.com:80 -> [ip]:80 (nginx/apache2)
prod.example.com:5000 -> [ip]:5000 (B4J server 1)
prod.example.com:8000 -> [ip]:8000 (B4J server 2)
etc...

edit:
or
prod.example.com:80 -> [ip]:80 (B4J server 1)

1716884859919.png


as you see i am not able to put the port. if i put the port it is not redirected correctly.
so the server also need to run on port 80 or 443 else it wont get the call when someone puts the url in the browser.
 

aeric

Expert
Licensed User
Longtime User
i have my own pc (old amc mini) that i am using as a VPS.
i have a public static ip address so it wont change.
where i bought the domains (whois.com) i set the DNS to point to my ip address. it work fine. also the paid SSL certification (dont like lets encrypt) works fine.
the thing is that i cannot point another domain to the same ip.

but there are ways how to do that:



this is something that i still need to investigate.

having your own VPS at home using a old pc is handy.
the late 2012 macmini is still very good for such a task.
i have everything installed there (sql, php, ...) and it is working fine with b4j servers.
Ok.
As I said, my understanding is a Cpanel software can simplify the task to host multiple domains. I am not a geek or good in server administrator.

In my case, I don't trust my home as a "data center".
Anytime my place can have electricity blackout, network issue or I can't afford to pay the bill for the air conditioner to cool down the server.
VPS is a more ideal choice for most scenario. I can upgrade the hardware or change the server location or OS whenever I want.
 
Top