Create public view of Node.js logs on Heroku - node.js

I have a Node.js app I built and deployed to Heroku that I use internally on my team to perform automated tasks against a 3rd party tool's API. I don't mind that I have to keep a terminal window open to keep an eye on the logs, but what would be really sweet is to put up a real-time view (heroku logs --tail) that anyone on my team could go look at to see the apps status, etc.
I've looked around and haven't found anyone else doing it.

heroku has an addon for logentries that is pretty sweet. it will give you parseable, searchable logs including live streaming them.
logentries:
https://logentries.com/
logentries add on:
https://elements.heroku.com/addons/logentries
other logging addons:
https://elements.heroku.com/addons#logging
you can always implement your own solution using herokus logplex system, which has an api:
https://devcenter.heroku.com/articles/logplex
or you can go deeper and implement something like the elk stack or any other similar technology:
https://www.elastic.co/webinars/introduction-elk-stack

Related

What type of web hosting do I need if I want to run a Node.js app

I want to build a web app with React for frontend and Node.js for backend. The problem comes when choosing the type of hosting I need. I know that for static files(eg. html with css and js) it's enough to have a standard web hosting, but if I want to have a server running Node.js app, do I need a dedicated server or VPS? Why?
I believe you can have either. Are you trying to do this professionally for a client or for a side project?
Personally, I use services like Heroku or Netlify (others here: https://blog.bitsrc.io/8-react-application-deployment-and-hosting-options-for-2019-ab4d668309fd). They run builds of node for your app and are free initially.
You can host your app and publish it for no cost at the beginning. However, on something like Heroku, if you don't pay, it takes 5 seconds for your website to wake up. But, this is great for prototyping. It gives you a URL so others can see it. They are basically version control systems that publish what you currently have. So you can just live push your project at any time and it updates your site.
If your prototype is working and you want it to be a fully dedicated app, then you can either pay or find services that host it. I would recommend prototyping first regardless and wouldn't pay until you need to.

Google App Engine How to implement Profiling(Stack Tracing)?

I am using Google App Engine to run my NodeJS app on flexible env, now i wanted to generate FlameGraph but the thing is as App Engine itself handle scaling and deploying of instances now can anyone please tell me how can i generate Flamegraph(NodeJs Profiling) to trace Requests coming on my NodeJs server.
If anyone of you has worked on Google App Engine on any Framework(NodeJs or any other), Can you all please tell me how did you solve this kind of problem on App Engine.
Update -
Why We need to delete the instance after debugging it.
Flame graphs are a visualization of profiled software, allowing the
most frequent code-paths to be identified quickly and accurately.
So FlameGraphs have nothing to do with networking, scaling or deploying to GCP.
Anyhow, FlameGraph is a just a 3rd party tool you can install and run. So the answer is you can make it work same way you would install and run on your local computer.
If you don't know how to use FlameGraph to profile NodeJS, then you should start reading some tutorials, as this site is not for that type of questions. A good one is here: https://nodejs.org/en/blog/uncategorized/profiling-node-js/
UPDATE: How to ssh into app engine flex instance
In google cloud console go to App Engine Flex -> Instances

Setting up Stackdriver on GAE running nodeJS

I'm trying to find some docs on setting up Stackdriver for nodeJS running on App Engine. The docs don't appear to provide it
https://cloud.google.com/debugger/docs/
However, did see a video where Stackdriver (or some other way of debugging) was being used for a node based app.
https://youtu.be/jsznS0QxtYI?t=25m12s
Any links to docs / tutorials appreciated
We're working on getting better documentation for this one very soon. For now, the best instructions are over on the GitHub repo readme:
https://github.com/GoogleCloudPlatform/cloud-debug-nodejs
Let me know if you have any trouble!

How Do I Set Up The MEAN (Mongo, Express, Angular & Node) stack on Nitrous.IO

I using the upcoming weekend to check two things off of my 2013 project list:
Give Cloud Development A Try
Try ANGULAR.JS
My game plan is to set up the MEAN stack on Nitrous.IO and then use the stack to complete one of the many Angularjs tutorial projects available online.
Questions:
I'd be interested in hearing if anyone has set up the MEAN stack on Nitrous or otherwise or if anyone is aware of any good blog post that go through the process for someone with little to no javascript development experience.
Also, if you have setup a MEAN stack are there any things you would do differently or are there any invaluable resources I should be aware of.
Some Resources I Found Useful:
I've been researching online for the past week and have uncovered some great resources, but it would be great to see what others have found or can suggest. Below are some links to some resources that I have come across that may be helpful to others:
Building Angular Start-up Stack - Toronto Meetup Stream
Egghead.io Offers some great Video tutorials on Angular
Google's Angular site has a wealth of info.
USC Linux User Group Youtube video on MEAN on Amazon AWS
Thanks in advance for any resources, insights or guidance.
Since you are starting on JavaScript I would suggest that you start simple. For example
Build a simple web site with Node.js and Express (no Angular, no Mongo).
Deploy it to the cloud.
Then add Angular and see how the structure changes when you use an MVC framework on the client side (e.g. your backend becomes a plain REST API).
Then, play with Node.js and Mongo probably outside your simple Node/Express/Angular app to get the hand of a NoSQL database and database access from Node.js (the fact that everything is async brings some interesting challenges for beginners)
Then integrate Mongo into your app.
Ok, here's how I successfully set-up the MEAN stack on Nitrous.IO.
First, many thanks to Valeri V. Karpov and his The Code Barbarian blog. In July he had a blog post titled Introduction to the MEAN Stack, Part One: Setting Up Your Tools. I primarily followed his article, only making adjustment dictated by the Nitrous cloud platform.
So here are the steps:
Create A Nitrous Box: Go to the Nitrous site and sign-up for an account. Please note the free account does not provide enough storage to accommodate the full MEAN Stack. You'll need at least a "Start" pricing plan - at $9.99 per month.
Create A Nodejs Box: Once you complete your registration and select a pricing plan, its time to create a Nodejs box. Follow the instructions on the Nitrous site. The box comes preconfigured Nodejs.
Install Mongodb: To install Mongodb on your box, go to the shell prompt and type: parts install mongodb You can confirm the installation was successful by typing parts start mongodb. To stop the mongodb server you type parts stop mongodb.
Confirm your Node & NPM Installations: Type node at the command prompt. You should see a > sign if node is installed correctly. You are now in the node shell. Type control-c to exit the shell. Type NPM at the prompt and you should see some usage information
Install Express: type npm install express -g The -g flag means the package will be installed so you can run it from the terminal. Note, if you are using the free box you will likely encounter errors during the Express installation as a result of you exceeded the allocated storage.
From here on you can follow Valeri's article at Step 4 Creating an ExpressJS application..
Good luck and enjoy.
Use Bitnami https://bitnami.com/stack/mean. I like it a lot, pretty simple and concise. In my case it was for Windows and it was a seamless experience

how to editor cloudfoundry app online?

Sometimes, we only need to change a little line, so vmc push is too slow.
Is there any NodeSJ module or service that can direct edit the code online?
Does Cloudfoundry has a dashboard?
By the way, how do you download app and log as a zip?
If you look at how vmc push works, you will know from point 11 that the application is packaged by vmc by looking at all the differences and then pushed to the server. So cloudfoundry itself does not have a code editor.
To edit your code online you can use another service like http://c9.io and follow these docs to see how to push to cloudfoundry
CloudFoundry does not have a dashboard. (as of this writing)
But there is another service based on micro cloudfoundry, called as appfog - and it has all the UI stuff + support for other platforms.
Downloading app logs can be done with the help of this answer

Resources