Running Neutralinojs on a cloud instance — Experiment
DISCLAIMER : Testing this experiment on your existing virtual machines has serious risk since anyone will be able to control your data in VM, if you make URL or IP publicly available. Please create test VM if you are doing this experiment
This is about NeutralinoJs which is our latest open source project. If you are not familiar with Neutralinojs please take a look on my previous article. It is a framework to develop web apps by mixing native os functions. Further it comes as a solution for storage overhead of Electronjs.
Into the game..
Do you think what will happen if we run Neutralinojs on a cloud instance by pointing with a static IP. Seriously it will open a direct door to your virtual machine via internet through web browser, right! 😜Indeed, you will be able to make web apps to control your virtual machine.
Creating a Virtual machine
I was going to use AWS. But there was a problem with payment method. Therefore I went with Digitalocean today 😎.
STEP 1 — Selecting the image
Since NeutralinoJs Supports Ubuntu. I selected Ubuntu-16.04.4 x64 image.
STEP 2 — Downloading Neutralinojs SDK in to VM
After setting up the droplet. Download NeutralinoJs zip file using wget. Find all releases here
wget https://github.com/neutralinojs/neutralinojs/releases/download/v1.0.2-beta/Neutralino-v1.0.2-beta.zip
Extract zip file content using unzip command
sudo apt-get install unzipunzip Neutralino-v1.0.2-beta.zip -d neutralino
STEP 3 — Setting up a static IP
Network ports of the droplet can be accessed by setting up a floating ip easily.
STEP 4 — Starting NeutralinoJs run-time
cd neutralino
chmod 775 neutralino
./neutralino
I have changed the appport constant to 1234
in app/settings.json
and appname to neutralinocloud
STEP 5 — Running via the browser
Got to <your static ip or url>:1234/<your app name>
. We will be able to see NeutralinoJs sample app template rendered on web browser 💪🏻
Now the neutralino client SDK is loaded. Why waiting.. 🤪 Try to do something 🤩
Neutralino.computer.getRamUsage((data) => {console.log(`${Math.round(data.available / data.total * 100)}% of ram is free`)})
If you execute above snippet on browser console it will return the available ram quota of VM as per below
Now you will be able to write apps using Javascript to control your VM. But there should be proper limitations or privileges control. Now I am thinking how we can improve Neutralinojs for cloud support. This experiment only shows the possibility of using Neutralinojs on cloud infrastructure.
Check Neutralinojs source on Github! We do really appreciate if you can contribute macos implementation of Neutralino run-time using C++
Thanks for reading. See you in next article
Happy coding! 👋