How do I use NodeJS on Asustor AS-302T NAS - node.js

I have recently bought a Asustor AS-302T NAS, which is an absolutely brilliant solution for the home. One of it's most impressive features is that you can install apps which extends the ordinary behavior of a NAS. And if you are a developer you can also create your own apps.
While apps are fun, I have more interest in using my NAS as a kitchen-sink for my personal nodejs projects. In short I want to run nodejs application that I can then call from various other machines around the house. My own mini-cloud for IOT experiments.
Installing, one click only
Having installed NodeJS through App-Central I am at a loss how exactly to start using NodeJS on my NAS. The whole installation is essentially an on/off switch with no options or visible settings at all. I can find no documentation on practical tasks like uploading a nodejs application, deal with access rights or even execute it.
Under Windows or OS-X I would use npm via the command-line or shell, but Asustor is a purely html based interface (with the exception of XBMC through HDMI).
Why offer to users the option of installing NodeJS -if it's impossible to actually use it?
So my question has three aspects to it:
How do i get access to npm on my Asustor NAS
How do i get my NodeJS application running
Is it possible to run my application as a service (executed when the NAS boots)?

From the ASUSTOR Developer's Guide: apps are installed into
/usr/local/AppCentral/$APP_NAME.
NodeJS executables will be at path /usr/local/AppCentral/nodejs/bin/node and /usr/local/AppCentral/nodejs/bin/npm.
You can login to NAS via SSH and add them to PATH variable, or create symlinks...
I'm also searching for solution how to run them as a service (daemon), maybe an /etc/init.d script might help.

Related

Publish Windows service in Microsoft store with NodeJS or Electron

I'm looking for a the golden advice.
I've created an app that listens to websockets over a certain port and then sends commands to a native module (wrapped by NodeJS). now all this is done in NodeJS app. and packed in exe file (with two extra files for the native module ".dll and .napi")
now I want two things:
Run this app as a windows service in the background.
Package it in an installer that should stop the service (if exists), install the new update, then re-run the service. this app will be published in Microsoft store as appx.
I'm new to all of this so I feel lost while trying to know which is the best approach with my little knowledge.
I'm a bit confused between NodeJS and ElectronJS, some people say electron is not the best choice for services, but electron-builder is a great tool for packaging.
Conclusion: I want to publish my app to Microsoft store (already bought a developer account), and to run it as a service (no GUI). and the code is written in JS (node or electron)
Thanks in advance

How to replicate local code to Ubuntu server

I am hosting a web application in ubuntu using nodejs. i am using Webstorm ide and when ever i add some update then i have to connect to the server using ssh and copy and past the new code. isn't there any IDE available which do this automatically. at least it should has a button with credential to the server so when ever new update is ready to publish press the button and update the code on the server.
There are many solutions to this. I would use Docker my self, as it is very useful during development as well, and it is portable. You can use node-ansible and many many more. Which is the best for node in particular I don’t know. But search for deploy systems and you will definitely find.

Node JS web application to LAN application( Desktop App)

I am very new to Node JS. recently developed a web application in NodeJS & hosted it on a common server along with Database for a clinical management.
Now I have an immediate requirement of making it as a desktop application so that users in a clinic can run the exe on their desktop and the application where its installed will create a database for other users to connect and make their updates.
Checked articles with Electron, node-webkit but didn't work for my current solution.
Is there any other alternative solution where I can make it as a desktop for Windows and Mac. Seeking your kind help !!!
There is the software NEXE which shows promising results however, when it comes down too it, Node.JS is a perfectly fine platform for production environments and is quite performant for the use-case you suggest. You can bundle a Node.JS installation and call upon it from your C code using system, exec or spawn calls. You can also open your favourite browser from the command line, while Google Chrome has the --kiosk flag to show in widescreen by default.
Just some ideas.

Use node.js without access to a command prompt

I'm trying to use Node.js in my school environment which blocks all use of cmd.exe on Windows, therefore I'm not able to use Node this way.
Is there any other way to use it, or an alternative (external) command prompt application I could use?
If the com.exe access is blocked in local OS, it is suggested to use virtual machine to help developing you project. Please have a look on how to use virtual machine. Virtual Box would be a nice try.
After building a virtual machine on your Windows host, you can do most of the development stuffs there(including use Node.js from cli). Hope that helps!
Cloud 9 is an online cloud-based editor. You can set a Node.js environment up there and execute app code that way. Otherwise, I'd suggest using a virtual machine or a Docker image.

Some questions on node.js development environment and deployment strategy

I'm new to node and reading some books about it. Now I think it's time to do some dev stuff with it. I'm planning to implement a little project which I want to deploy in the cloud (AWS, Heroku, ...).
What I still haven't figured out are following points (I have a MacBook Pro with OS X 10.7):
which dev environment should I use? I thought about Aptana Studio (no node support as far as I've seen) and transferring the files via ssh to a local VirtualBox CentOS 6.3 machine which has node.js and some modules installed on it
is there any good deployment strategy for hosting my app in the cloud? For example, if I'm developing with Aptana Studio, I don't think there is a plugin which let's you deploy your code on some virtual server in the AWS or Heroku cloud, isn't it?
Thanks in advance!
I don't use an IDE per-se. I get by with just Sublime Text for my editor.
The deployment process will depend on where you host your site. I am not sure about Heroku, but with Nodejitsu it's just as simple as running "jitsu deploy" from the terminal and that's it.
If you host the site on your own on a Linux box (i.e. without Heroku or Nodejitsu) you need to account for how to make sure the site restarts after the machine reboots, or after a crash. I wrote about this on my blog. It's doable but somewhat of a chore: http://hectorcorrea.com/blog/running-a-node-js-web-site-in-production-a-beginners-guide
You can and should develop and run your application locally on your mac. Dealing with 2 machines, 2 OSes, and constant file transfers is a nuisance in development and offers no benefit. It also cripples nice things like fsevents for watching files and good text editor integration.
If you are into the whole IDE thing, perhaps consider https://c9.io/
There are several cloud Platform as a Service companies you could consider
http://nodejitsu.com/
https://devcenter.heroku.com/articles/nodejs
https://www.dotcloud.com/
http://www.cloudfoundry.com/
http://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
Here's some blog posts reviewing some of these PaaS offerings
http://mrdanadams.com/2012/node-js-paas-hosting-services/
http://ocdevel.com/blog/nodejs-paas-comparison
In terms of deployment, most of these PaaS companies are going to integrate with npm and github, so deployment is going to take no more than a handful of commands at most.
Thanks for your help!
After doing a lot of research on the topics you've posted, I just wanted to let you know what my setup for developing node applications now looks like:
Sublime Text 2 Text-Editor with Package Manager and following plugins: git, nodejs, SublimeLinter (BTW: are there some other "essential" plugins you can not live without?)
iTerm 2 Terminal for all console work (execute node-inspector, ssh to server etc.)
node.js, npm and additional modules which I want to use for my app
Running everything local on my MacBook Pro. As far as I could test this solution, it seems that it runs very smoothly but most notably: FAST :-)
Regarding node deployment, I take Heroku and nodejitsu into account due to low costs, few administration efforts and features like auto-scaling etc. The only drawback of Heroku is the missing websocket support, which I intend to use natively in my app.
Best regards!

Resources