Some questions on node.js development environment and deployment strategy - node.js

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!

Related

What are the most common workflows for full stack Node/Express development?

I'm a self taught developer and I recently started learning Node.
I've been using Ruby on Rails for a couple of years now, and I learned most of what I know from online courses. The most helpful course I took was one in which I learned the entire process of setting up a development and production server, setting up a database, etc. In this case I was using Cloud9 for development and Heroku for production. I already knew the coding aspect of building a web app, but this course really changed everything for me because I learned how "real" developers work, how to set up a good work flow with a development environment, how to run my code on a real scalable server, etc... Since then I've built a couple of RoR apps on Heroku.
Now I'm learning Node and Express, but I'm not sure what to do with my code. Can I just use Cloud9 and Heroku, the same way I did with RoR? Are there other common services I should know about, similar to how lots of RoR apps use Heroku?
I'm looking for a small push in the right direction - the same one I had when I was learning Rails - to get the ball rolling. Any information will be greatly appreciated! Thanks
You seem to be asking both for workflow and environment pointers, so I'll give you a tiny bit of both
Env
With node, it is perfectly fine to have your dev environment locally and only host your staging and prod environment
If you don't have specific requirements in terms of hosted environment, use what you are already comfortable with:
Heroku is perfectly fine
OpenShift is a great alternative
Pivotal seems to be alright
Google App Engine and Amazon Elastic Beanstalk are most likely overkill
 Workflow
This is a very broad subject. Everyone has their own ways of doing things. At a minimum I would get familiar with the following tools or concepts:
npm (default package manager)
alternative: yarn (faster, shinier)
eslint (linter for javascript, indispensable)
Gitflow (sane way to manage your git repo)
Semver (what is semantic versioning)
Unit Testing with Tape (it's 2017, you need tests)
alternative: Mocha (more functionalities, some you don't need)
Airbnb Style Guide (a decent baseline for style)
alternative: Google Style Guide (I use this one)
There is also this overwhelming but great list, which is a bit too much but should list anything else you might need
Finally, if you want to work more with Express, I would suggest going through this MDN series Express Web Framework. Once that is done, I would installing the Express App Generator, create a test app and looking at the structure of files and folders

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.

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

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.

Deploying Meteor App to Wampp stack

I am wondering if you can deploy Meteor apps to a Windows based Wampp stack... Such as The Uniform Server.
I am wanting to upgrade a project to Meteor that is running on a small internal network. I plan on using the existing mysql database.
I'm not quite sure on how deploying works. I know it creates a tarball, but does this just unzip into the www folder on the server? I will also have Node installed.
I'm new to this whole node.js environment. That's not an actual server that can be used for production is it? It's a bit confusing. I've only ever used wampp stacks. I can't use anything but windows, so Linux is outta the question for a server.
Thanks in advance.
L.
WAMP stands for Windows, Apache, MySQL, and PHP.
Meteor uses Node.js, not PHP.
Support for other databases are coming - See the roadmap
See this question
NodeJS apparently works on Windows - here are the two top Google links.
tl;dr No

How does deploying a Node.js app using Strongloop on Heroku work?

Can someone with actual experience explain how these layers interact with each other and how a working setup (dev to production) should actually be, well, set up?
I understand there are buildpacks that serve to install Strongloop on Heroku. And that deploying the actual app is done with git push.
Some specific points that you could address...
How can I have (more or less) the same environment locally and at Heroku.
After setting up Strongloop Node, does the server environment stay in place? Or is it recreated every time I deploy an update? (if yes, how so?)
How does slnode fit into the picture
Can I connect to a db hosted at Heroku from a dev machine?
I hope answers to this question can serve as a guide for people like me who are struggling to understand how all the pieces go together.
I understand there are buildpacks that serve to install Strongloop on Heroku. And that deploying the actual app is done with git push.
You don't need our buildpack, and yes, you deploy with git push.
How can I have (more or less) the same environment locally and at Heroku.
How much more or less? You can develop on your mac laptop, and push to Heroku, using same version of node, or you can be more like Heroku, and use Linux, or ... what exactly about the Heroku env do you want to reproduce?
After setting up Strongloop Node, does the server environment stay in place? Or is it recreated every time I deploy an update? (if yes, how so?)
Not sure what setup you are referring to.
How does slnode fit into the picture
It doesn't.
Can I connect to a db hosted at Heroku from a dev machine?
Don't know, sorry, try Heroku support pages for this kind of heroku-specific tech question, perhaps?
I followed docs on bottom of page at http://docs.strongloop.com/display/DOC/Heroku, look for "Create Procfile and deploy", and it worked OK for me.
Fast answers
Use Vagrant, download a Debian 6 box, and install whatever you need in it, remember to check what version of Node.js Heroku uses.
It will be partially rebuilt, your npm dependencies will be redownloaded, your application gets rebuilt and so on.
You can use slnode on your dev machine. However if it is necessary to use slnode on a dyno, fork a build pack and install slnode as part of it.
You can connect to a database hosted on Heroku from any network connected server or pc, you will be provided with an ip and credentials.
Build packs
I'm not sure about actual constraints of a build pack, but it can do almost anything that you can do in an Debian 6 virtualized environment with shared kernel. ( An Debian 6 instance in a OpenVZ VPS )
Think of build packs as low level dependency managers which solve dependencies like node.js, Redis, Apache2 and so on.
They also build an environment like file system structure, ENV variables and so on.
Heroku infrastructure
Heroku is using AWS as it's raw hardware provider, AWS provides a fresh installation of an OS in a virtualized hardware ( VPS )
Heroku builds dynos on top of raw OS, by guess, it shares one OS between at least 128 dynos.
Each dyno is isolated from others, it has common software built in like ls, but it's build pack's duty to install any other software like Node.js for your application.
Heroku's node build pack, installs Node.js, and runs npm.

Resources