B4J Question A cheap - or better - free host where to run a B4J program - anyone ?

semar

Active Member
Licensed User
Longtime User
Dear all,

is there any remote cheap or (better) free host provider, where is possible to run a B4J .jar on it ?

Just out of curiosity: where do you run your B4J applications ?

Tips and suggestions are more than welcome,

Sergio
 

semar

Active Member
Licensed User
Longtime User
Long time ago I wrote in "Wish" forum. I wish Anywhere Software to have a simple b4j app hosting service (on pay). I think that wish still make sense.
Indeed Eme, I absolutely second that.

Anyway.
Lots of interesting infos here, many thanks to you all !

I have yet not really decided if I go the VPS route, or - like other users already suggested me - just pick a Raspberry - or even an old smartphone - and use it as central unit to control the bulbs and eventually other devices.

In fact, for a VPS I have to pay even if I don't use it, while a devices which can also act as web server, must be bought only once.

The VPS solution could be a viable proposal for people who don't have an old device or just don't want use it as a central unit at home. In that case, a VPS would be a realistic option. But now I'm speaking of potential clients, which is - right now - just out of my scope.

Just to compare each scenario for both options:
Solution A: Raspberry or old smartphone at home.
Steps required:
- switch on the device and let the B4J or B4A automatic bulb controlling program running.
- switch on the Wi-Fi
- switch on the wi-fi-capable bulbs so that they are online and can be controlled from the device

Solution B: VPS with a B4J application running
Steps required:
- connect with a smartphone to the B4J on the cloud VPS and start the automatic bulb controlling (this step is optional if I decide to let the program always running)
- switch on the Wi-Fi
- switch on the wi-fi-capable bulbs so that they are online and can be controlled from the device

Remark: The connecton from outside to the VPS is easy, while the one required to connect to the device at home not (static IP, etc), but it is still doable.
 
Last edited:
Upvote 0

semar

Active Member
Licensed User
Longtime User
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I just bought a VPS from Contabo as @Alexander Stolte suggested. Just a small one for 4.99€/month + 1.99€/month for domain name (not obligatory!) to test some BANano apps, and I must say I am very pleased with what I see!

Setup by them was done under an hour (Ubuntu 18.04) with the free Webmin & LAMP control panel + new domain name.
Quite some freedom to do what you want in their Customer Control Panel and Webmin.

Had one problem with login in the Customer Control Panel. Had a clear answer from their helpdesk (mail) in about half an hour (I asked them to test it themselves). Turned out when copying the password from the mail I had an extra space at the end :D

Using KiTTY (I find it personally better than PuTTY) and WinCSP very easy to install java so it will work for jServer webapps too. Same for installing LetsEncrypt to generate SSL certificates.
 
Upvote 0

semar

Active Member
Licensed User
Longtime User
I just bought a VPS from Contabo as @Alexander Stolte suggested. Just a small one for 4.99€/month + 1.99€/month for domain name (not obligatory!) to test some BANano apps, and I must say I am very pleased with what I see!

Setup by them was done under an hour (Ubuntu 18.04) with the free Webmin & LAMP control panel + new domain name.
Quite some freedom to do what you want in their Customer Control Panel and Webmin.

Had one problem with login in the Customer Control Panel. Had a clear answer from their helpdesk (mail) in about half an hour (I asked them to test it themselves). Turned out when copying the password from the mail I had an extra space at the end :D

Using KiTTY (I find it personally better than PuTTY) and WinCSP very easy to install java so it will work for jServer webapps too. Same for installing LetsEncrypt to generate SSL certificates.
Thanks alwaysbusy for your contribute (BTW, I use your ABMaterial and find it really impressive).
I just need the required steps in order to run a .jar (B4J app) on a linux server.
I guess this should be installed:
- java
- the .jar compiled B4J file.
- Do I need SSL certificates ? For what purpose are there ?
-... ?

Last but not least: the .jar obtained from within a B4J editor running on a windows O.S., is compatible with linux ? In other words, will it run on a Linux VPS ? I know it should run (.jar are platform independent), but I prefer to ask in order to avoid bad surprises..
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
BTW, I use your ABMaterial and find it really impressive
Thanks! :)

Do I need SSL certificates
If you want to make use of HTTP/2 in your jServer app, yes. For production I suggest you buy a certificate as with LetsEncrypt you have to renew it every 90 days. But it is good enough for tests.

the .jar obtained from within a B4J editor running on a windows O.S., is compatible with linux
Absolutely. As long as you have java installed on the VPS, you can run whatever you make in B4J. In my case I'm using java 9.0.4 on my windows machine and on the VPS server.

Installing Oracle Java, very easy tutorial: https://websiteforstudents.com/install-oracle-java-jre-jdk-on-ubuntu-18-04-lts-beta/
Download the .tar.gz version from the Oracle website and copy it with WinCSP to your server. then follow the guidelines on this site.

Installing Firewall and LetsEncrypt:
1. https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
2. https://www.digitalocean.com/commun...ure-apache-with-let-s-encrypt-on-ubuntu-18-04
 
Upvote 0

semar

Active Member
Licensed User
Longtime User
A question, by the letsEncrypt Tutorial für SSL certificate (which I think I should use ), one of the pre-requisites to follow the tutorial is a fully registered domain.

The question: is a domain mandatory in order to perform Https connections ? If so, I should then choose for a VPS+Domain solution.

[EDIT]I guess it is only for tutorial purpose. I think I could use the contabo domain for it. Am I right ?[/EDIT]
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Upvote 0

sorex

