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

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.

Related

Deploy a next.js project locally without code on the machine

I am trying to deploy a Next.js Web App in combination with a node.js backend on a windows PC.
I know there are vercel and Heroku, but the application has to run even without a connection to the Internet. (My friend has a bar and he wanted a small ordersystem and I don't want him to be able to access the Code.)
I know I could just go "npm run build" --> "npm run start".
But I don't want the code locally on the machine because i am scared of plagiarism.
Is there a way to deploy this locally via Git? So the software runs on the local machine without the code beeing there?
Is it possible to create CI/CD, so it listens to new pushes on git?
Any help would be nice đŸ˜…
Get a computer installed on the businesses’s local network, encrypt its disk, and install your app on it.
You can also automate deployments with git’s postreceive hook.

How to hot reload on netlify?

Netlify just as example, same question with CloudFlare Pages etc.
In the past I setup my own server with node and react/vue.
I have my node setup on a server because I don't want to install node and node packages on my local machine.
When I was developing I SSH into the server with port forwarding.
So I ran a dev server on port 8888 (npm run dev) on the server and opened http://localhost:8888 in my local browser.
When I make a change to the files I can immediately see the effects without running npm run build.
I am thinking about using a service like netlify because its the right thing to do? But how can I see the changes I make without actually running build?
Is this even possible or do you use theses service only when you are building a website that rarely changes? I am probably missing something. But not sure how to proceed.
I don't know what's the right way. I am very open to suggestions.
Edit: These services that I mentioned are meant for build only. See answer below. I am still leaving this question so people can post suggestions.
You cannot do this. Those services are only for hosting the build version of your app. You have to develop it locally and push the build to these services.
Why would you even want to run a development version online?

Meteor bundle vs meteor --production

I am facing dilema whether I should bundle node js app from meteor or just run meteor --production.
I am mostly interested in performance impact. I have found some explanation on here, but it is not clearly stated that meteor runs in production mode.
Running just meteor --production will simplify my deployment process a lot.
I would like to know are there any reasons to stick to bundle?
I think when you run meteor --production, you are still running as if you are in development-mode, only using "production" settings and such. You are still getting an internal/local MongoDB, you are still burning CPU time monitoring files, etc.
If this is true, then the end result is that you will not scale at all. I doubt that running local MongoDB uses optlog, which is a HUGE performance boost for Meteor apps.
Your best bet would be to look at some automated build/deploy tools. I have personally used mup and mupx. The latest version of mup builds your app, sets up MongoDB (if you want) and nginx, builds them all as docker images, and deploys them. You can even setup SSL certs w/ nginx (although no Let's Encrypt support yet :(). Or, you could easily script the deployment yourself using any number of tools, including just raw scripts. I think in the long run you will be in much better shape than trying to run the app using the meteor command.

OpenShift Online, NodeJS, Jenkins, and package dependencies - can someone explain?

I'm running a NodeJS app on Openshift using Jenkins for building deployments (and I'm pretty new to both Node and cloud-based servers). My app depends on a package that has a binary component, so I can't just check it into git - it fails when it's executed on the server. I'm wondering what's the best way to deploy these sorts of dependencies. I see that there is an $OPENSHIFT_DEPENDENCIES_DIR (as well as $OPENSHIFT_BUILD_DEPENDENCIES_DIR), but I can't find any information about how (or if) these can be utilized for node modules. It would be great if I could keep all my dependencies on the server and out of my source tree.
Thanks!
Update: I forgot to mention that I need to apply a patch to the package in question, which is why I can't just rely on it being auto-installed via package.json. Plus, it seems awfully redundant/slow to rebuild all your dependencies on every deployment.
I'm also new to nodejs. I've been playing with nodeJs for about 6 months from now. As for my personal experience nodejitsu is the best cloud-hosting service for nodejs. As I said so due to the following reasons.
You can simply install jitsu command line in your terminal
Your app can be deployed with all the dependencies and databases using the package.json file
They support all the types of sockets either
A very good alternative for jitsu is heroku But sometimes heroku fails with Socket.IO and stuff.

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