Expert
Licensed User
Longtime User
Remark: The connecton from outside to the VPS is easy, while the one required to connect to the device at home not (static IP, etc), but it is still doable.

keep in mind that if you go for external access only and your internet connection goes down then you can go unscrew light bulbs or sit in the dark if they aren't on yet :)

you should think about what you really need first. How many times will you turn off a light while you're away?

why not take over a pc (Pi) at home with teamviewer/VNC and control it from there? just an idea.

now you'll waste more than that you will save on energy from controlling the light bulbs.
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I think I could use the contabo domain for it. Am I right ?
I don't think so. You are not the admin/contact point for the contabo domain, so I don't think that will fly.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

semar

Active Member
Licensed User
Longtime User
keep in mind that if you go for external access only and your internet connection goes down then you can go unscrew light bulbs or sit in the dark if they aren't on yet :)

you should think about what you really need first. How many times will you turn off a light while you're away?

why not take over a pc (Pi) at home with teamviewer/VNC and control it from there? just an idea.

now you'll waste more than that you will save on energy from controlling the light bulbs.
Hi sorex, this is indeed a good point. However, the Https Api used for a (LifX) bulb allows sending a command like "switch off yourself after x seconds" and that command will be "stored" in the bulb. That means, even if the wi-fi goes down, the bulb will switch itself off anyway. I can send such a command right after the one I use to switch on the bulb, so I can prevent - at least - an energy waste in case the wi-fi goes down after that command. I hope you get my drift.
The "sitting in the dark" situation can not be avoided. At least, not yet..
 
Last edited:
Upvote 0

hibrid0

Active Member
Licensed User
Longtime User
I use this, you will get additional Plesk license to manage it and work so great.
 

Attachments

  • Screenshot_2019-03-10-09-22-34-253_com.android.chrome.png
    Screenshot_2019-03-10-09-22-34-253_com.android.chrome.png
    127.7 KB · Views: 163
Upvote 0

npsonic

Active Member
Licensed User
There's also less known provider Kimsufi which offers dedicated server from ~4 €/month. Machines are old re-purposed hardware that's why it's so cheap.
They are almost always out of cheapest server, so you must be quick to get one when new servers are installed. Usually new machines are added in few day intervals.

https://www.kimsufi.com/uk/servers.xml
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Maybe this configuration should do what you want:

Get an Android Box, no matter if Android TV or Just Android, it will work as 24/7 home server.

Create an app that reads from a server your orders: www.controlcommands.com/bulbs.php and install on Android Box as server.http://www.controlcommands.com/bulbs.php

On Web Server put a php that retrieves a JSON or text with the bulbs status(on or off) it can be saved by your last command on MySQL.

Send commands to server worldwide from your phone (app or POST commands) like: www.controlcommands.com/bulbs.php?bulbId=1&state=on, that commands will be saved to MySQL, and the app on Android Box then reads the content on server of bulbs and send the command locally over WiFi to the devices.

The app on Android Box can be programmed to read from server every lapse of seconds. or can create direct connection real time control.

Web Server: to save and send commands worldwide to the Android Box
Android Box:
manages the commands on LAN and send to bulbs.
Phone app: for controlling the bulbs and other devices.

I don't know what API has the bulbs or how it receive the commands but this should work.
 
Upvote 0

semar

Active Member
Licensed User
Longtime User
Maybe this configuration should do what you want:

Get an Android Box, no matter if Android TV or Just Android, it will work as 24/7 home server.

Create an app that reads from a server your orders: www.controlcommands.com/bulbs.php and install on Android Box as server.

On Web Server put a php that retrieves a JSON or text with the bulbs status(on or off) it can be saved by your last command on MySQL.

Send commands to server worldwide from your phone (app or POST commands) like: www.controlcommands.com/bulbs.php?bulbId=1&state=on, that commands will be saved to MySQL, and the app on Android Box then reads the content on server of bulbs and send the command locally over WiFi to the devices.

The app on Android Box can be programmed to read from server every lapse of seconds. or can create direct connection real time control.

Web Server: to save and send commands worldwide to the Android Box
Android Box:
manages the commands on LAN and send to bulbs.
Phone app: for controlling the bulbs and other devices.

I don't know what API has the bulbs or how it receive the commands but this should work.
Hello Ferdari,
many thanks for your detailed concept, which I know it would work, because actually it is (quite) what I'm using.

I like the remote VPS solution and I think I'll try it in the near future, however, right now I use the Html Api provided by the company which sells the wlan-capable bulbs.

That api uses a remote server in a similar way you already described. In other terms, the solution I have right now is:

- At home runs the Wi-Fi and some (LifX) wi-fi light bulb registered and connected and thus "online".
- I have a B4A app which runs on an old smartphone at home. This app controls the bulbs by sending to the (LifX) remote server the appropriated Html Get/Post/Set commands.

Those commands are interpreted by the (LifX) server which then sends the appropriate commands to my on-line bulbs.

The commands work only by providing the correct bulb id and the right token id (provided in the LifX developing area).

I could eventually also use the Lan Api in order to gain a direct connection via wi-fi to the bulbs without using the remote LifX server. Or I can even use both approaches.

The solution with a remote VPS would avoid the running smartphone (or android box if you like) at home. But as said, I'll go that way in the near future. Right now I'm (quite) happy with the solution I have - which happens to be similar to the one you suggested.

Again, many thanks !

Take care,
Sergio

P.S.
@hibrid0, aidymp, npsonic, Dadaista: thanks for your hints, I'll take it in consideration once I will ready to go to the VPS route. Oh my ! Lot's to do !! ;-)
 
Last edited:
Upvote 0
Top